Setting up the Windows Form Filler

Root > Secret Server

What is the Windows Form Filler?


The Windows Form Filler is an automation helper that can be used to fill in text and automate clicks on any Windows Form Application. The commands can be customized for launching many Windows applications that do not take command-line arguments. Creating a Custom Process Launcher in Secret Server and setting it to use the Windows Form Filler will allow you to launch existing applications and securely pass the credentials.


To download the Windows Form Filler, please go here (Note it requires an active license).

Using the Windows Form Filler

To use the Windows Form Filler, you must first navigate to the Launcher List page (Administration -> Secret Templates -> Configure Launchers) and click new to create a custom launcher. 

  • As a Process (requires adding the WindowsFormFiller to client machine's PATH):

Provide a Launcher Name and select “Process” as the launcher type; it is recommended that the Launcher Name be related to the program and task the Windows Form Filler will be doing. The Process Name has to be the Windows Form Filler‘s filename as well as the full path of the executable on your server or computer.

  • As a bat file:
The bat file will confirm the Windows Form Filler exists and then cd to that directory to run. This would require the directory to be the same on all machines (C:\WindowsFormFiller\ in the example) that use the Launcher. An example bat file can be found here.

Providing Automation Commands

To control the Windows Form Filler, a list of commands must be added to Process Arguments field in the Custom Launcher Edit page. Every command list must either start with the process command, the help command, or the timer command.

The help command will print a list of all possible commands as well as simple instruction for their use. Use –h, -help, or ? for the help command.

Specifying the Process

The process command is used to specify what process to start or attach to. Use –p [processName] -new to start a new process or –p [processName] to attach to a process that is already running. Note if -new is not specified, but an open process is not found, it will attempt to start this process. As an example, to launch the calculator application, use:

                -p calc.exe -new

To Start the process with additional command-line arguments, use -arg for each argument. - arg [arg1] -arg [arg2] -arg [arg3] .....

NOTE: -arg only works when using the -new command

-p notepad.exe -new -arg "C:\\temp\test.txt"

-p mstsc.exe -new -arg /admin -arg /f

Identifying Inputs for Commands (Configuration)

After the process command, you can either show a list of all UI items or provide a list of UI actions. 

To show a list of all UI items and their ID, Text, Type, and location, use:

 -s or -show for a basic log

-slog for a more detailed log

It is extremely helpful to use this command before attempting to build an action list since either the item’s ID or Text will be needed in order to run actions. You can save the log as a file by using -file [filePath]

Basic Interactive Commands (Fill and Click)

Windows Form Filler currently supports two kinds of actions: click and fill text. 

To fill an item with text, use:

–fill -id [itemID] [text] 

–fill -text [itemText] [text]

–fill -type [combobox/button/checkbox/...] (advanced)

–fill -index [integer] (advanced)

To click an item, use:

–click -id [itemID]

–click -text [itemText]

–click -type [combobox/button/checkbox/...] (advanced)

–click -index 4 (advanced)

The fill text can also use parameters from:

·         A field value from the secret. (Ex: –fill -id usernameLoginTextBox $USERNAME)

·         A field value from a linked secret. (Ex: –fill -id usernameLoginTextBox $[1]USERNAME)

·         User input obtained from a prompt prior to launching. (Ex: –fill -id usernameLoginTextBox $SERVER)

Parameters are prefixed with a dollar sign ($). To obtain a value from the secret being launched, use $FieldName.

Actions run in the order they are given. For example, typing the following will open the calculator app, multiply 10 by 3, and click the equals button.

                -p calc.exe -new -click -text 1 -click -text 0 -click -id 92 -click -text 3 -click -id 121  

Handling Wait Screens

If the application takes a while to load or displays a splash screen, the Windows Form Filler will require specifying a timeout wait ( in milliseconds).  This setting can makes the Form Filler poll for a UI item, attempt an action on an UI item continuously, or wait before logging until the timers are up. Note the –t can be set multiple times and effects all commands that follow. Specifying -t without any command resets all timers back to 0.

-t(or -timer) [-action milliseconds] [-log milliseconds] [-search milliseconds]

As another example, typing the next line will open notepad and type “Name: [secret user name field]”  and “Password” [secret password field]”.

-p notepad.exe -new –t -action 10000 -fill -id 15 “Name: “-fill -id 15 $username –fill -id 15 “ Password: ” –fill -id 15 $password


Use -end as the last command to make the WindowsFormFiller close once it has completed. (Recommended)

See the Help Guide below for full details on every command.


Examples:

VMware Client (VpxClient.exe)

-p "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" -new -fill -type combobox $SERVER -fill -id textUsername $USERNAME -fill -id textPassword $PASSWORD -click -id btnConnect -end

OR
-p "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" -new -find var_ip -type combobox -fill var_ip $SERVER -find var_username -id textUsername -fill var_username $USERNAME -find var_password -id textPassword -fill var_password $PASSWORD -find var_button -id btnConnect -click var_button -end


MySQL Administrator (MySqlAdministrator.exe)

 -p "C:\Program Files (x86)\MySQL\MySQL Tools for 5.0\MySQLAdministrator.exe" -new
Starts a new MySql Administrator program
-find username -type edit -index 3
Saves the username text box as username by targeting the 4th(zero-based indexing) edit control
-find server -type combobox -index 1
Saves the server text box as server by targeting the 2nd combo box
-find password -index 4 -type edit
Saves the password text box as password by targeting the 5th edit control
-find port -type edit -index 1
Saves the port text box as port by targeting the 2nd edit control
-find okButton -text OK -type button
Saves the OK button as okButton by targeting a button control with text OK
-fill username "USERNAME"
-fill server "SERVER"
-fill password "PASSWORD"
-fill port "1111"
-click okButton

The command -slog -file "filename" was used to first print the UI items and their information. Logging showed that most UI item IDs changed with every new process of this program. Although it is usually recommended to use an item's ID instead of the index, in this case, searching by index is more reliable.


SQL Plus

-p sqlplusw -new -find username -id 101 -fill username "$USERNAME" -find password -id 103 -fill password "$PASSWORD" -find host -id 105 -fill host "$HOST"-find button -id 800 -click button -end


----------------------------------- Help Guide from Console -------------------------------------------------------------

Starting and Switching Processes

-------------------------------------------------------

-p|-process [processName] (-index [index]) (-new) (-arg [arg1] -arg [arg2]...) (-sw [processToSwitchTo] (-index [index]))

Gets a process that is already running or starts a new process

-index is an optional parameter. If multiple processes of the same type are running, use index to pick a process other than the default.

    An index of 0 picks the process with the earliest start time while a process of -1 picks a process with the latest start time.

    An index of 0 is the default.

-new is an optional parameter. Forces opening a new process.

-arg is an optional parameter. If a new process is opened, it is called with the specified arguments

-sw is an optional parameter. If a process opens a new process when started, use -sw to switch the new opened process.


Before running any Logging, Search, or Action commands, a process must be specified.

-arg only works when using the -new command.

Before switching to another process with the -sw command, the action timer is applied as a wait.

When searching for a process, the search timer is used as a timeout.


Logging

-------------------------------------------------------

-s|-show (-file [fileName]) (-target [targetUI]) 

Shows a brief list of UI items as well as their IDs, visible text, type and location.

-file is an optional parameter. Saves the log to [fileName] instead of printing it in the console.

-target is an optional parameter. When specified, prints a log for the item [targetUI] and its child elements only.

    targetUI must be an already saved UI element


-slog (-file [fileName])

A more detailed log for all UI items.

-file is an optional parameter. Saves the log to [fileName] instead of printing it in the console.


Any timer commands before the logging command will make the logger wait before logging. To disable, set the timer command to 0.



Searching and Saving

-------------------------------------------------------

-find [name] (-text [text]) (-id [id]) (-type [itemType]) (-index [index])

Finds a UI item and saves it as [name] for reference later.

-text is an optional parameter. Searches for the UI item by its text.

    Text usually represents the word on a button or the text in a textbox.

    Text may change.

-id is an optional parameter. Searches for the UI item by its ID.

    Id is less likely to change as compared to Text.

-index is an optional parameter. Searches for the UI item by its (0 based) index.

    Search by index is useful when many UI items share IDs and texts.

-type is an optional parameter. Searches for the UI item by its type.

    To see a list of valid types, use -listTypes

You can specify any combination of parameters to search for an UI item.


-findPath [name] (-node [nodeArgs] -node [nodeArgs]...)

Finds a UI item by traversing the node path and saves it as [name] for reference later.

-node represents a node element. [nodeArgs] are the the same optional parameters from using the -find command.

Having a blank [nodeArgs] is equal to -index 0


Any timer commands before the find command will make the searcher continue searhing until the timer is up or the item is found.

Use one of the logging commands to help find an UI item.

Action commands require a saved UI item.



Actions

-------------------------------------------------------

-click [uiItem]

Clicks an UI item.


-fill [uiItem] [text] (-noclear)

Fills an UI item with [text].

-noclear is an optional command. By default, present text is cleared before adding new text.

    Use -noclear when appending to already existing text.


-window [uiItem]

Used to switch to another window when an application has multiple windows.

This command is unecessary for modal windows that block a parent window.

In that case, the modal window UI items are added to the parent window's items list.


-clickSim [uiItem]

Clicks an UI item by simulation.


-fillSim [uiItem] [text]

Fills an UI item with text by simulation.


Simulation Actions should only be used if the original action fails.

UI items must be saved before being referenced or created in the action statement.

For example, "-fill -id itemID textHere " fills an item with ID "itemID" with the text "textHere".



Additional Commands

-------------------------------------------------------

-help|-h|? (-file [fileName])

Shows all possible commands.

-file is an optional parameter. Specifying it saves a help file.


-t|-timer (-log [logTimer]) (-search [searchTimer]) (-action [actionTimer])

Sets the timer values.

-log is an optional parameter. Sets the how long to wait before logging.

-search is an optional parameter. If an UI item is not immediately found, will continue searching until this timer is up.

-action is an optional parameter. If an action fails the first time, retries until this timeer is up.


All timer values are in milliseconds

Using -t or -timer with no values specified will show the current timer values.


-listTypes (-file [fileName])

Shows a list of control types.

-file is an optional parameter. Specifying it saves a help file.


-end

Ends the Windows Form Filler automatically after it completes all commands.


-reset

Resets the Windows FormFiller.

Removes all saved UI items and attached processes.


-run

Processes the commands before the run statement separately from commands after the run statement.

Useful when debugging multiple independent commands.


-endOnFail

Toggles the endOnFail variable. When enabled, ends the WindowsFormFiller after a command fails.

Will not end the WindowsFormFiller if a command does not fail. Use with -end after all commands tp ensure a progrma always exits.


-state

Shows the state of the console app.

Prints the current process, window, and saved UIItems information.



Add Feedback