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

Discussion in 'Mac Programming' started by bobisoft2k5, Aug 4, 2009.

  1. bobisoft2k5 macrumors newbie

    Joined:
    Aug 4, 2009
    #1
    Here's what will run:

    Code:
    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
    		
    		
    		[B]tell application "GrowlHelperApp" of machine "eppc://user:pass@address"[/B]
    			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!
     
  2. mysterytramp macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #2
    [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
     
  3. hhas macrumors regular

    Joined:
    Oct 15, 2007
    #3
    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.
     
  4. bobisoft2k5 thread starter macrumors newbie

    Joined:
    Aug 4, 2009
    #4
    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!
     
  5. mysterytramp macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #5
    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
     

Share This Page