Automating work with applications and documents, using Windows commands

With MouseRobot you are able automate your work with any Windows-based programs, documents, use Windows commands.

To run programs, open documents and run Windows commands the "Windows Command" step is used.

Windows Command step

It is difficult to overestimate the capability of this step, because in addition to other things, it can send documents to print, finish a program, hide and resize windows.

Windows command step settings

NOTE If the step is used to run applications or open a page on Internet, it is desirable to set "Step timeout" ("Common" panel) for 10 seconds or more for the immediately following step. This will increase a reliability of a task performance, as a time needed to run a program can vary greatly depending on a workload of the computer, a network speed and many other factors, even if usually automated program starts quickly.

Running a program

  • Most often the step "Windows Command" is added to a task to run a automated program. In this case, it's required to enter a program name and, if necessary, a path to a file and start-up parameters.
  • A name of a program can be entered manually and selected using a file selection dialog or a drop down list that duplicate the "Start" menu items.
  • Startup options are written on one line and are separated by spaces. If a parameter can contain spaces, it must be specified in double quotes (" ").
  • Program file name and startup parameters can be substituted by variables or expressions from MouseRobot.
  • The "Display Mode" field allows you to redefine mode of a program window after start-up. By default, a size and mode of windows are determined by starting program independently ("Show window" mode), however, you can run a program minimized, maximized or hidden, if necessary.
  • The "Default Directory" field allows you to specify in which directory a program will be primarily searched for (if it has no full path specified), as well as files referred to it as parameters. Please note, that changing the default directory will affect only a starting program.

Opening a document or a web page

  • To open a document or a web page in a program by default, just enter a name of a document and a path to the "Command, object or file" field.
  • You can specify an operation for a file if necessary (e.g. "open", "edit" or "print").
  • If a document or a web page needs to be open in a specific program (possibly different from a program, assigned in a system by default for a file type), the program name should be specified in the "Command, object or file" field and a file name or the Web address to be specified in the field "Options".

Examples of commands:

Command Parameters Action Description
"D:\1.docx" - run Open the document 1.docx in an associated program (in MS Word or other) in a selected display mode
"D:\1.docx" - edit Open the document 1.docx in an associated program (in MS Word or other) in a selected display mode
"D:\clear.xtsk" - run Run a MouseRobot macro
"D:\clear.xtsk" - edit Open a MouseRobot macro for editing
www.google.com - run Load a Google page in your default browser
iexplore www.google.com run Load a Google page in the Internet Explorer

Directing a window of a program

  • Use {LastControl} variable to control the last found graphic object, {LastProcess} to control the main window of recently run program. Enter an appropriate variable to the "Command, object, or file" field, and select "Show window" in the "Action" field.
  • A required mode of a program window (minimized, maximized, to full screen or hidden) specify in the "Display Mode" field

Examples of commands:

Command Action Display mode Description
{LastControl} close - Close the application  that owns {LastControl}
{LastControl} kill - Kill the application that owns {LastControl}
{LastControl} show show hide
show minimized
show maximized
show normal
Show the window that owns {LastControl} in the chosen display mode
{LastProcess} close - Close the application {LastProcess}
{LastProcess} kill - Kill the application {LastProcess}
{LastProcess} show show hide
show minimized
show maximized
show normal
Shows the main window of application {LastProcess} in the selected display mode

Sending a document to print

To send a document to print, specify a path and name of the document in the field "Command, object or file" and choose the action "Print".

Note that this method will work only, if this type of document is associated with a command of print.

NOTE To check whether a document is associated with a print command, open a context menu of the document in the Windows Explorer. If the print command is assigned, the "Print" menu will be displayed.

Examples of commands:

Command Action Description
"D:\1.docx" print Open a document 1.docx in an associated program (in MS Word or other), call the print command, close the program

Windows commands execution

  • Microsoft Windows has a large number of commands and utilities able to solve almost any problem on the system control, files, settings, etc. Some of them are separate programs (e.g.: ping, telnet, ftp, rundll), while others are built-in commands and are not stored physically on a disk (for example: copy, del, move, mkdir).
  • To run a Windows command, specify its name in the "Command, object, or file" field and fill the settings according to the command syntax. It is also recommended to enable the flag "Wait for termination" because otherwise the MouseRobot will continue task execution until a completion of the command. In addition, a code of the command execution result can only be obtained with the active flag "Wait for termination".

Examples of commands:

Command Parameters Description
copy "c:\folder1\doc1.txt" "c:\folder2" Copy doc1.txt from c:\folder1 to c:\folder2
rundll32 shell32 SHExitWindowsEx 2 Restart a computer
ftp -s:ftpcommands.txt ftp.microsoft.com Connect to ftp.microsoft.com and run commands from a file ftpcommands.txt.
For example, load the file "file.txt":
get file.txt c:\temp\file.txt
ping google.com Check a connection between network nodes. If there is a connection between current computer and google.com, then {LastProcessExitCode} = 0

NOTE By default, when executing a command, MouseRobot checks only a success of its running, but not a result of performance. Compare a value of the variable {LastProcessExitCode} after the command execution with zero to verify the success of execution. You can determine a type of an error by the value of the same variable, which occurred at the command execution. Decoding error codes is specific for each command, and can be found in Windows documentation.

Forcible Termination of Program

To finish a program being executed, refer to it using the variables {LastProcess} or {LastControl}, and choose the "Kill" function. In this case, the program will be forcibly terminated and any unsaved data will be lost. Therefore, it is desirable to use the forced termination of the program only in exceptional cases: when the program is "frozen", or there is no other possibility to interrupt the prolonged operation it is executing.

 

Bookmark & Share

Share/Bookmark

Subscribe to Blog

AutomationBox Blog

  Testimonials

 

View all

 

I love MouseRobot! An actual macro style recorder that operates by function rather than by cursor location. This is way easier to use and understand than any other macro program.
Aitken Rendell, technical support consultant

I am web developer and typically I have a lot of programs open. With MouseRobot I can run the single script, and a few seconds later my work area is ready to go! This is amazing!
Phill Judd, web developer

  News

 

November 11, 2010
New Feedback System

 

October 16, 2010
MouseRobot 2.0 released!

Information
Download Now!

 

June 24, 2010

MouseRobot 2.0
(beta-version) available

 

June 21, 2010

Site design changed!

 

News Archive >>