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: Simon Topliss <email@hidden>
- Date: Sat, 17 Mar 2007 22:02:45 +0000
As always, thanks for the response, has. Never thought of looking at
TextCommands.
Got a solution I'm working on. Moving it over the Xcode so I can put
a GUI on it.
Should work well. Script files and apps will be managed thru the
UI. .scpt files will be converted to .applescript. Other types
(.scptd, .app) will be zip'ed or tar'ed.
User will set up the AS files and apps to be brought under subversion
control. Idle handler will monitor changes to those and the GUI will
show what's changed and what needs adding or committing.
Well, that's the theory so far. Time will tell how things actually
pan out.
Thanks again, Simon.
On 16 Mar 2007, at 12:56, has wrote:
jj wrote:
> Does anyone know how to get the contents of an AppleScript file
saved
> as Compiled Script (Data Fork) as text?
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).
Also TextCommands:
set scriptObj to load script scptFile
tell application "TextCommands" to format {scriptObj} using "%s"
...
Simon Topliss wrote:
A little more info may help. I'm trying to set up subversion
managed folder of script libraries.
Some suggestions below.
AS does not support .applescript (text) files for the 'load
script' command.
Since this is an in-house system, one option might be to write your
own 'load script file' osax that supports loading source-based
scripts as well as compiled ones (see OSALoadFile and
kOSAModeCompileIntoContext). If you're using a proper library
loading system like AppleMods' Loader, only the loader code would
need modified to use the new command. Or, assuming that OS X loads
osaxen in a sensible order, you could just define your own 'load
script' (sysoload) osax that overrides the Apple-installed one.
Of course, compiling library scripts at load-time carries its own
penalties: longer loading times, all applications used by libraries
must be present, AS may need to launch some apps to compile the
script. You'd need to consider those when deciding if a completely
source-based system is the way to go.
Subversion does not offer the ability to compare binary (.scpt)
files.
Subversion can handle binary files, it's just no good at diff-ing
them. But how big a problem is this really? If you need to compare
two .scpt files for changes, write yourself a script that checks
them out them out into temporary directories, decompiles them into
source files, and runs diff on those.
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.
If you want to ensure that .scpt files are always checked in
as .applescript files, I'd suggest looking into using svn hooks:
http://svnbook.red-bean.com/nightly/en/
svn.reposadmin.create.html#svn.reposadmin.create.hooks
When and how you do commits is a separate problem and best dealt
with as such.
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.
It's a longstanding issue:
http://subversion.tigris.org/issues/show_bug.cgi?id=707
If it was worth your time, you could develop a suitable patch
yourselves. That'd give you an in-house solution, and you could
always submit it for inclusion in a future svn release which I'm
sure would be appreciated by other svn users as well.
Otherwise you're probably best treating bundles as opaque data and
tar-ing them, which seems to be the usual workaround.
Another option is to use only svn-aware editors. Xcode already is,
but I'm guessing the others aren't. e.g. If Script Debugger stomps
on .svn directories when saving .scptd/.app bundles, submit that as
a bug report to LNS. (As a separate feature request for SD5, you
might also suggest they add integrated CVS support similar to
Xcode's.)
Saving script files with a resource fork doesn't work either. svn
'commits' these files as zero byte files. The resource fork is lost.
Another known issue. Again, tar them, or use Rez/Derez to move data
between resource and data forks.
HTH
has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
http://appscript.sourceforge.net/objc-appscript.html
_______________________________________________
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