In some circumstances, it may be necessary for a script cue to be able to reference itself, or in other words find its own ID for use in the script itself. There is not currently an in built property to 'get' from the cue for this purposes within the AppleScript dictionary, however:
"At the time of execution a script cue is the last item of active cues as list, as long as run in separate process is not checked."
- Mic Pool
An example of this in action is:
set ActiveCues to (active cues as list)
set ThisCue to the uniqueID of the last item of ActiveCues
Broken down, this script will:
- Get the active cues running in the current workspace (of which this Script Cue will be one). The value returned will be a list.
- Set the variable "ThisCue" to the last item of the list. This is important as there may be other cues currently running, but the Script Cue will always be the last one to have started (hence the last in the list).
The example above gets the uniqueID of the cue. You could alternatively get another property, such as "q name" or "q number", but these values may not be present, or may not (in the case of the "q name" be unique). Therefore the uniqueID is a safer property to use.
Credit for this method goes to Rich Walsh.