Re: osascript - path to me
Re: osascript - path to me
- Subject: Re: osascript - path to me
- From: Paul Skinner <email@hidden>
- Date: Sun, 19 May 2002 23:33:23 -0400
On Saturday, May 18, 2002, at 11:05 PM, Timothy Bates wrote:
how can a system of bundles help with shared resources?
2 scripts both expect to find 20 sound files in a "Resources" folder
beside
them. They use the same resources (about 20 MB worth).
You should put your sound files folder in "/Library/Application
Support",
"/Network/Application Support" or "~/Library/Application Support".
That's
what these locations are for.
I (and most others deploying scripts that need other bits and bobs)
can't do
that for several practical and absolute reasons.
The reasons don't matter. You shouldn't HAVE to do anything. This
isn't Redmond.
Good reasons snipped.
All of these ideas are unbelievably error prone (what happens when
something
moves? Or the script name is changed?) and hard (now I need to
coordinate
the installation of things in two places instead of one AND take care of
naming conflicts AND update this in hard coded info in the scripts) and
opaque (currently the user knows exactly where the resources are, in
these
new scenarios they are either invisible (in a bundle) or in some
arbitrary
locaiton in a hierarchy in the system folder, that they will have to
open
the script in order to find). It is totally impractical. And all for
why?
Because someone wants path to me to return the path to the Script Editor
instead of the script. But they have zero reasons for this.
I am assuming you mean me. I could be wrong. I don't want 'path to
me' to do anything. It has a function. I accept it. I was defending it's
behavior because I believe it does exactly what the ASLG says it will
do. You may not care where the script is executing, but someone else
may. They may want it to run differently from the script menu than from
the editor.
I agree with your desire to be able to get more info about whether
the executing script exists in the filesystem or not and if it does then
where the source code is located in the filesystem. I think that every
piece of the system that AppleScript can tell us about or effect adds
power and flexibility to AppleScript. And I hope that you get your
desire for that function. I'd like it too.
What next? Maybe when my script says "my handlerx()", script editor will
grab this and return a "Script Editor cannot continue handlerx() error?
(forget the fact that a perfectly good handlerx() exists in my script,
me is
me: the Script Editor - surely you mean me? Don't you ...
Maybe the error should just be "I am sorry Dave, I can't do that"
With regard to "path to me", remember that scripts aren't file system
objects. To see that, ask yourself what
run script "path to me"
A script need not be a file system object, but it is always the case
that it
is either a direct file object itself (90%) of cases, or is owned by a
script which IS a file object: the other 10% of cases.
Not in unsaved scripts, but that isn't a big deal. These can just error
appropriately when their source file is asked for.
So, "path to me" can always return the path to a file, which will be
unambiguous and predictable.
what should
echo "path to me"| /usr/bin/osascript
return, if not the path to the application executing the script.
Given the number of emails generated, I think that almost no one using
AppleScript has a clue what should happen with anything on the command
line
:-) :-)
Please clue us in. : )
But ... For my money, this should return the "/usr/bin/osascript"
It is the same as asking what should happen in this case
A script file called "theScript" contains the following
Script innerScript
whereAreWe()
return path to me
end
end
InnerScript's whereAreWe()
What happens when we run this? Easy:
--> path to theScript's location in the file system
Assuming script theScript has been saved to the filesystem.
I think a more interesting question is what you think that a loaded
script running within a saved script should report as it's path. What if
it's been preloaded as a property? What if it was placed into the
property by referencing a script object in a script server? What If the
original script was deleted after being loaded into a property of the
script server?
I'm not arguing that these are common possibilities, but that the
issue of where source code 'IS' in AppleScript can be complex.
tim
--
Paul Skinner
_______________________________________________
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.