Re: Coerce Script to Text?
Re: Coerce Script to Text?
- Subject: Re: Coerce Script to Text?
- From: Shane Stanley <email@hidden>
- Date: Sun, 23 Feb 2014 12:31:11 +1100
On 23 Feb 2014, at 6:14 am, Christopher Stone <email@hidden> wrote:
Is there a simple way to coerce data or script to text without resorting to the shell?
Assuming you mean AS data objects, you can write them to a file and read them using read. For a script, you're probably looking at osadecompile, or using OSAScript in an ASObjC-based library (which also gives you the option of getting it as RTF, of that's useful). Something like:
use framework "Foundation" use framework "OSAKit"
on getSourceFor:scriptPath set aURL to current application's |NSURL|'s fileURLWithPath:scriptPath set theScript to current application's OSAScript's alloc()'s initWithContentsOfURL:aURL |error|:(missing value) return theScript's source() as text end getSourceFor:
|
_______________________________________________
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