Compiling Error

I’m trying to program an app in Applescript Studio. However, it is refusing to compile, giving an “Expected end of line but found identifier” error. I’m trying to make my app send a keystroke which would enable black-on-white mode in OS X. Any idea how to make it work? line in question is in bold.

on clicked theObject
if name of theObject is “settings” then
if panelWIndow is equal to missing value then
set panelWIndow to window “settingspanel”
end if
else if name of theObject is “lightSwitch” then
keystroke “8” command option control down
end if

--Pop open the panel as a drop-down panel.
display panel panelWIndow attached to window "main"

end clicked

You’re using the wrong syntax with the keystroke command:

keystroke "8" with {command down, option down, control down}

Doesn’t work. Get error iDash.applescript:19: Expected “into”, variable name, class name, other parameter name or property but found “{”. (-2741)

Oh, crivens!
Sorry about that.
For “with” read “using”

using

else if name of theObject is "lightSwitch" then
		keystroke "8" using {command down, option down, control down}
	end if

it gives me an “expected end of line but found identifier” error again.

hmmm, still can’t get it to work, tried parentesis in place of the brackets, nothings working. Any ideas?

“keystroke” is a keyword in System Events’ dictionary. So, adding → tell app “System Events” to blah ← will be very useful :wink: Also make sure “Enable access for asistive devices” is checked in your Universal Access > Seeing preference pane.
I think you could also use “CGPostKeyboardEvent” from a “call method”, but I can’t help you with this cocoa thing :cry:

I see three ifs and only two end ifs, I think.