Tell application filepath broken with long folder names
Tell application filepath broken with long folder names
- Subject: Tell application filepath broken with long folder names
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 18 Sep 2002 19:54:03 -0700
OS 10.2 / AS 1.9
The safest, surest way to call an applet (and sometimes other applications,
too) from another script has always been to tell the whole filepath,
avoiding possible (likely) confusion with other files of type "APPL", other
copies of the same file, etc. Most often I will ask the user to 'choose
file' once, save it as an alias in a property, and set that 'as string' (or
'as Unicode text') at runtime, then 'tell application filePath', with 'using
terms from' if necessary.
That is no longer possible in OS 10.2. Perhaps it wasn't in 10.1.x either?
If any folder (or the file itself) anywhere in the file path is longer than
31 characters, it errors
"File application file "OS X HD:Folder 1:Folder 2:File Name" was not
found."
If you are safe in telling just the application name, it works. (In SD 3 at
least, if using a hard-coded name, it will truncate the application name
with #SFQ3 stuff when compiling, but still works). But not the filePath. And
of course, the user may well move the file into some subfolder of a folder
with a long name long after he first runs it to save as an alias- understand
that this bug occur with variables, too, if the variable resolves to one of
these problematic filepaths at runtime.
I tried 'choose application' instead and saving the result ('as
application') as a property. But that was no good either, since it made the
applet run THREE times on first go: once when 'choose application' gets a
result, again when it hits 'tell appVariable' representing the application
object, and a third time when it hits the run command. (It's OK on
subsequent runs.)
Fortunately, all I needed to do was tell it to run, so asking the Finder to
'open' the alias did the trick. (In case you're wondering I couldn't 'run
script or 'load script file' and run it, since this applet is stay-open with
an idle handler. The only way to enable the idle handler and stay open is by
treating it like an application, not a script.) But in the case of a
scriptable application of which might have several copies and you want the
user to choose a specific copy, you're out of luck.
Has this bug been around a while, or is it brand new?
--
Paul Berkowitz
_______________________________________________
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.