An alternative way to access WinAutomation Processes is through the Command Line


This is mostly useful if you write your own scripts or programs and you want to run WinAutomation Processes from your programs.

You can control WinAutomation from the command line using the WinAutomationController.exe that is located in the installation folder of WinAutomation.


WinAutomationController.exe has the following three switches:

  • /start - this will start a specified Process, using the following format:
    • Example: WinAutomationController /start processPath processCLA1 processCLA2
  • /stop - this will stop a specified Process, included as a Command Line Argument
    • Example: WinAutomationController /stop processPath
  • /ListRunning - this will list all running Processes at the moment. The information that the command line will give back to you, will include the number of Processes that are running and a list with all the running Processes instances.
    • Example: WinAutomationController /listrunning


WinAutomation Controller /listrunning



where 'processCLA1' is the first Command Line Argument you include, 'processCLA2' is the second, etc. 


Command Line Arguments are information you need to send to the Process, such as a file path, URL or other needed information, and can be retrieved by the WinAutomation Process with the 

"Get Command Line Arguments" Action, under WinAutomation Actions.


Example: The following process, captures the Command Line Argument and displays them as messages.


                                                          


                                                                                                                                                    


The processPath is the path in the WinAutomation Console for the particular Process, from a base directory of My Processes in the Folders Pane on the left side. 

So if your Process is in the My Processes directory, the name of the Process is sufficient. 

If you have put the Process in a subfolder, you will need to include that information in the processPath.


Note: If the processPath contains spaces, it should be enclosed in double quotes (e.g. WinAutomationController /start "/My Robots/../../process").

As an example, say you have created a Process that uploads a file that you specify to an FTP site you designate. You want another program to call up this WinAutomation Process, UploadFile, from the Command Line. The Process has not been compiled, and is stored in the subfolder of My Processes called 'FileProcesses'. It will need to be told where the file to be uploaded is located, but the URL to upload the file to was already set in the Process.


Your Command Line would look like this:

WinAutomationController /start /FileProcesses/UploadFile C:\NewFile\upload.txt


You can also import and export a Process to and from WinAutomation from the command line using the following switches:

  • /import - this will import the specified waj file into the WinAutomation Processes database (within the specified folder)
    • Example:
      WinAutomationController /import "c:\Users\Some User\Documents\MyProcess.waj" "My Processes/Examples"
  • /export - this will export the specified Process into a .waj file on the disk.
    • Example:
      WinAutomationController /export "My Processes/Examples/MyProcess" "c:\Users\Some User\Documents\MyProcess.waj"


Furthermore, you can also enable and disable a Process in WinAutomation from the command line using the following switches:

  • /enable - this will enable the process specified in the process Path.
    • Example:
      WinAutomationController /enable "/My Processes/Path to/Some Folder/MyProcess"
  • /disable - this will export the specified Process into a waj file on the disk.
    • Example: WinAutomationController /disable "/My Processes/Path to/Some Folder/MyProcess"


Additionally, you can get all WinAutomation folders or a specific's folder Processes data under a specified folder in XML format and display the results in the console or via a file:

  • /getallfolders (console|file path) - this will get all WinAutomation folders in XML format and display the results in the console or via a file

Parameters:

console - print the data to the console

file path - print to the file specified by path

  • /getProcessesoffolderPath (console|file path) - this will get a specific's folder Processes in XML format and display the results in the console or via a file

Parameters:

folderPath - folder path containing the Processes you want to get. ID can be retrieved by executing the /getallfolders command

console - print the data to the console

file path - print to the file specified by path


Last but not least, you can export the data from a server to a specific data path:

  • /exportserverdata fileToExportServerDataPath - this will export data from the server and store them in fileToExportServerDataPath
    • Example: WinAutomationController /exportserverdata textFilePath


Exit Codes of the WinAutomation Controller

It is a common practice for applications to return a certain code (number) upon termination; this number is called the "Exit Code". The Exit Code is 0 (zero) when the application terminates normally, while a non-zero value usually indicates that an error was encountered during the execution. The WinAutomation Controller returns one of the following non-zero values whenever an error is encountered:

Exit Code(s)
Meaning
1
The syntax of the command is incorrect
2
Process not found
3
Process to be stopped was not found running
6
The file to be imported does not appear to be a Process (.waj) file
7
Cannot read from the file to be imported
8
Cannot find the Process to be exported
9
Cannot write the Process file to the specified path
100
General Exception while performing the requested operation*
101
Could not communicate with the WinAutomation Service / Service Unavailable


* Additional information regarding this error will be produced and stored into WinAutomation's Logs.


Note: The "Run DOS Command" Action is suitable for both running the WinAutomation Controller, as well as storing the returned Exit Code into a variable for later use.