Re: Sending TEXT values in Apple Events with AppleScript 2.0
Re: Sending TEXT values in Apple Events with AppleScript 2.0
- Subject: Re: Sending TEXT values in Apple Events with AppleScript 2.0
- From: has <email@hidden>
- Date: Thu, 5 Jun 2008 00:08:04 +0100
Scott Babcock wrote:
In the new world of Unicode-only strings, I'm at a loss as to how I
can send an Apple Event from AppleScript 2.0 in which the value of
one of the parameters is required to be an 8-bit string. I've tried
to coerce the value to 'string' in the event call, but to no avail.
Here's my code:
set msg to "This is the message"
tell application "FooBar" to <<event my_event>> given <<class
yatz>>:length of msg, <<class putz>>:msg as string
This works fine in Tiger (AppleScript 1.10.7), but fails on Leopard
(AppleScript 2.0). Does anyone know of a way to send an 8-bit string
as the value of an event parameter from AppleScript 2.0?
If it's a string literal, hardcoding it using raw «data TEXT...»
syntax seems to work. Otherwise there's a very hackish but apparently
workable solution on the thread at:
http://discussions.apple.com/thread.jspa?threadID=1531856&tstart=0
which could be rendered merely kludgy by replacing the bulk of that
code with an osax command if you want (I've been experimenting on this
front myself recently).
Or use appscript, which gives you much more control over this sort of
stuff.
HTH
has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net
_______________________________________________
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