Eggplant Functional Interface and Run Options Control

These commands and functions allow you to set options for the Eggplant Functional GUI and modify script run options.

PauseScript Command

Behavior: Pauses script execution before the next command. The script remains paused until you manually continue, step ahead, or abort. For more information, see The Run Window.

Note: This command has no effect when Eggplant Functional is run from the command line.

Parameters: None.

Example:

PauseScript

SetOption, SetOptions Commands

Behavior: Changes the value of run options for the current script.

Parameters: One or more global properties and the values you are changing them to. For more information, see Local and Global Properties in SenseTalk.

Example:

SetOption ShouldRepositionMouse:yes

Example:

SetOptions {searchRectangle:["FormUpperLeft","FormLowerRight"], NextKeyDelay:.1, RemoteWorkInterval:.2}

GetOption, GetOptions Functions

Behavior: Returns the current value of the given global properties.

Tip: If you do not pass a parameter value, GetOption and GetOptions return a list of all Run Option global properties and their current values. For more information, see Local and Global Properties in SenseTalk.

Parameters: None, one or more global properties, or global property groups.

Returns: The value of the specified global property, or a global property list. For example:

(defaultCaptureScreenSize:"", defaultScale:"", enableBackslashEscapeCodes:"False", forceScreenRefresh:"False", hotSpotScaling:"Inner", imageSearchCount:"7", imageSearchDelay:"0.3", keyDownDelay:"0.001", mouseClickDelay:"0.02", mouseDoubleClickDelay:"0.01", mouseDragSpeed:"10", mouseMoveDelay:"0.01", mouseMoveMode:"0", mouseMoveSpeed:"0", mouseRepositionSpeed:"0", nextKeyDelay:"0.1", preciseImageTolerance:"1", remoteWorkInterval:"0.2", scaleMultiplier:"1", sendShiftForCaps:"True", shouldRepositionMouse:"False", standardImageTolerance:"45", swipeSpeed:"40")

Example:

log GetOption()

Example:

put GetOption(scriptLogging)

Example:

log GetOptions(TextOptions)

The global property groups are:

Hide RunWindow, Show RunWindow Commands

Behavior: Hides or shows the Run window.

Note: This command has no effect when Eggplant Functional is run from the command line.

Tip: You can use the Hide command to close the Run window when you do not need to watch a script run, and insert a Show command to reveal the Run window for the parts of the Run that you want to see.

Parameters: None.

Example:

Show RunWindow

Example:

Hide RunWindow

Hide RemoteWindow, Show RemoteWindow Commands

Behavior: Hides and shows the Viewer window. (The Viewer window does not need to be visible while a script is running.)

Note: This command has no effect when Eggplant Functional is run from the command line.

Tip: You can use the Hide command to close the Viewer window when you do not need to watch a script run against that SUT, and insert a Show command to reveal the Viewer window for the parts of the execution that you want to see.

Parameters: None.

Example:

Show RemoteWindow

Example:

Hide RemoteWindow

RunningFromCommandLine Function

Behavior: Returns yes if the script run was started by a command line call; returns no if the script is being run through the GUI interface.

Parameters: None.

Example:

Log "Running from command line?:"&&RunningFromCommandLine()//Concatenates a string and the return from RunningFromCommandLine() and logs it

Example:

params DebuggingMode //You would pass in true or false for this parameter

if RunningFromCommandLine() and DebuggingMode then//Checks for both RunningFromCommandLine and DebuggingMode to equal "true"

TraceScreen On //Turns on TraceScreen; used for debugging

set the ImageUpdate to "Auto" //Sets the ImageUpdate global property to Auto; allows automatic caching of image/OCR updates if there is a matching diagnostic for ImageNotFound

SetOption ValidateImagefound, true //When ImageFound returns false, it can trigger ImageUpdate (default=false)

end if

Example:

put ["ManchesterCity","CrystalPalace","LeicesterCity","SwanseaCity"] into teamList //Stores a list of football teams in a variable called teamList

if not RunningFromCommandLine() then

//The answer command provides a dialog for someone to manually select the team input for the script. The answer command is only effective when using the eggPlant GUI

answer "Which Premier League Football team would you like to target?" from list teamList//This code will only run if RunningFromCommandLine returns "false"

put it into team

else

put any item of teamList into team //If RunningFromCommandLine returns "true", the team will be selected randomly from teamList

end if

TypeText team

Example:

//This code slows down the operation of eggPlant only when running scripts from the GUI, for the purpose of demoing the scripts to others

if RunningFromCommandLine() is false

set the MouseMoveSpeed to 6 //Adjusting the MouseMoveSpeed causes the mouse cursor on the SUT to move smoothly between locations instead of jumping between them (default=0)

set the NextKeyDelay to .08

set the RemoteWorkInterval to 2.2

end if

HighlightRectangle Command

Behavior: Highlights the given rectangle in the Viewer window in red. If a duration is specified, the highlight will disappear after the specified amount of time. Specifying the duration has no effect when running HighlightRectangle as a selection or in the Ad Hoc Do Box.

Parameters: One rectangle value. Additionally, an optional duration value.

Example:

HighlightRectangle[FoundImageLocation(), FoundImageLocation() + [50,10]]

Example:

HighlightRectangle[ImageLocation("AnchorUpperLeft"), ImageLocation("AnchorLowerRight"), {duration:10 seconds}] //Defines the rectangle based on the ImageLocation() of two images

Related:

OpenSuite and CloseSuite Commands (Deprecated)

Note: These commands are deprecated. Use InitialSuites and FinalSuites for new script development. Changing the InitialSuites global property to access a suite is almost always preferable to using the OpenSuite command. Suites that you open with the InitialSuites are always the first suites checked for image and script resources, and they are checked in the order in which they are passed. Suites that you open with the OpenSuite command are checked after the active suite, and the order in which OpenSuites are checked is unpredictable.

 

This topic was last updated on August 19, 2021, at 03:30:51 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant