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: Paul Berkowitz <email@hidden>
- Date: Fri, 17 Jun 2005 11:09:13 -0700
- Thread-topic: "info for" always failing in Automator action script
On 6/17/05 10:49 AM, "Sparky" <email@hidden> wrote:
> I'm trying to write my first Automator Action script. But I can't
> seem to get information about files or folders. The following VERY
> SIMPLE script fails with an Automator dialog that says,
>
> AppleScript Error
> Finder got an error: File /System wasn't found. (-43)
>
> I get pretty much the same error whether I try to get 'info for'
> within a Finder tell or not. Anybody know what's going on? Thanks.
>
> on run {aInputs, aParameters}
> tell application "Finder"
> set itemInfo to (info for "/Users")
> end tell
> end run
Have you not ever tried 'info for' in a regular applescript before? It does
not take POSIX type paths, nor string paths at all. It takes aliases:
info for -- file -- an alias or file reference to the file or folder
as it says in the Standard Additions (NOT Finder) dictionary. You need to
check the dictionary before using commands you're not familiar with. You
haven't given it an alias or file reference. To "hardcode" it you'd have to
know the name of the startup disk, which would work with your own computer
like this:
info for "Macintosh HD:Users:"
But you'd have to know the real name of the disk. So the usual way of doing
this is:
info for ((path to startup disk as Unicode text) & "Users:")
or simply
info for (path to users folder)
which is much nicer, and the best way to do it. Note that 'path to' actually
gets the alias form, not text, so it's what you need for 'info for'.
You'd think you could do:
info for (POSIX file "/Users")
The trouble is it will compile immediately to _your own_ "/Users" folder
(you'll see it be replaced by the hard-coded path using your own disk name)
and will result in an error on other machines.
NOTE: None of this has anything to do with the Finder and should not be put
into a Finder block. Depending on which method you used above, putting it
into a Finder block could even result in an error in some circumstances.
Just use
set itemInfo to info for (path to users folder)
--
Paul Berkowitz
_______________________________________________
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