spd
spd

Reputation: 2134

Virtual machine browser is considered by the applescript if parallels are installed in MacPro

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

Upvotes: 4

Views: 1918

Answers (1)

wonder.mice
wonder.mice

Reputation: 7563

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"

Upvotes: 4

Related Questions