Scripting additions problem

Hello world, long time reader but first post for me here !!! Thanks everyone for the great community.

I’m learning ASOC coming from an AS background using Shane’s excellent book. So far have been lucky in my tests with Obj C and C methods (3rd party SDK integrated in an ASOC app) but I ran today into my first main problem…

If my app.delegate app uses any scripting addition command it compiles properly (if I make a syntax error or remove the addition from user, lib or system scripting additions folder it refuses to build my app so I guess the sdef is read OK) but once I run the app it reports an error -1708 saying the script does not understand the <> command.

I tried moving the lib into the app, to all 3 locations and getting same problem, tried different osaxs (XMLlib, Phidgets even some standart additions like read file)… same… Maybe it is something wrong on my build settings or my particular system but the only way I could make it work was to write a regular applescript, save and import it into the Support files, then find it using NsBundle in my main script and use 'run script" command to execute it. It could then run without the error…

Any idea if this should work differently and if so how ???

Thanks for any tips !

Mikael

Welcome! What happens if you precede the call to the addition commands by “tell current application to”?

Thanks Shane. Sadly I already tried that with no success…
Can you confirm it should normally work without any special build setting ?

I am travelling now and will have to try on a second machine when I’m back as I cannot inderstand why it will compile but not work…

Btw I’m using xcode 4.32 on latest Lion release.

Yep. You’ll see there’s reference in my book to problems with the “read” command. And “beep” also fails in 10.7. I don’t know of any other problems, although I haven’t tried many others.

OK I tried again with several standard additions and yes it does work normally (like with choose folder etc) so I guess the problem is more with the particular asox I was using or my system config…
I just got in touch with XMLLib authors and will let you know here when I have any definitive answer on that…

Thanks

Mikael

I installed the latest beta version of XMLLib and now everything is working as it should… also added ‘tell current application’ around all my scripting addition calls as it seems to help also a lot (but doesn’t seem required by all of them… not sure why)

thanks Shane for the help and I can now wait a bit more before diving into NSXMLDocument… any project to make an extra chapter on this one day for a revision of your great book ?

Best

Mikael

NSXMLDocument and friends aren’t hard to use. They’re just hard to explain unless the person reading understands XML.