Re: Folder action question
Re: Folder action question
- Subject: Re: Folder action question
- From: Mark Butler <email@hidden>
- Date: Sun, 25 Jan 2004 17:24:23 -0600
So you got the same result just got there a different way.
Is folder actions recognizing this as a new file every time it renames
the old one?
If so is this why a fixed value works because it renames it to the same
thing everytime. I am sure there has to be something wrong with how I
am writing it. Wouldnt this be the most basic use for folder actions?
Mark
On Jan 25, 2004, at 10:57 AM, Matyas Ferenc Farkas wrote:
>
hi
>
>
i am a little bit confused. where is the character limit check? the
>
folder action calls the on adding folder items to this_folder after
>
receiving added_items only, when the window of the folder is open or
>
using a column view (command + 3). so you want to rename the pdf
>
dragged at the folder to the name of the folder and the name of the
>
dragged item. at this handler the quest is the added_items variable,
>
which stores the alias list of the dragged elements. the scripts does
>
not utilize the folder action mechanism, only the regular methods.
>
>
BUT, i have a strange error with folder actions. i write the following
>
code, which does the same:
>
>
on adding folder items to this_folder after receiving added_items
>
tell application "Finder"
>
repeat with i from 1 to (count every item in added_items)
>
if file type of item i of added_items is "PDF " then
>
set name of item i of added_items to name of this_folder & name of
>
item i of added_items
>
end if
>
end repeat
>
end tell
>
end adding folder items to
>
>
but the on adding folder items to this_folder after receiving
>
added_items gets called for eternity. i added some debugging
>
information:
>
>
on adding folder items to this_folder after receiving added_items
>
try
>
tell application "Finder"
>
display dialog (count every item in added_items) as string
>
display dialog (added_items) as string
>
repeat with i from 1 to (count every item in added_items)
>
if file type of item i of added_items is "PDF " then
>
set name of item i of added_items to name of this_folder & name
>
of item i of added_items
>
end if
>
end repeat
>
end tell
>
on error -- errmsg number errNum from errFrom partial result
>
errResult to errTo
>
beep 5 --errorReporter(errmsg, errNum, errFrom, errResult, errTo) of
>
me
>
end try
>
end adding folder items to
>
>
on errorReporter(errmsg, errNum, errFrom, errResult, errTo)
>
tell application "Finder"
>
set furl to ((path to desktop folder) as string) & ":errorlog.txt"
>
as string as +class furl;
>
set openfile to open for access furl with write permission
>
try
>
set eof of openfile to (get eof openfile)
>
set thedata to return & return &
>
"---------------------------------" & return & errmsg & return &
>
errNum & return & errFrom & return & errResult & return & errTo &
>
return & (current date) & return
>
say "Error!"
>
write thedata starting at (get eof of openfile) to openfile
>
open furl
>
close access openfile
>
on error
>
close access openfile
>
end try
>
end tell
>
end errorReporter
>
>
it does not give me an error, when i cancel click the display dialog,
>
the beep 5 works only, my errorReporter handler does not gets called.
>
at the first call, the number of the added items is correct, 3 for
>
example, and after that at the unneded executions it shows me 2 every
>
time. now what. ideas? the simplest script at the top level works for
>
somebody?
>
>
--
>
matyas
>
Mark Butler
Application Specialist - Artwork-Systems
(415) 515-8055
(215) 826-4500 ext 260
email@hidden
_______________________________________________
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.