adding dictionary to applescript application

Hello,

I want to add possibility to use my application in another scripts. E.g. to to write in some other script

tell application "MyMacApp" to dosomeproc(2)

(2 - some integer, id of internal app procedure)

My application is compiled under Xcode and it’s written on applescript.

Regarding to manuals & Google I’ve tried to

  1. add
on domesomeproc ...

in my “MyMacApp.applescript”
2) add MyMacApp.sdef file (modified by Sdef Editor, but all parameters were not speciefied as I don’t know what to write)

But nothing works.
Could somebody tell or show example what I should do to handle such calls?

Thanks guys!

WBR, Alex

See page 472 of Neuberg’s Applescript: The Definitive Guide (2nd ed.) book for help. Looks complex. Obj-c code to deal with too.
Fantastic book on Ascript, everyone should have it.

2 SuperMacGuy: Thank you very much. But they are saying:

But GUI scripting may be disabled by administrator.:frowning:

You can’t so this. What you need to do is add the applescript file to your current project, then use the ‘load script’ command to load that applescript in your project… then you can call that subroutine like this…

set scriptLibrary to load script POSIX file (get path for script "theScript" extension "scpt")
dosomeproc(2) of scriptLibrary

Hm, so there is no chance to sync app’s dictionary (in sdef) with AppleScript?
So I should rewrite some parts in C, because they could implement dictionary. :frowning:

Of course not, in Obj-C terminology the sdef part is like the declaration of the dictionary,
but you have to write the definition, too

Thanks guys!

I’ll be looking for another method to run some proc in AppleScript from extrenal app.