Re: "info for" always failing in Automator action script
Re: "info for" always failing in Automator action script
- Subject: Re: "info for" always failing in Automator action script
- From: Timothy Bates <email@hidden>
- Date: Mon, 20 Jun 2005 10:38:35 +1000
- Thread-topic: "info for" always failing in Automator action script
When I first got into applescript (under OS 9) lots of us had osaxen
installed which, almost as a side effect of their main purpose) performed
all sorts of invisible (to the user) coercions from one type to another on
the fly as needed.
No doubt these made for slightly slower execution, but boy was it easier to
script...
With OS X, I notice a lot more people stumped by just silly file form
conversions
It would be very nice if at least these four were all coerced as necessary
between the formats their recipients might request
"Prelude:Users:tim:Desktop:mx:sat.mxs"
"/Users/tim/Desktop/mx/sat.mxs"
file "/Users/tim/Desktop/mx/sat.mxs"
alias "Prelude:Users:tim:Desktop:mx:sat.mxs"
alias "Prelude:Users:tim:Desktop:mx:sat.mxs"
> On Jun 17, 2005, at 11:28 AM, Sparky wrote:
>
>>> set itemInfo to (info for (path to users folder))
>>>
>>>> on run {aInputs, aParameters}
>>>> tell application "Finder"
>>>> set itemInfo to (info for "/Users")
>>>> end tell
>>>> end run
>>>
>>> "/Users" is not the type of path expected by info for.
>>
>> Thank you. But I just used /Users in my posting to show that it is
>> definitely a location that exists. There is a folder on my root
>> volume named '/Developers'. If I change my script to refer to that
>> folder (or more generally any folder or file on any mounted volume)
>> my script fails with the file not found problem I mentioned.
>
> I think you're missing the point, which is that a string, and in
> particular a POSIX path string, is not the same thing as a file
> object or alias object. For historical reasons, AppleScript mostly
> uses HFS path syntax, which is definitely not the same thing as POSIX
> syntax.
>
>> Paul, Thank you also for your comments. In answer to your first
>> question, no I haven't used 'info for' before. I use AppleScript
>> very infrequently I'm afraid. (Java & C++ mostly.) After reading
>> your response I'm still stumped as to how to convert the POSIX
>> paths that Automator passes to my action into aliases.
>
> Well, you can convert by saying (assuming p is your POSIX path
> string) "POSIX file p". (To go the other way -- say you've got an
> alias object from somewhere, such as "choose file" -- say "POSIX path
> of a".) However, since this is an Automator action, a more
> straightforward solution would be to change the AMAccepts type to the
> type you actually want, in this case "com.apple.applescript.alias-
> object". You'll then get alias objects as input, which "info for"
> can accept without difficulty. You might consider signing up for the
> automator-dev list as well <http://lists.apple.com/mailman/listinfo/
> automator-dev>.
>
>
> --Chris Nebel
> AppleScript and Automator Engineering
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Applescript-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden