apple script does not run on SUT

My SUT and eggplant are on the same mac, but use differen user accounts.
I write an applescript in my script:
do applescript {{
tell application “Finder”
make new finder window to (path of documents folder)
end tell

When I run this, it always open the finder on my eggplant user windows, not SUT.
Why does this happen? Any help is appreciated.

So you just need to be sure to target your Applescript to the correct machine, something like:

do applescript {{
	tell application "finder" of machine "SUT machine" to open application "iTunes" 

my SUT and eggplant are the same mac,
how can I describ “SUT machine”? They are under different users?
just as “diana’s SUT”?
diana is my eggplant account, QA is SUT account.

Unfortunately – I’m not finding a way to target AppleEvents to an off-screen user. I’ll continue to dig around.

From Apple Documentation on Fast User Switching:

  AppleEvents have been enhanced to support Fast User Switching. Because of these changes it is now possible to send AppleEvents to applications running in any session, when the uid of the processes match. 'root', or uid 0 processes are allowed to send to any process in any session. Non-root processes can only target applications that match their uid.

 To support remote AppleEvents in the multiple user scenarios, the typeApplicationURL definition has been enhanced with optional uid and pid parameters. Both uid and pid are optional. If not present, the active console user's applications will be targeted. As before, the username should be that of an admin user on the targeted machine.


ex: eppc://zellers:email@hidden/Finder?uid=501&pid=315

So it looks like you need the UID and possibly the PID of the target application.