Re: Get script as text from scpt files
Re: Get script as text from scpt files
- Subject: Re: Get script as text from scpt files
- From: jj <email@hidden>
- Date: Thu, 15 Mar 2007 21:59:17 +0100
- Thread-topic: Get script as text from scpt files
Before involving in a huge project (involving lots of issues, including
support for .scptd, .app, .etc files), why don't you try a workaround:
getting AS to load .applescript files.
Ie:
##################
set lib to run script "return me" & return & (read alias "file.applescript")
lib's displayDialog()
##################
Otherwise, this is the required info. In a Smile window, run the following:
##################
set scptAsString to (load script alias "file.scpt") as string
##################
Or, if running outside of Smile's context:
##################
tell app "Smile" to ¬
set scptAsString to (load script alias "file.scpt") as string
##################
Using Jon's Commands:
##################
set scptAsString to (load script alias "file.scpt") as string
##################
But you must make sure you're running the script in a PPC context.
Otherwise, you won't be able to use the Jon's Commands', a PPC scripting
addition, coercion -scpt to string-.
jj
> Thanks for the reply, JJ.
>
> A little more info may help. I'm trying to set up subversion managed
> folder of script libraries.
>
> AS does not support .applescript (text) files for the 'load script'
> command. Subversion does not offer the ability to compare binary
> (.scpt) files.
>
> I have many library applescript files that I want to use with svn
> (displayDialog(), unicodeToString(), filenameFromPath(), etc). When a
> library file is changed, I want to be able to commit these files to
> an svn repository.
>
> So, I'm trying to use the best of both by using .scpt files as the
> library files and then use a folder action (probably an idle handler
> as folder actions are still to unreliable) to create a .applescript
> file from the amended .scpt file when it detects a change.
>
> Also, does anyone have an idea on how to manage the above with .app
> and .scptd files? When a .app or .scptd file is amended a new
> directory (bundle) is created that does not keep the .svn directory.
> Therefore, the svn repository is completely broken.
>
> It's a failing of svn. It has no ability to deal with bundles.
>
> Saving script files with a resource fork doesn't work either. svn
> 'commits' these files as zero byte files. The resource fork is lost.
>
> Simon
>
>
> On 15 Mar 2007, at 19:01, jj wrote:
>
>> I think both Smile and Jon's Commands (running thru Rosetta, if
>> needed) will
>> provide the coercion (only for not-run-only scpts, of course).
>>
>> But, if needed, the related applications will be launched in order
>> to coerce
>> the raw apple-events to human-readable code. So, not a background
>> process at
>> all, unless you use vanilla applescript and osaxen.
>>
>>
>> jj
>>
>>> Does anyone know how to get the contents of an AppleScript file saved
>>> as Compiled Script (Data Fork) as text?
>>>
>>> I'm trying to convert a .scpt file to a .applescript file without
>>> opening the script in Script Editor or Script Debugger. It needs to
>>> run as a background process.
>>>
>>> Does one of the Developer Tools do this? The man pages all seem to
>>> refer to files with a resource fork, rather than a data fork. But I
>>> may be misunderstanding the info.
>>>
>>> TIA,
>>>
>>> Simon
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> AppleScript-Users mailing list (applescript-
>>> email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>> 40macscripter.net
>>> Archives: http://lists.apple.com/archives/applescript-users
>>>
>>> This email sent to email@hidden
>>
>> --
>> http://www.macscripter.net/
>> http://www.osaxen.com/
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> AppleScript-Users mailing list (applescript-
>> email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> email@hidden
>> Archives: http://lists.apple.com/archives/applescript-users
>>
>> This email sent to email@hidden
>
> _______________________________________________
> 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
--
http://www.macscripter.net/
http://www.osaxen.com/
_______________________________________________
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