<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
--></style><title>Desktop Alias with Applescript</title></head><body>
<div>I had an Applescript that created a desktop alias on OSX (from
within Metacard), and it was working okey dokey.</div>
<div><br></div>
<div>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.</div>
<div><br></div>
<div>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.</div>
<div><br></div>
<div>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.</div>
<div><br></div>
<div>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:</div>
<div><br></div>
<div>tell application "Finder"</div>
<div> 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"}</div>
<div>end tell</div>
<div><br></div>
<div>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...):</div>
<div><br></div>
<div>tell application "Finder"</div>
<div> make alias file to pathToFile at
pathToAndNameOfAlias</div>
<div>end tell</div>
<div><br></div>
<div>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.</div>
<div><br></div>
<div> put the effective filename of stack theStack into
theFile</div>
<div> set the itemDel to "/"</div>
<div> # set user permissions<br>
put theFile into theDirectory</div>
<div> if the platform is "MacOS" then # only runs on
OSX and Windows</div>
<div> repeat 4<br>
delete the last item of
theDirectory<br>
end repeat</div>
<div> else delete the last item of theDirectory</div>
<div> get shell("chmod 777 " & quote &
theDirectory & quote)</div>
<div><br></div>
<div>This code preceded both snippets of Applescript.</div>
<div><br></div>
<div>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?</div>
<div><br></div>
<div>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....</div>
<div><br></div>
<div>PPC broke 68K, programs not compatible</div>
<div>OSX broke PPC, programs not compatible</div>
<div>Intel ??? Bet I can guess...</div>
<div><br></div>
<div>Shari</div>
<div><br></div>
<div><br></div>
<div><br></div>
<div><br></div>
<x-sigsep><pre>--
</pre></x-sigsep>
<div>Mac and Windows shareware games<br>
http://www.gypsyware.com</div>
</body>
</html>