I’m trying to convert an ASS application composed of multiple script files to ASOC.
Since ASS was used essentially to give an interface to a set of scripts that dial with Indesign end other applications to do their job, I’ve kept this structure with the main script that do all the interface and keeps common variables and the other scripts wired in IB with the main and some buttons on the interface.
Unfortunately there is no Debug in ASOC, so my idea was to have a script saved from the main with all common variables e eventually mockup of required main’s handlers then open scripts to test in Script Editor, load this script as my main outlet end do testing there.
In doing this found two problems:
trying to use “store script” command in ASOC compiles correctly but gives a run time error like “can’t covert <> into script”
Is this standard addition command forbidden or does it requires special syntax?
All my script files where created in xcode default encoding that is UTF-8, but Script Editor don’t read correctly UTF-8 files, so I used xcode editor to convert script files to Unicode just to discover that all my outlets and actions where dimmed in Interface Builder and no longer available.
Is this a bug or should I do some other setting so that IB considers all those
“property bla:missing value” as IBoutlets and
“on someFunc_(sender)” as actions?
Model: Macbook pro
Browser: Safari 533.19.4
Operating System: Mac OS X (10.6)
I’ll repeat what I posted to this on the Apple list:
It doesn’t work, and I can’t see any way to make it work. If you use load script and ask for the resulting script’s class, it says <<NSAppleEventDescriptor: ‘scpt’>. Unfortunately there doesn’t seem to be a coercion to AS script object available. (A general coercion command that coerced NSAppleEventDescriptors to AS objects would be a wonderful thing…)
I suggest leaving them as UTF-8. The problem is that AppleScript Editor doesn’t recognise UTF-8 files without a BOM. The solutions are:
Use a script editor that does recognise them. Script Debugger does, Smile probably does, and AppleScriptObjC Explorer does.
Open them in a word processor that recognises them, and copy the content to ASE. You could probably write a script to do it via BBEdit/TextWrangler. This assumes Xcode will handle the file OK with a BOM – give it a try and let us know if it worked.
FWIW, AppleScriptObjC Explorer might give you good enough logging so that you don’t have to keep your InDesign and ASObjC scripting completely separate.
Anyway, I suggest you log both issues as bugs.
(Disclaimer: I wrote AppleScriptObjC Explorer, so expect bias.)
I can leave without the store script but I will do a bit more investigation to see if I can override this block.
As for the second point, Unicode encoding versus UTF-8 encoding, I understood that the problem with ASE is that it does not support UTF-8 no BOM format (the default of xcode editor), so I tried to open my script files with TextWrangler and changed encoding from UTF-8 no BOM to UTF-8, this is supported in xcode and IB and also ASE is happy with it.
I know there are others editors for script file but I found annoying tho have this incompatibility within two apple tools.