Desktop Alias with Applescript

Shari shari at gypsyware.com
Sun Dec 11 12:18:19 CST 2005


>When OS X happened, aliases began using Unix-style links rather than 
>old OS 9 type links. Unix links are based on file paths rather than 
>document IDs. Moving a file from its original location will break 
>the link.
>
>I don't know which version of links the Finder creates -- it is a 
>sort of hybrid animal now -- but the above may be part of the 
>problem. You may need a shell command to do the "ln" command, which 
>creates unix-style links. I tried to find my notes on that for you 
>but they seem to have disappeared.

I did experiment with creating the alias with a shell() command.  Not 
being at all familiar with that, I diddled with it.  I did not find 
much good info on the net, but worked with what little I found.  I am 
totally unfamiliar with Unix commands, and using shell() inside of 
Metacard.  I'd find references to the ln command, but searched for 
many hours to find just one line of code that gave the full command 
necessary.  With my level of Unix and Shell knowledge, I need the 
Code for Dummies version of code.  Every piece of it starting with 
the exact filepath it wants.  On OSX that is so odd now.  Does it 
want the disk name?  The word "Volumes" as the beginner?  Is 
Metacards "effective filename" minus a few items to back out of the 
Contents folder enough to make it happy?  You get the idea of 
everything I experimented with...

I did finally get it to create an alias via the terminal (I did not 
try from within Metacard as I was not happy with the results from the 
terminal.)

Even though I had the full pathway to the desktop, it put the alias 
one level down.  Double click on the disk icon and there's the alias. 
Not on the desktop.  Also, it did not have the nifty program icon, 
but a generic piece of paper.  Not acceptable for a program to be 
publicly distributed.  Thirdly, the danged things refuse to be 
deleted!  I created them two days ago but cannot delete them.  I 
don't recall a password to the Admin account as I've never really 
needed to use it... but am assuming that will be the only way to get 
rid of them.  That's also bad because my program has an uninstaller 
which uninstalls all files outside of the program folder including 
the desktop alias.

As for using Applescript, what broke is Applescript's ability to 
create the link, not the link itself.  I know that moving a file 
after the link is created will break it :-)  But what baffled me is 
that the Applescript to create the link which worked initially, 
stopped working.  Suddenly it would not create links.  I'm 99.9999% 
certain I did not change the code.  Generally if it ain't broke, I 
don't diddle with it unless I'm improving it.  That code didn't need 
improving.  Until it broke.... :-\

In searching the archives there were references to Tuviah's use of 
the ln command, but no specifics to follow.  Just a vague reference. 
I do not know if it's possible to use the ln command and keep the 
nifty icon, and make it deletable...

Shari
-- 
Mac and Windows shareware games
http://www.gypsyware.com


More information about the metacard mailing list