Runtime/Global variables?

Hi all,

is there a chance to getting some information about the current run?


  1. IP of the (current) SUT
  2. “Run Script” or “Run Selection” phase
  3. Current Result Script folder


  1. IP of the (current) SUT

ConnectionInfo function, page 188 of Eggplant Reference.

  1. “Run Script” or “Run Selection” phase

There currently isn’t any way to distinguish a “Run Script” vs a “Run Selection”

  1. Current Result Script folder

ScriptResults function, page 181 of Eggplant Reference.


How realize the function ‘CaptureScreen()’ this issue?
If I run in “Run selection” mode, all screenshots will be generated in the document directory - otherwise (Run Script) under the results directory for the current script run.


If you specify a path:

CaptureScreen (name:“path/to/file”)

…the captured image should always be saved under the specified directory.

Yes this is clear. I will capture images in the results directory for the current script run and this directory is only present in “Run Script” mode. On errors I capture always the screen but if I debug the script - I don’t need this images.

The ‘CaptureScreen()’ have a mechanism to save files in “Run selection” mode into the document directory and in “Run Script” mode into the result directory.
This mechanism (or similar) I need to capture screens only if I in “Run Script” mode.

Ok, maybe isn’t any way …

Currently, there isn’t any way to turn the CaptureScreen function off during debugging. The only options that you have are to comment the CaptureScreen commands from your script during debugging or to delete the files yourself when they are created.

The ScriptResults function can be used to figure out whether you are running a script or a selection. When you run a full script, the last item returned by that function shows the status of the current run. When you run a selection, no results are generated, so the last item of the ScriptResults is the result of the previous complete run.

Here’s a function that can be used to determine which way your script is running:

put runMode()

function runMode
	set currentResults to the last item of the scriptResults
	if Status of currentResults is "Running" then
		return "Run Script"
		return "Run Selection"
	end if
end runMode

Thanks, this function works fine for me.