GUI Scripting... NSReceiverEvaluationScriptError: 4

Hi,

I’m trying to use the Finder’s new “Create archive” command with the new GUI scripting support through “System Events.” In this case, I’m typing:

tell application "Finder"
	select folder "Hard Drive:Backups"
	activate
	tell application "System Events"
		tell process "Finder"
			tell menu "ContextMenu"
				click menu item "Create Archive of "Backups""
			end tell
		end tell
	end tell
end tell

Every time, I get the same error message in Script Editor:

System Events got an error: NSReceiverEvaluationScriptError: 4

What does this mean? This happens if I use the command in the File menu, too. I realize this could be done with a gzip shell script or something, but the Finder’s archiving is so convenient… at least, it could be.

Thanks for any help you can give!

Jeff

Jeff,

Try this code:

Jon


[This script was automatically tagged for color coded syntax by Script to Markup Code]

Wow! Thanks so much for that–I definitely wouldn’t have figured that out. What does selecting it as alias do?

Jeff

The NSReceiverEvaluationScriptError: 4 error tells you that you are trying to do soemthing that does not exist in the current context…and there are no tools I have found yet to reliably tell what is availble in your current context.