Here is the dilemma, I have scripts that access a plist file that contains certain data for server names, folder names and applications. I have no problems accessing the above and all of the variables work with one exception. Applications. And they work to a small extent. See examples:
Working:
set theAddress to “none@none.com”
set theSubject to “test email”
set theBody to “Job Manager has been updated.”
tell application “Microsoft Entourage”
activate
set to make new outgoing message with properties {address:theAddress, subject:theSubject, content:theBody}
send newMessage
end tell
Also Working: (using variable, will activate Microsoft Entourage)
set prefFileName to “JobManager”
set ScriptRead to "defaults read " & prefFileName & " " & “Email” as string
set EmailApp to do shell script ScriptRead
set EmailApp to application EmailApp
set theAddress to “none@none.com”
set theSubject to “test email”
set theBody to “Job Manager has been updated.”
tell EmailApp
activate
end tell
NOT WORKING: (Syntax Error: Selects “message”, Expected end of line, but found identifier"
set prefFileName to “JobManager”
set ScriptRead to "defaults read " & prefFileName & " " & “Email” as string
set EmailApp to do shell script ScriptRead
set EmailApp to application EmailApp
set theAddress to “none@none.com”
set theSubject to “test email”
set theBody to “Job Manager has been updated.”
tell EmailApp
activate
set to make new outgoing message with properties {address:theAddress, subject:theSubject, content:theBody}
send newMessage
end tell
Thanks for any help…
Since you are using a variable for an application tell block, it doesn’t know what that command from the application means, so AppleScript starts complaining. Just skip the variables and write “tell application “JobManager” to…”
EDIT: Why it worked that first time, it was because AppleScript always knows what “activate” means.
Thanks Dylan,
A couple of additional notes: there’s a reason for the variables. First, users are connecting to the same network shares, but out of our control OS X designates some the shares with numbers. Example: Most users connect to a share with a name of “Server”. On some systems the same share connects as “Server-1”, or even “-2” and “-3”. This is what started the need for variables. Second, the scripts we are running are imbedded into FileMaker Scripts that are automating actions in with data from FileMaker and passing actions and information to Servers, Finder, InDesign, PhotoShop and Illustrator. With that said, we now have users on 10.4, 10.5 & 10.6 and they are will be using CS3 and CS5 apps. (Depending on the system.)
Traditionally AppleScript can adapt simple changes to Application Versioning. In other words it recognizes CS5 as CS3’s predecessor. But with the scripts embedded, it doesn’t. I understand/knew that AppleScript understands the “Activate” and it isn’t part of the email client’s dictionary. My goal is to see if I can get it to do that. In the end, create scripts that are fully functional and can be easily updated through a simple update of a user’s preference file. I’ve lost count of the number AppleScripts and FileMaker Scripts working together, but when printed it takes over 180 full pages of code.
I hope this helps better explain my needs and what my goal is. Thanks again for your help and any other input you may have.