I am writing a script for Outlook. to keep it simple, I have:
tell application "Microsoft Outlook" to activate
If I compile it it jumps automaticlay to:
tell application "Microsoft Entourage" to activate
FYI I have both applications installed. Outlook 2011 and Entourage 2004.
Does anybody know why?
I just tested more and if I remove outlook from the Microsoft 2011 folder it does not happen.
Tom_X
March 4, 2011, 8:48pm
#3
No, I don’t know why but you could go into the bundle and try writing the script like this…
-- ie 1...
activate application "/Applications/Safari.app/Contents/MacOS/Safari"
-- ie 2...
activate application "/Applications/Address Book.app/Contents/MacOS/Address Book"
Tom
Browser: Firefox 3.6.15
Operating System: Mac OS X (10.6)
Thanks Tom, thought about that and is an option. However it is ridicules that it does not hold. must be a problem somewhere.
Tom, this also opens (the part: Contents/MacOS/Safari) a terminal window. What would be the purpose of this, in your thinking, in my case?
Thanks.
There are two other ways you can identify an app.
By path :
tell application "Mac:Applications:Firefox.app" to activate
By ID :
tell application id "org.mozilla.firefox" to activate
Cheers,
Kassym
Thanks Kassym I knew that.
I am still puzzled as to why this happens.
tell application id "Microsoft Outlook" to activate
does not work because Microsoft Outlook is in a folder in the application folder.
If you are using the ID option you cannot directly put the name of the app.
You would need to use :
tell application id "com.microsoft.outlook" to activate
Using the id makes it explicit which app you want to use.
Thanks, did not know you had to prefix it with com. and drop the spaces.
I guess, Microsoft was that lazy and uses the same 4-letter raw identifier for Entourage and Outlook
Interesting idea and a real possibility. However if this was so, if I double click the Entourage DB it not open in Outlook?
The 4-letter raw identifier affects only Apple Events, which are sent by AppleScript
You can’t use that as a general rule. The ID is pretty much the app’s plist file. Look in your ~/Library/Preferences folder and that will be app’s ID minus the “.plist”.
You can run the following to get an app’s id :
id of application "appName"
Firefox → org.mozilla.firefox
Chrome → com.google.Chrome
1Password → ws.agile.1Password
An app’s Id is permanent. The app’s name can be changed, but the ID will stay the same. ID’s will always work.
Hopefully this makes sense now.
Thanks kdorsel that helps!
Outlook and Entourage have the same code, so this explains why it opens one if you open the other.
Still does not explain why when I write a script it autocorrects. or does it?