RSScriptRunner, represents a currently running script that was triggered by FastScripts.app. (FastScripts does not assign unique process titles to scripts that it triggers.)
If one has multiple processes titled
RSScriptRunner running simultaneously, then the following code:
tell application "System Events" to windows of process "RSScriptRunner"
will only return the window name of the process that began the earliest.
However, I would like to get every window name of every
Does anyone know how to accomplish this in AppleScript?
My ultimate intent here is to implement a check that ensures that only one instance of one script can run simultaneously. Multiple different scripts running is okay, but multiples of a script running at the same time is undesirable.
The code would look something like this:
tell application "System Events" set theWindowList to windows of process "RSScriptRunner" if theWindowList contains "The title of the initial dialog of this script goes here." then error number -128 end if end tell
This check would be located at the very top of the script.
This is very much a situation where minimal latency is crucial.
I had devised a long-winded method that successfully realized my desired outcome. The method entailed getting every current process title into one list, and getting every current process ID into another, corresponding list. I then retrieved the window name of each
RSScriptRunner process via its respective process ID (which, unlike the process name, must be unique).
However, this method brought with it a couple seconds of latency. I need a solution that is nearly instant (such as, the line of code above).