Making a dictonary for applescript programs

Hey guys, is it possible to make a dictonary file for my AppleScript program, i would like it so i dont have to use keystrokes to control the program with programs like salling clicker and AppleRemote

Adding “scriptability”, not only a “dictionary” to an ASS-Studio app is a huge amount of work (if you don’t know how). The best option is allways using some tricks to use built-in’s Studio dictionary. For example, a hidden button which you can invoke as “tell button blah to perform action”.

Any guides on that secret button concept? or the long way of making it scriptable

I’m thinking in an app I’ve made. It’s supposed to send emails. You could drive it as (follows pseudo-code):

tell window "email"
	set contents of text field "to recipients" to ""
	set contents of text field "subject" to "This is the subject"
	set contents of text view 1 of scroll view "email body" to "This is the body"
	tell button "send now" to perform action
end tell

This would be similar to bringing the app to the foreground, then typing via keystrokes the related info, then clicking the “send” button. But this code used the built-in Studio dictionary, thus making this app a real scriptable application :wink:
So, depending on your app’s interface, you could do something similar (using invisible buttons, if needed, or whatever you wish).

That may be beyond the scope of this forum.

See also:
Cocoa Scripting Guide
applescript-implementors Mailing List Archive
Adding AppleScript Support to Cocoa Apps

hey, ive tried adding in a hidden button thats tied into the program and its in the window “settings” but this script doesnt work

tell application “MultiAlarm”

tell window "settings"
	tell button "DISARM" to perform action
end tell

end tell

i get the error

MultiAlarm got an error: NSReceiverEvaluationScriptError: 4

Does it work if you don’t setup it as a “hidden” button? If so, you can, at run time, set its position to {-5000, -5000} (for example), or just “hide” it manually (instead of using the “hidden” property in the inspector) moving it out of the window’s bounds…

ive tried it without hidden enabled and i can then click on it and it works but the script doesnt

Such error usually means that the referenced object doesn’t exist. So, double-check window and button’s names, make sure the button isn’t inside some kind of box, view, etc.

Does this work from the Script Editor?

tell app "MultiAlarm" to get title of button "DISARM" of window "settings"

i get the same error when i do that :S

Then, you should double-check window and button’s names, make sure the button isn’t inside some kind of box, view, etc.
If you need help, you can upload your project somewhere and drop a link here…

Hey thanks for your help i will upload the source code to my site

Apparently, the button is called “KILLALARM”. You must target its “AppleScript Name” (as setup in the AppleScript tab of the Inspector, “Cmd + 8”), not its “title” (“DISARM”).

Thanks works now, i hate these little bugs when making programs last time i had one tick box ticked and it killed the whole thing

Yes, that’s why I hate UIs :frowning: