4

I run a Mac Pro using parallels to run numerous virtual machines. I am using the following script to get the URL from the active Tab of active window of Firefox.

(1) tell application "Firefox" to set theURL to «class curl» of window 1 (For Firefox < 3.6)

(2) tell application "Firefox"to activate tell application "System Events" keystroke "l" using {command down} keystroke "c" using {command down} end tell delay 0.5 the clipboard(For Firefox >= 3.6)

But, these applescripts tries to open Firefox in one of the virtual machines and ignores the open Mac-native Firefox. What can be done about this?

Thanks in advance. Regards, Deepa

spd
  • 2,114
  • 1
  • 29
  • 54

1 Answers1

4

You probably have Shared Guest Applications enabled (Share Windows applications with Mac OS option in Vm configuration). So, Parallels Desktop creates stubs in your ~/Application folder for guest applications. For example, you will find Firefox.app there that is linked with Firefox inside guest.

Your options are:

  • Disable Shared Guest Applications for your Vm
  • Be more specific in your AppleScript to identify application not only by its name

For example, you can identify application as (https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_classes.html#//apple_ref/doc/uid/TP40000983-CH1g-SW2):

  • application id "ttxt"
  • application id "com.apple.TextEdit"
  • application "/Applications/TextEdit.app"
Cœur
  • 37,241
  • 25
  • 195
  • 267
wonder.mice
  • 7,227
  • 3
  • 36
  • 39
  • Thank you for the response. I will try out and post the result here. – spd Feb 11 '11 at 06:10
  • The problem whith identifying an application via its application id is afaics that what you get then is just a generic application object, which won't "understand" commands specific to the application at hand (correct me if I'm wrong). So, disabling Shared Guest Applications seems the only way, which might of course also not always be desirable. – Maximilian Tyrtania Sep 15 '14 at 09:36