Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old May 7, 2013, 03:00 PM   #1
Brradley
macrumors member
 
Join Date: Jun 2010
Syntax Error - help please! :(

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
Brradley is offline   0 Reply With Quote
Old May 7, 2013, 03:59 PM   #2
kryten2
macrumors 6502a
 
Join Date: Mar 2012
Location: Belgium
Quote:
Originally Posted by Brradley View Post
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
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
__________________
Space Corps Directive 34124
kryten2 is offline   0 Reply With Quote
Old May 7, 2013, 04:02 PM   #3
Brradley
Thread Starter
macrumors member
 
Join Date: Jun 2010
Thanks for your help but I get this error message with your code?
Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2013-05-07 at 22.01.23.png
Views:	13
Size:	41.5 KB
ID:	411274  
Brradley is offline   0 Reply With Quote
Old May 7, 2013, 04:52 PM   #4
kryten2
macrumors 6502a
 
Join Date: Mar 2012
Location: Belgium
Quote:
Originally Posted by Brradley View Post
Thanks for your help but I get this error message with your code? :(
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
__________________
Space Corps Directive 34124
kryten2 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Incorrect Syntax? allenschroeder OS X Mavericks (10.9) 2 Mar 4, 2014 11:40 PM
I have an encoding syntax error that crashes an app with with NSString hanuman99 iPhone/iPad Programming 4 Feb 3, 2013 11:47 AM
grep syntax help Big Dave Mac Programming 4 Jan 24, 2013 08:54 AM
WebDAV Apache2 Syntax Error iBlink Mac OS X Server, Xserve, and Networking 0 Jan 23, 2013 12:43 AM
Syntax Coloring Gone. . . ahan.tm iPhone/iPad Programming 9 Dec 4, 2012 03:44 AM

Forum Jump

All times are GMT -5. The time now is 12:43 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC