Desktop Alias with Applescript

Shari shari at gypsyware.com
Sun Dec 11 09:02:10 CST 2005


I had an Applescript that created a desktop alias on OSX (from within 
Metacard), and it was working okey dokey.

At some point when I wasn't looking, it broke.  I have no idea when 
or why.  I have not changed my computer system and did not notice the 
exact time of the break.  Only that I'm in the last phases of 
internal beta testing and noticed that hey, it's not making the alias 
anymore on first launch.

The only thing I did do is recently cleared some old Applescript 
things from my other computer partition, and move them to this 
partition.  I don't think I changed out my actual Applescript 
program, as the old one was for Mac Classic and of course now it's 
all OSX.  I may have dragged the old one to the new partition 
inadvertently.  I dunno.  That's my only guess.

I spent over 12 hours scouring the 'net to find a snippet of 
Applescript to make an alias that would actually work.  I'd find 
snippets, try them, nada.  I finally found one.

But my question is this:  How compatible is Applescript to itself? 
Is code written for one version likely to work with another version? 
Are the newer versions still recognizing scripts written in older 
versions?  I have no idea if the snippet I found that worked is brand 
new or 10 years old.  Only that this should have been indecently 
simple and suddenly I've put hours into it unexpectedly.  That it was 
working at one time and for some unknown reason, stopped working.  I 
have not changed my Metacard.  The newly found script that worked on 
OSX 10.2.4 is:

tell application "Finder"
     make new alias file to "pathToFile starting with disk name" at 
folder "path to desktop folder starting with disk name" with 
properties {name:"Name the Alias"}
end tell

The script that was working and "broke" (and that made me seriously 
question what happened to my marbles as I was chasing them all over 
creation...):

tell application "Finder"
     make alias file to pathToFile at pathToAndNameOfAlias
end tell

I tried everything to fix it, changing the file paths to include and 
not include the disk and so forth.  I tried every possible pathToFile 
etc. imaginable, as I could not remember whether Applescript needed 
the path to start with the disk, or "Volumes", or whether it knew the 
disk and started from there.  I diddled with it for many hours 
unsuccessfully.  The only other thing I'd changed was to move the 
actual program to a different disk.  I don't know if there were 
permission issues involved, but the newly found working script seemed 
to have no problem.  Both scripts do set the folder permissions for 
the destination folder before running the Applescript.

   put the effective filename of stack theStack into theFile
   set the itemDel to "/"
   # set user permissions
   put theFile into theDirectory
   if the platform is "MacOS" then # only runs on OSX and Windows
     repeat 4
       delete the last item of theDirectory
     end repeat
   else delete the last item of theDirectory
   get shell("chmod 777 " & quote & theDirectory & quote)

This code preceded both snippets of Applescript.

I'm wondering if people will have issues with any Applescript working 
if they don't have "the right one installed" but "some other one". 
Does anybody know?

And will it all break again under Intel????   Aaaarrrggghhhh!  Apple 
needs to QUIT making changes that break everything.  I'm getting 
tired of having to replace everything on my computer because it does 
not work with their shiny new system....  I've always thought of 
Apple as being thoughtful of us.  And that compatibility was 
important to them.  Silly thinking I guess....

PPC broke 68K, programs not compatible
OSX broke PPC, programs not compatible
Intel ???  Bet I can guess...

Shari




-- 
Mac and Windows shareware games
http://www.gypsyware.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.runrev.com/pipermail/metacard/attachments/20051211/4cca2355/attachment.html


More information about the metacard mailing list