unload scripting additions

Is there a way in Applescript to unload scripting additions?


I've recently discovered that various users have scripting additions that cause conflicts with the data collection script I am writing. I can't find anywhere online on how to unload or at least ignore scripting additions since my script does not use them.


TIA!

Andrew

MacPro 2x2.66GHz Dual Core Xeon, 4GB RAM,, Mac OS X (10.6.4)

Posted on May 27, 2011 10:24 AM

Reply
6 replies

May 27, 2011 10:46 AM in response to Andrew Caldwell

Generally, Scripting Additions extend AppleScript's dictionary and are automatically loaded whenever a relevant command is executed.


The only way to absolutely prevent this is to remove the scripting addition file(s) from /Library/ScriptingAdditions or ~/Library/ScriptingAdditions but that's clearly not an option if you're planning to distribute your script to other users - you cannot arbitrarily remove Scripting Additions from their machines since you don't know when/if they're needed.


Furthermore, there's no direct way to prevent a Scripting Addition from being used, other than very carefully targeting your commands. For example the call chain that AppleScript uses when looking for a command should be <current tell target>, <default target>, <scripting addition> so if you have a Scripting Addition-based command that conflicts with another, you may be able to circumvent that by telling another application to execute the command, e.g. 'tell application "System Events" to blahblahblah'.


Finally, if the code is yours, then you might need to consider changing some of your handler names/classes so they don't conflict. A poor solution in many ways, but one that's inherent in AppleScript's loose syntax model.

May 27, 2011 10:46 AM in response to Andrew Caldwell

First off, what scripting additions are you talking about, and what is the conflict? It's unusual to find significant conflicts of this sort if the osaxen are relatively well designed, and the only real way to prevent osaxen from loading is to remove them from the ScriptingAdditions folders and quit whatever apps/scripts might be relying on them. however, that will break any scripts that your users might have made with those osaxen and cause a whole lot of consternation/confusion, which will eventually lead them to reinstall whatever osax you removed and break your script.


it's better to just find the problem and fix it in your script (which is usually straight-forward) than go the other route.

May 27, 2011 12:16 PM in response to twtwtw

Well for starters everyone gets the "Adobe Unit Types.osax" addition in /Library/ScriptingAdditions. If it's not the 64-bit version it's no biggie since it does not cause the script to actually fail (I've updated our core image to include the 64-bit version). And anyone with Quark installed gets QXPScriptingAdditions.osax.


The problem here is that while my script doesn't use any scripting additions, I am running it through Casper Remote to a target computer. Casper Remote takes any installed osaxen into account, and complains, loudly at that, if they aren't compatible (lately it's been the not 64-bitness of the additions).


Since I'm not sure if anyone is using either of these additions, I'm hesitant to take a sledgehammer to it and issue a directive to remove them from our entire organization.


I guess it's not a huge deal if I can't get rid of them or ignore any osaxen. It's just a pita to see the red failure text in Casper Remote.

May 27, 2011 12:42 PM in response to Andrew Caldwell

for the Adobe Unit Types osax, you might want to read this solutions page. It may give you some ideas for how to deal with the problem. The osax is needed for anyone who applescripts Adobe products (basically it's a collection of custom types that adobe products use, without any actual commands). The osax usually throws warnings rather than errors (because it's just a badly designed osax, I think - Go Adobe!), but I do know how annoying that is. I cringe every time I open console.app and see the long list of complaints recorded there by applescript.


the QXPScriptingAdditions.osax problem (from what I see on the web) may be due to an outdated version of the osax, where it isn't compiled for intel machines. Those osaxen would be at least partially non-functional anyway - they might function for setting up types, like the Adobe osax, but the commands wouldn't work - so you probably wouldn't run into any problems deleting them remotely, since it's unlikely anyone is scripting it. check the version of the osax and the quark app to be sure, and maybe send particular users a note that their version of Quark is out of date and they ought to upgrade. you could try upgrading the osax remotely, but some osaxen are app dependent, and might not play well with older versions of the software.

May 27, 2011 12:58 PM in response to twtwtw

I updated to the a2.1.0 osax for Adobe and shut it up (SOOOOO annoying in the console, always cluttering up my view). I've just removed the QXP additions for any new installs. I searched and searched earlier for an updated version and couldn't find anything, so I guess I'll just train my techs to review the logs if Casper says it failed....



Grrr


Thanks again though twtwtw!

May 27, 2011 1:09 PM in response to Andrew Caldwell

well, just as a suggestion, you could download a trial version of the latest version of QXP, extract the osax, then toss the trial version out. Osaxen generally don't have any trial limitations built into them (who would bother?), though as I said there may be version dependencies. best thing would be to email QXP support and ask their advice. glad I could help somewhat, though. 🙂

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

unload scripting additions

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.