 |
|
 |
|
Next: Automating installation
|
| Author |
Message |
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 |
|
 |  |
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 |
|
 |  |
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 |
|
 |  |
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 |
|
 |  |
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 |
|
 |  |
|
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
|
|
|
|
 |
|
|