Categories
AppleScript Notes

path to over eppc

Date: Mon, 9 Jun 2003 10:39:58 -0700
Subject: Re: path to over eppc?
Cc: applescript-users@lists.apple.com
To: matt neuburg
From: Christopher Nebel

On Sunday, June 8, 2003, at 07:19 PM, matt neuburg wrote:

>The status of the phrases “beep” and “say” and “display dialog” and
>”path to” is the same – they are all scripting addition commands. But
>in the following script:
>
>tell app “Finder” of machine “eppc://little-white-duck.local”
> beep
> say “howdy”
> display dialog “howdy”
> path to system folder
>end
>
>the first three commands are executed on the remote machine, but “path
>to” is executed on the local machine. I need to know why. Please note,
>I don’t want a workaround; I want an explanation.

That’s no bug — that’s a feature! Well, sort of. Here’s what’s going
on: “path to” really is being executed on the remote machine. The
tricky bit is that “path to” returns an alias — an alias, that is,
that points to something on a remote machine’s disk that the local
script can’t see! When AppleScript tries to display the alias as a
full path, the Alias Manager, in a desperate attempt to produce
something “useful,” substitutes the local disk name for the remote disk
name, comes up with a valid path, says aha! and hands it back to you.
(If I remember right, QuickTime added that little stunt back around Mac
OS 8.6 or so. Something about making otherwise broken aliases resolve
more often.)

The upshot is that aliases aren’t entirely meaningful over eppc, since
files visible on one side aren’t visible on the other. (It should work
if you take the resulting alias and hand it back to the remote side;
you just can’t inspect the alias locally.) If you say “path to … as
string”, you’ll see the correct remote path.

–Chris Nebel
Apple Development Tools