Syntax Error - help please! :(

Discussion in 'Mac Programming' started by Brradley, May 7, 2013.

  1. macrumors member

    Joined:
    Jun 21, 2010
    #1
    I found this applescript online that should remove finder from the dock on startup if I save it as an application and add it to login items. I go to save it and it says "Expected expression, property or key form, etc. but found unknown token." Can anyone help please? Thank you!

    Code:
    on run {input, parameters}
     
    tell application “System Events” to tell UI element “Finder” of list 1 of process “Dock”
    perform action “AXShowMenu”
    click menu item “Remove from Dock” of menu 1
    end tell
     
    return input
    end run
     
  2. macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    Try this :

    Code:
    on run {input, parameters}
    	
    	tell application "System Events" to tell UI element "Finder" of list 1 of process "Dock"
    		perform action "AXShowMenu"
    		click menu item "Remove from Dock" of menu 1
    	end tell
    	
    	return input
    end run
     
  3. thread starter macrumors member

    Joined:
    Jun 21, 2010
    #3
    Thanks for your help but I get this error message with your code? :(
     

    Attached Files:

  4. macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #4
    You can save this in Automator as an application with a Run Applescript action.
    In Applescript Editor as an application by removing the {input, parameters} part in the on run handler.

    Code:
    on run
    	tell application "System Events" to tell UI element "Finder" of list 1 of process "Dock"
    		perform action "AXShowMenu"
    		click menu item "Remove from Dock" of menu 1
    	end tell
    end run
     

Share This Page