RE: Snow Leopard osax security and 'run script' with parameters
RE: Snow Leopard osax security and 'run script' with parameters
- Subject: RE: Snow Leopard osax security and 'run script' with parameters
- From: Scott Babcock <email@hidden>
- Date: Sun, 10 Jan 2010 21:13:54 +0000
- Thread-topic: Snow Leopard osax security and 'run script' with parameters
For me, the only reason I need this sort of trick is to work around the fact that AppleScript doesn't allow you to access record properties by their names. If you receive an arbitrary record, the only way that I know of to pull it apart is to convert it to a string to get the property names (thru a different sort of trickery) and assemble script objects on the fly to obtain the values.
-----Original Message-----
Date: Sat, 9 Jan 2010 14:01:40 +0000
From: has <email@hidden>
Subject: Re: Snow Leopard osax security and 'run script' with
parameters
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=us-ascii
Stockly, Ed wrote:
>> To be fair, there are a few situations where dynamic code generation in AS
>> _is_ the best (or only) way to go.
>
> Many of the do shell script solutions ...
Many 'do shell script' solutions involve dynamic code generation, yes. As soon as you build up the shell script string by concatenating it with paths strings, etc, you have to consider what could happen if the shell script is wrongly formed. That's why it is so very important to sanitise all of your inputs (hint: 'quoted form of some_text' is your friend); forget, and anything could happen from an unexpected error to a hosed system when that script runs.
> ... and solutions using script objects posted on this list are, technically, examples of dynamic code generation.
No, not unless you're fabbing the source code for those objects on the fly, whether using 'run script "script ... end script"' as shown earlier, or using the command-line 'osacompile' tool, or even by scripting Script Editor itself. Once again, the same serious warnings about sanitising your inputs apply.
Using script objects as libraries or in object-oriented programming does not constitute dynamic code generation, however, so just the usual concerns about running any piece of pre-written code apply there.
Regards,
has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net
------------------------------
_______________________________________________
AppleScript-Users mailing list
email@hidden
http://lists.apple.com/mailman/listinfo/applescript-users
End of AppleScript-Users Digest, Vol 7, Issue 18
************************************************
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden