Back

Command Open 0r Open2
Parameters The file, folder or application to open. The web site to visit. The email address to write to. The phone number to dial.

Examples....

Open "C:\Program Files\Microsoft Office\Office11\Winword.exe"
Open "%windir%\system32\notepad.exe"
Open "C:\Users\Limited\Documents\Book1.xls"

Open "http://m8software.com"
Open "support@m8software.com"
Open "0151 234 2134"

Notes
The parameter must be in quote marks. Spartan will add them for you.

A quick way to get the parameter for a program, file or folder is to right click on its shortcut, click Properties and copy the contents of the Target field,

The Open command waits for the opened program to load before continuing the script. The Open2 command does not. With the vast majority of applications, Open will give you the result you want but it is not fool proof. There has to be a limit to the time Open will wait otherwise Spartan would hang up if the application failed to start. Spartan waits 30 seconds for programs that have introductory (Splash) screens and 10 seconds for programs that do not. If an application does not start within these time limits, Spartan displays this dialog...

If this happens when opening one of your applications, time how long it actually takes to start then use the Open2 command followed by the Wait command. For example...

Open2 "My slow to start app.exe"
Wait 35

If you use Open with a web site, the site is opened in your default browser. To open a web site in a particular browser, open the browser with the site on the command line. For example...

Open "C:\Program Files\Internet Explorer\iexplore.exe https://hangouts.google.com"

When you Open a program like Notepad or Word, you can be sure that it is ready to accept Type or Paste commands. When you open a web site, you can not. The script will continue as soon as the browser has loaded. The web page may not be ready to accept input. In these cases you will still have to use an appropriate Wait. In the following script, which dials a number at Google Hangouts, the page was not ready to accept input for 7 seconds after Internet Explorer loaded....

[[Script]]
Open "C:\Program Files\Internet Explorer\iexplore.exe https://hangouts.google.com"
Wait 7
Mouse 313 , 164W
Click
Paste 01514252671
Wait 2
Type Enter

 

Back