PDA

View Full Version : AppleScript Error: Expected end of line, etc. but found “"”.




bobisoft2k5
Aug 4, 2009, 02:42 PM
Here's what will run:

set beth to "eppc://user:pass@address"
set brian to "eppc://user:pass@address"
set molly to "eppc://user:pass@address"
set sarah to "eppc://user:pass@address"



set theList to choose from list {"brian", "beth", "molly", "sarah"} with title "Messaging Service" with multiple selections allowed
repeat with i in theList
if (i as text) is equal to "brian" then
set machine_chosen to brian
set user to (i as text)
else if (i as text) is equal to "beth" then
set machine_chosen to beth
set user to (i as text)
else if (i as text) is equal to "molly" then
set machine_chosen to molly
set user to (i as text)
else if (i as text) is equal to "sarah" then
set machine_chosen to sarah
set user to (i as text)
end if
display dialog ("Messaging " & user) default answer "How are you doing" buttons ¬
{"Cancel", "Send"} default button 2
copy the result as list to {text_returned, button_pressed}
try


tell application "GrowlHelperApp" of machine "eppc://user:pass@address"
set the allNotificationsList to {"Test Notification", "Another Test Notification"}


set the enabledNotificationsList to ¬
{"Test Notification"}

register as application ¬
"Growl AppleScript Sample" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "Script Editor"


notify with name ¬
"Test Notification" title ¬
"Test Notification" description ¬
"This is a test AppleScript notification." application name "Growl AppleScript Sample"

notify with name ¬
"Another Test Notification" title ¬
"Another Test Notification :) " description ¬
"Alas — you won't see me until you enable me..." application name "Growl AppleScript Sample"

end tell
tell application "Finder" of machine machine_chosen
activate
do shell script (say text_returned) password "" with administrator privileges
#do shell script (say "They're always in the last place you look, you know.")
end tell
end try
set theList to rest of theList
end repeat

Note the line: tell application "GrowlHelperApp" of machine "eppc://user:pass@address"

I want this to be: tell application "GrowlHelperApp" of machine machine_chosen

But when I do this, I get the error: Expected end of line, etc. but found “"”.

I realize most of this is very kluj'd together and there's a lot I could improve upon, but this is just a little toy I'm making for myself, girlfriend, and two sisters all living in the same house and I JUST CANNOT FIGURE OUT THAT ERROR!

Thanks for your time and patience!



mysterytramp
Aug 4, 2009, 07:07 PM
[I suggested something while I was at work without a Mac. Got home and your sample code seems to work fine for me. Assuming you have their IP addresses, user names and passwords correct, I can't help.]

mt

hhas
Aug 5, 2009, 02:03 PM
Note the line: tell application "GrowlHelperApp" of machine "eppc://user:pass@address"

I want this to be: tell application "GrowlHelperApp" of machine machine_chosen

But when I do this, I get the error: Expected end of line, etc. but found “"”.

Do you have Growl installed on the machine you're compiling on? AppleScript can't fetch terminology from the remote Growl app if the URL isn't available at compile-time.

bobisoft2k5
Aug 5, 2009, 09:11 PM
Yes, I have Growl 1.1.6.

Been thinking about this all day, still no clue what could be going wrong.

Thanks for the responses, though!

mysterytramp
Aug 5, 2009, 11:35 PM
Expected end of line, etc. but found “"”.

Errors like that almost always mean there's something screwy with quote marks.

In the "real" eppc addresses, there's no chance that one of the users has a quote in a password, or there's a typo in the IP address? Or it was entered as double single quotes instead of a single double quote? Or you wrote it in a word processor that converted the normal quotes to curly quotes?

No chance that Remote Apple Events is turned off?

Can you put the tell statement in a try block? You might get a more discursive error message.

mt