Applescript: Tell by Variable dilemma

Posted by Johnny Grass on Stack Overflow See other posts from Stack Overflow or by Johnny Grass
Published on 2011-01-05T21:23:56Z Indexed on 2011/01/06 5:53 UTC
Read the original article Hit count: 196

I would like to do this:

tell application "Finder" to set appName to (application file id "com.google.Chrome") as text
using terms from application appName
    tell application appName to get URL of active tab of first window
end using terms from

This doesn't work because "using terms from" requires an application name as a string constant. If i substitute this line:

using terms from application appName

with this one

using terms from application "Google Chrome"

it works. However I don't want to rely on the target machine having the application named "Google Chrome". Using the bundle identifiers seems safer. Is there a better way to do this?

© Stack Overflow or respective owner

Related posts about applescript

Related posts about applescript-objc