Block Resource

Verb: waitLock

Available from: <Standard>

Block access to a resource by creating a queue so that access to the same resource is always allowed at the end of the previous access.

Syntax

waitLock --global(Boolean) --name(String) [--timeout(TimeSpan)] (Boolean)=success

Inputs

Script Designer Required AcceptedTypes Description
--global Global Required Boolean If enabled, the lock named and created in the Name parameter can be used in script executions of all machines using the same Web Client. If not enabled, locking can be used only in script executions on the same operating machine.
Running two scripts on the same machine simultaneously requires different executables from IBM Robotic Process Automation Studio.
--name Name Required Text Name given to the lock that should be used in execution.
--timeout Timeout Optional Time Span, Number, Text Maximum wait time until the expected lock execution completes.
If a time is not specified, the default time of 5 seconds is expected to end execution.

Outputs

Script Designer AcceptedTypes Description
success Success Boolean Returns "True" if it was possible to enter the expected lock, or "False" otherwise.

Example

The Block Resource command blocks access to the first resource, and then the Unlock Feature command unlocks access to the same resource after inserting an instruction block. Within this block there is an insertion of the Block Resource and Unlock Feature commands in the same context, which will not be executed, which is seen as the first feature has not yet been unlocked.

defVar --name successfullyEnteringLock --type Boolean
defVar --name maximumTime --type TimeSpan --value "00:00:15" --parameter
defVar --name counter --type Numeric
waitLock --global --name LogMessageLock --timeout ${maximumTime} successfullyEnteringLock=success
logMessage --message "Executing LogMessageLock." --type "Info"
logMessage --message "Success Entering Lock for the First Time: = ${successfullyEnteringLock}" --type "Info"
// Will try to access the "LockMessage" feature again before its completion by "release". In this case it will not be possible as the first access has not yet been terminated.
waitLock --global --name LogMessageLock --timeout ${maximumTime} successfullyEnteringLock=success
logMessage --message "Feature access again\"LogMessageLock\"." --type "Info"
release
logMessage --message "Success Entering Lockout a Second Time: = ${successfullyEnteringLock}" --type "Info"
release

Remarks

A lock initiated by the Block Resource command or the Block Semaphore command is terminated by the Unlock Feature command.

See Also

  • Block Semaphore
  • Unlock Feature