Copying files to the HD from a CD

Ok i’m a newbie, so forgive me if i don’t make sense…

I’ve managed ot wirte an applescript that copys an application in its folder (from a CD) to the applications folder. but i wish to make it produce an alert if the folder alredy exists. I’ve used the ‘exists’ command, but how do i make applescript alert the user that the folder already exists?

I also wish to make an alias of the application, that has been copied to the HD, on the desktop. copying an alias that was on te CD doesn’t work as the aliases path is wrong and doesn’t link to the correct file on the HD.

Any one know the answer?

  • If you are working under OS 9, you may change these:
set theFolder to (path to applications folder as text) & "foo:"
set theApp to (path to applications folder as text) & "foo:foo.app"

thanks for that.

i get an error on the final command:

tell application “Finder” to make new alias at desktop to theApp

Finder got an error: Invalid key form.

any ideas what i’m doing wrong?
[/quote]

Does this work?

--> copy app to Applications folder, then...
set theApp to alias ((path to applications folder as text) & "foo:foo.app")
tell application "Finder" to make new alias at desktop to theApp

If it doesn’t, sorry, I can’t access to a OS 9 machine anymore :oops:

yes cool that works!

just one more thing…

how can ichange the path in:

so that it always goes to the users start-up disk no matter what they have named it?

at the moment i am doing "Macintosh HD:Applications (Mac OS 9)… etc but i can’t find a way of replacing Macintosh HD with a reference to the start up disk.

I’ll get there in the end…!

“path to applications folder” will return the applications folder of the current system, so it will include the correct disk name (that is the applications folder in the startup disk). Run this in a script-editor window and watch the result:

path to applications folder
--> this one returns here:
--> alias "solomon burke:Applications:"

To obtain the startup disk…

path to startup disk

Just take a look to the entry “path to” in the dictionary of Standard Additions.

  • Happy 1000 post to me :?

Actually, on systems earlier than Panther, it’s:

path to At Ease applications folder

-- or:
path to "apps"

So:

set theApp to alias ((path to "apps" as text) & "foo:foo.app")

Nice one, jj! I’m sure people appreciate all the help you give on this BBS. :slight_smile:

Ahhh that would explain why it wasn’t working on OS9!

thanks for your help both of you! :smiley: