Re: Make Alias
Re: Make Alias
- Subject: Re: Make Alias
- From: Nigel Garvey <email@hidden>
- Date: Tue, 10 Feb 2004 11:31:44 +0000
Mike Bautsch wrote on Mon, 9 Feb 2004 22:41:16 -0500:
>
I am trying to make a alias and give it a new name. Can this be done at
>
the same time? This is what I have so far:
>
>
on open (somefile)
>
>
tell application "Finder"
>
make new alias at folder "Import" of the desktop to somefile
>
move somefile to folder "Done" of the desktop
>
>
end tell
>
end open
>
>
This all works, I just don't know how to give the alias a name that
>
will always be the same.
The same as what? The same every time or the same as the original item
without " alias" appended. If you mean the latter, you could try this:
on open someItems
tell application "Finder"
move someItems to folder "Done" of the desktop
make new alias file to someItems at folder "Import" of the desktop
end tell
end open
This works because 'someItems' is a list of aliases. When the original
items are moved to "Done", these aliases are updated to reflect the new
location. The alias files are then created in the other folder and don't
have " alias" appended to their names.
This is subject to the same vulnerability pointed out by Gary. You may
need to code for the possibility of items with the same names already
existing in the target folders.
The bulk 'move' and 'make new alias file' lines work in OS 9.2.2 and
Jaguar. I'm afraid I don't have Panther to be able to test them in that.
NG
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.