Welcome to Soft32 Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Posix path in a Folder Action Script

 
   Soft32 Home -> Mac -> Apple Scripts RSS
Next:  Automating installation  
Author Message
Lorin Rivers

External


Since: Feb 06, 2006
Posts: 2



(Msg. 1) Posted: Mon Feb 06, 2006 2:13 pm
Post subject: Posix path in a Folder Action Script
Archived from groups: alt>comp>lang>applescript (more info?)

Why doesn't this work? It throws a "-1728" error...
on adding folder items to thisFolder after receiving addedItems
local folderPath
--set folderPath to ((thisFolder as Unicode text) as text)
set folderPath to POSIX path of (thisFolder as text)
return folderPath
end adding folder items to
Back to top
Login to vote
Gnarlodious

External


Since: Nov 10, 2004
Posts: 655



(Msg. 2) Posted: Mon Feb 06, 2006 8:25 pm
Post subject: Re: Posix path in a Folder Action Script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Entity Lorin Rivers uttered this profundity:

> Why doesn't this work? It throws a "-1728" error...
> on adding folder items to thisFolder after receiving addedItems
> local folderPath
> --set folderPath to ((thisFolder as Unicode text) as text)
> set folderPath to POSIX path of (thisFolder as text)
> return folderPath
> end adding folder items to
>
Just a wild guess, but I believe System Events will return a boot disk path
while you are expecting a userfolder path.

-- Gnarlie
Back to top
Login to vote
Lorin Rivers

External


Since: Feb 06, 2006
Posts: 2



(Msg. 3) Posted: Mon Feb 06, 2006 8:25 pm
Post subject: Re: Posix path in a Folder Action Script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 2006-02-06 14:25:20 -0600, Gnarlodious said:

> Just a wild guess, but I believe System Events will return a boot disk path
> while you are expecting a userfolder path.
>
> -- Gnarlie

No, it's returning the right value, but for some reason, needs the
posix bit wrapped in a tell Finder block.

So, why is it that it needs the tell finder bit?
Back to top
Login to vote
Gnarlodious

External


Since: Nov 10, 2004
Posts: 655



(Msg. 4) Posted: Tue Feb 07, 2006 1:16 am
Post subject: Re: Posix path in a Folder Action Script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Entity Lorin Rivers spoke thus:

> for some reason, needs the
> posix bit wrapped in a tell Finder block.
>
> So, why is it that it needs the tell finder bit?
>
I don't know, I don't use Folder Actions. They are not very reliable for me.

But I do know Folder Action scripts are handled by System Events, not
Finder. I believe what you have essentially said is:

set someFolder to path to me
tell application "System Events" to POSIX path of (someFolder as text)

which errors. Note that I have interpolated the " tell application "System
Events" to" part to simulate the Folder Action handling.
I am not sure why that is, possibly System Events cannot handle a path as
text, because this works:

tell application "System Events" to POSIX path of (path to me)

Note that the path is an alias, which is what System Events likes to see.

-- Gnarlie
Back to top
Login to vote
J. Stewart

External


Since: May 13, 2005
Posts: 94



(Msg. 5) Posted: Tue Feb 07, 2006 4:26 am
Post subject: Re: Posix path in a Folder Action Script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article , Gnarlodious
wrote:

> I believe what you have essentially said is:
>
> set someFolder to path to me
> tell application "System Events" to POSIX path of (someFolder as text)
>
> which errors. Note that I have interpolated the " tell application "System
> Events" to" part to simulate the Folder Action handling.
> I am not sure why that is, possibly System Events cannot handle a path as
> text, because this works:
>
> tell application "System Events" to POSIX path of (path to me)
>
> Note that the path is an alias, which is what System Events likes to see.

When you convert to POSIX path you convert to Unicode text not alias.

log (class of (path to me))
--> (*alias*)

log class of (POSIX path of (path to me))
--> (*Unicode text*)

--
Use ROT-13 on the email address for email replies
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Folder Action script to open .PS files in Preview (OS 10.3)? - I know this should be simple, but I'm a beginner, so please be patient: Thanks to Patrick Stadelmann's generous help t...

POSIX path probs.. - Hi, im lost.. the following code seems to not pass a POSIX path: on open (the_volume_to_wipe) do shell script &qu...

OS 9 folder action to attach folder action? - I wish to create a folder action on an OS 9 machine that attaches another folder action to all the folders within the t...

Scripting folder view (Folder Action) - I've been trying to write a simple script that changes the folder view of the opened folder to icon view and then, pre...

newbie: path relative to the script - tell application "Finder" activate select file "myfile.pdf" of folder "test" of startup...

relative path in "do shell script" - Hi all, i am a newbie in the apple world and i am taking confidence of applescript. I have to run an applescript with t...
       Soft32 Home -> Mac -> Apple Scripts All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum

Categories:
 Windows
 Linux
  Mac
 PDA



[ Contact us | Terms of Service/Privacy Policy ]