Copying OS X apps
Ken Ray
kray at sonsothunder.com
Tue Oct 29 23:13:00 EST 2002
Thanks, Jacque... I hadn't thought of providing the destPath with the
duplicate file command - a lot easier than "setting the name of the result".
Thanks! I'll update my scripts... ;-)
Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
----- Original Message -----
From: "J. Landman Gay" <jacque at hyperactivesw.com>
To: <metacard at lists.runrev.com>
Sent: Tuesday, October 29, 2002 9:04 PM
Subject: Re: Copying OS X apps
> > you need to use applescript (and don't forget about use
> > colon-delimited paths).
>
> Thanks Ken, that helps a lot -- and I would have forgotten about the
> colons if you hadn't mentioned it. Just knowing I need to use
> AppleScript saved me hours. I haven't tried it in MetaCard yet, but in
> the Script Editor, copying an OS X app seems to move the whole package.
> That is, this AppleScript moves the whole application bundle intact:
>
> tell application "Finder"
> set theSrcPath to "Macintosh HD:Users:username:folder1:test_app.app"
> set theDestPath to "Macintosh HD:Users:username:folder2"
> duplicate file theSrcPath to folder theDestPath with replacing
> end tell
>
> Apparently AppleScript/Finder in OS X is smart enough to know that a
> folder named ".app" should be treated like a file and it moves the whole
> bundle. I didn't need to worry about icons or anything in the Contents
> folder, they went over by themselves. A nice touch. I also found that if
> you know the name of the non-startup volume, you can plug it into one of
> the paths and the copy will still work. MC can get the disk names with
> the "volumes" function, so I'm in business. Now all I need to do is
> re-script it for MC with all those quote constants. ;)
>
> Thanks again. Big help.
>
>
> On 10/29/02 5:47 PM, Ken Ray wrote:
> > Sorry about that...
> >
> > I was saying you need to use applescript (and don't forget about use
> > colon-delimited paths). Here's the code I use... note that this works
only
> > for the boot volume and not for other volumes (because non-boot volumes
> > start with "/Volumes/<volName>/"):
> >
> >
> > function CopyApp pSrcPath,pCopyName
> > -- Assumes pSrcPath is "/" delimited
> > put "" into tNewApp
> > if last char of pSrcPath is "/" then delete last char of pSrcPath
> > put pSrcPath into tASPath
> > replace "/" with ":" in tASPath
> > if first char of tASPath is ":" then delete first char of tASPath
> > put "tell application" && q("Finder") & cr into tAS
> > put "duplicate file" && q(tASPath) && \
> > "of startup disk replacing existing items" & cr after tAS
> > put "set the name of the result to" && q(pCopyName) & \
> > cr & "end tell" after tAS
> > do tAS as AppleScript
> > end CopyApp
> >
> > function q what
> > return quote & what & quote
> > end q
> >
> > Hope this helps... don't forget that if you copy an app in OS X, you
still
> > will need to deal with bundle information, icons, etc. for the new copy.
> >
> > Ken Ray
> > Sons of Thunder Software
> > Email: kray at sonsothunder.com
> > Web Site: http://www.sonsothunder.com/
>
>
> --
> Jacqueline Landman Gay | jacque at hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
>
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
>
More information about the metacard
mailing list