Application Launching

Run

Purpose:

Execute an external Windows application or DOS command.

Category:

Applications

Syntax:

Run "command" "parameters" "options" "subroutine" "variable"

command

The file name and location of the application to be launched.

parameters

Optional items to be passed to the application (a file name, command switches, etc.)

options

One of the following:


Normal

Run the application normally.

Wait

Suspend VisualNEO for Windows until the application closes.

LoadComplete

Suspend VisualNEO for Windows until the application has finished loading.


Additionally, you may combine one of the choices above with any of the following:


RunOnce

Prevent more than one copy of the application from running at a time.

Minimized

Launch the application in minimized mode as an icon on the Windows Task Bar.

Hidden

Hide the application's main window. Some types of applications will not allow their main window to be hidden and will ignore this option. Hidden works well when running most DOS command line utilities, batch files, etc. that do not require interaction from the user.


You cannot use both the "Minimized" and "Hidden" options at the same time.


subroutine (optional)

The name of a subroutine block to execute when the application closes. Leave this blank if you do not wish to use a subroutine. (See App Properties > Actions for more information about subroutines.)

variable (optional)

The name of the variable store the application's unique identification number. This ID can be used to identify the application to other Actions.

Example:

Run "c:\windows\notepad.exe" "" "Normal+RunOnce" "" "[AppId]"


When compiling a publication, VisualNEO for Windows will localize the command by removing the drive and path from the application’s file name. In the example above, “c:\windows\notepad.exe” would be changed to “notepad.exe”. This behavior is useful for publications that are designed to be used on a variety of computer systems where drives and directories may be organized differently. In some situations, however, you may prefer to leave the drive and path information intact. This can be accomplished by simply placing an exclamation point character ( ! ) at the beginning of the file name. For example:


Run "!c:\windows\notepad.exe" "" "Normal+RunOnce" "" "[AppId]"


More often than not you will probably want to distribute programs launched with Run along with your compiled VisualNEO for Windows publication. In that situation, you will want to use the [PubDir] variable instead of a literal path. This will insure that your publication will always be able to locate the application you're attempting to launch. For example:


Run "![PubDir]My App.exe" "" "Normal" "" "[AppId]"


At runtime, VisualNEO for Windows will replace the [PubDir] variable with the location of your compiled VisualNEO for Windows publication exe. In the above example, both “My App.exe” and the compiled pub exe are located in same folder. This will work regardless of whether the files are run from the hard drive, CD, etc.


Before distributing any compiled exe files or utilities that were created by someone else, you should obtain permission from the person who owns the rights to that program.


Plug-in developers and others may find the global [AppID.ProcessID], [AppID.ProcessHandle],  [AppID.WinHandle] and [AppID.ExitCode] variables useful.


RunInRectangle

Purpose:

Execute an external Windows application inside a Rectangle object. The application's window will be sized and/or clipped to fit within the bounds of the specified Rectangle object. This may not work with some types of applications.

Category:

Applications

Syntax:

RunInRectangle "object name" "command" "parameters" "options" "subroutine" "variable"

object name

The name of an existing object.

command

The file name and location of the application to be launched.

parameters

Optional items to be passed to the application (a file name, command switches, etc.)

options

One or both of the following:


HideMenu

Attempt to hide the application’s menu bar. May not work with some applications.

HideSizeBox

Attempt to hide the application’s size box, which usually appears in the lower right corner of the main window.


subroutine (optional)

The name of a subroutine block to execute when the application closes. Leave this blank if you do not wish to use a subroutine. (See App Properties > Actions for more information about subroutines.)

variable (optional)

The name of the variable store the application's unique identification number. This ID can be used to identify the application to other Actions.

Example:

RunInRectangle "Rectangle1" "notepad.exe" "" "" "" "[AppId]"



Plug-in developers and others may find the global [AppID.ProcessID], [AppID.ProcessHandle],  [AppID.WinHandle] and [AppID.ExitCode] variables useful.


CloseApp

Purpose:

Close a running application program.

Category:

Applications

Syntax:

CloseApp "application" "mode"

application

The file name of a running program or an application ID variable returned by Run or RunInRectangle.

mode

One of the following:


RequestClose

Send a message to the application asking it to close. The application may ignore this request.

ForceClose

Force the application to close. The application will not have an opportunity to follow its normal shutdown routine which may result in lost data.

Example:

CloseApp "[AppID]" "RequestClose"


IsAppRunning

Purpose:

Determine if a specific application is running.

Category:

Applications

Syntax:

IsAppRunning "application" "variable"

application

The file name of an executable program or an application ID variable returned by Run or RunInRectangle.

variable

The name of the variable to store the results. If the application is running, the variable will be set to “True”, otherwise, it will be set to “False”.

Example:

IsAppRunning "notepad.exe" "[Result]"


SendKeys

Purpose:

Send keystrokes to another Windows application. This Action allows you to control another application by simulating keys being typed on the keyboard. If the application is not already loaded, then SendKeys will launch it prior to sending any keystrokes.

Category:

Applications

Syntax:

SendKeys "application" "keystrokes"

application

The file name of an executable program or an application ID variable returned by Run or RunInRectangle.

keystrokes

Keystrokes may include text and any of the special key codes listed below:


{BS}

{F2}

{F7}

{F12}

{Left}

{Del}

{Tab}

{F3}

{F8}

{Home}

{Right}


{Enter}

{F4}

{F9}

{End}

{PgUp}


{Esc}

{F5}

{F10}

{Up}

{PgDn}


{F1}

{F6}

{F11}

{Down}

{Ins}



You can also specify the state (up/down) of the Shift, Control and Alt keys to access virtually the entire range of key combinations. Key codes for these keys are:


{ShiftDn}   {ShiftUp}   {CtrlDn}   {CtrlUp}   {AltDn}   {AltUp}


These keys must always be used in pairs. For example, if you use {ShiftDn} you must remember to follow it with a {ShiftUp} code, otherwise your keyboard will behave as if the Shift key is stuck in the down position.

Example:

The following example opens the Windows Notepad utility types "Hello world" and executes the File/Print command:


SendKeys "notepad.exe" "Hello world{Enter}{AltDn}FP{AltUp}"


SendMenuCommand

Purpose:

Send a menu command to an application.

Category:

Applications

Syntax:

SendMenuCommand "application" "commands"

application

The file name of an executable program or an application ID variable returned by Run or RunInRectangle.

commands

The menu commands to execute separated by commas. Can be formatted as text “File,Open”, or a numeric index “1,2” indicating the position of the items in the menu tree.

Example:

SendMenuCommand "[AppID]" "File,Open"


DropFile

Purpose:

Pass a file name to an application by simulating a drag and drop event.

Category:

Applications

Syntax:

DropFile "application" "file name"

application

The file name of an executable program or an application ID variable returned by Run or RunInRectangle.

file name

The name of an external file to be dropped on the application.

Example:

DropFile "notepad.exe" "[PubDir]notes.txt"


SetWindowPos

Purpose:

Set the size and position of an application's main window.

Category:

Applications

Syntax:

SetWindowPos "application" "left" "top" "width" "height"

application

The file name of an executable program or an application ID variable returned by Run or RunInRectangle.

left, top

The window’s new left, top position. Use “-1” instead to center the window on the screen.

width, height

The window’s new width and height. Use “-1” to keep the window’s current dimensions.

Example:

SetWindowPos "[AppID]" "100" "100" "350" "450"


GetWindowPos

Purpose:

Get the current size and position of an application's main window.

Category:

Applications

Syntax:

GetWindowPos "application" "x var" "y var" "width var" "height var"

application

The file name of an executable program or an application ID variable returned by Run or RunInRectangle.

x var

The name of the variable to store the window’s left position.

y var

The name of the variable to store the window’s top position.

width var

The name of the variable to store the window’s width.

height var

The name of the variable to store the window’s height.

Example:

GetWindowPos "[AppId]" "[X]" "[Y]" "[W]" "[H]"


BringAppToFront

Purpose:

Bring an external application's main window to the foreground.

Category:

Applications

Syntax:

BringAppToFront "application"

application

The file name of a running program or an application ID variable returned by Run or RunInRectangle.

Example:

BringAppToFront "[AppID]"


SendAppToBack

Purpose:

Send an application's main window to the background.

Category:

Applications

Syntax:

SendAppToBack "application"

application

The file name of an executable program or an application ID variable returned by Run or RunInRectangle.

Example:

SendAppToBack "[AppID]"


DisableApp

Purpose:

Disable mouse and keyboard input to an application's main window.

Category:

Applications

Syntax:

DisableApp "application"

application

The file name of a running program or an application ID variable returned by Run or RunInRectangle.

Example:

DisableApp "[AppID]"


EnableApp

Purpose:

Enable mouse and keyboard input to an application's main window. Use in conjunction with DisableApp.

Category:

Applications

Syntax:

EnableApp "application"

application

The file name of a running program or an application ID variable returned by Run or RunInRectangle.

Example:

EnableApp "[AppID]"


RunVisualNEO for Windows

Purpose:

Run another compiled VisualNEO for Windows publication. The current publication will be closed and the new one opened in its place. RunVisualNEO for Windows can be used to link several smaller publications together to gain the same functionality as a single larger publication.


When using this option to link multiple publications, the first publication must be compiled as a fully executable exe or runtime package (with NBRun5.exe). Other publications in the group can be compiled as runtime packages or web browser plug-ins to conserve space.

Category:

Applications

Syntax:

RunVisualNEO for Windows "file name" "options"

file name

The name of a compiled VisualNEO for Windows publication (*.exe, *.pkg).

options

Can be none, one or both of the following:


ClearVars

Clear all variables before loading the other publication. Omit this option to share variables between the two publications.


Variables assigned to objects that are auto-initializing, like Radio Buttons, Check Boxes and Text Entry Fields, will be reset to their default state when the new publication loads. Other variables, not assigned to auto-initializing objects, will remain when the ClearVars option is omitted.

CloseWindows

Close any open windows created with ImageWindow, TextWindow or CustomWindow. Omit this option to leave windows open after loading the other publication.


Example:

RunVisualNEO for Windows "[PubDir]MyOtherPub.exe" "ClearVars+CloseWindows"


Note: Sharing custom windows between publications, can lead to a situation where you have more than one object with the same name. VisualNEO for Windows prevents this from happening within a single publication, but there's no way to do that across multiple publications. This only a problem if you need to affect such an object using an Action that requires an object name such as ShowObject. When two objects with the same name exist at the same time, the object in the custom window will have precedence over the publication-based object. When this situation exists, it's not possible to affect the publication-based object because the windowed object will intercept the command first. This shouldn't present a problem as long as you take care when designing your publications.



Add-On Utilties

ExecuteAddon

Purpose:

Activate a third party Add-On function designed for VisualNEO for Windows 3.x.

Category:

Applications

Syntax:

ExecuteAddon "add-on file name" "commands"

add-on file name

The name of the Add-On’s exe file.

commands

The required commands will vary depending on the Add-On used. Please consult the individual Add-On’s documentation for instructions.

Example:

ExecuteAddOn "c:\add-ons\NeoSock.exe" "nsOpen 21"


Note: Add-ons created for previous versions of VisualNEO for Windows can still be used, but should be replaced with the newer Plug-In versions of those tools when available.



Obsolete

DOSCommand

Purpose:

Execute an external Windows application or DOS command. This Action is obsolete, please use Run instead.

Category:

Applications

Syntax:

DOSCommand "command" "params" "options"

Example:

DOSCommand "notepad.exe" "c:\test.bat" "Normal"