Snow Leopard osax security and 'run script' with parameters
Snow Leopard osax security and 'run script' with parameters
- Subject: Snow Leopard osax security and 'run script' with parameters
- From: Scott Babcock <email@hidden>
- Date: Wed, 2 Dec 2009 05:52:36 +0000
- Thread-topic: Snow Leopard osax security and 'run script' with parameters
In this new world of tightened scripting addition security, I'm having a bit of a challenge running dynamically assembled script code to which I need to pass parameters. If my parameters are composed entirely of scalar values, everything works as expected. As soon as I introduce an application-specific object reference, however, I get the extremely helpful "Can't make <foo> into the expected type".
It the past, all I had to do to make this work was to execute the 'run script' event in the context of the application that owned the referenced object. With the security lock down of scripting additions in Snow Leopard, this is no longer possible, and I can't find any alternative solution. Here's an extremely contrived example:
tell application "TextEdit"
activate
set docRef to document 1
end tell
set theScript to "on run {X}" & return & "tell app \"TextEdit\" to set text of document 1 to X" & return & "end"
run script theScript with parameters {"This is the simple test."}
set theScript to "on run {Y, X}" & return & "tell Y to set its text to X" & return & "end"
tell application "TextEdit" to run script theScript with parameters {docRef, "This is the complex test."}
The second 'run script' event works in Tiger and Leopard, but throws an error -10006 on Snow Leopard. Is there any way to pass application object references to dynamically assembled script code anymore?
_______________________________________________
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