Re: Simple problem, I'm sure
Re: Simple problem, I'm sure
- Subject: Re: Simple problem, I'm sure
- From: Andrew Oliver <email@hidden>
- Date: Wed, 10 Sep 2003 23:01:31 -0700
Your problem is in the line:
>
> duplicate (item 0) + 1 to "Online:PDF'S:In"
What are you trying to duplicate here? I can imagine you're trying to
duplicate each item in the list, but in that case you need to specify item x
of the list, and in your case your code only every tries to duplicate "item
1" - assuming it even does that, I'm not sure what AppleScript will do with
"item 0"
Additionally, when duplicating with the Finder, you need to tell it where to
put the duplicate. In your case you say "duplicate <something> to
"Online:PDF's:In". However, "Online:PDF's:In" is a string. You can't
duplicate a file into a string. You need to specify it as a folder.
Instead, you need something more like:
repeat with itemNo from 1 to item_count
duplicate item itemNo of added_items to folder "Online:PDF's:In"
end repeat
However, the Finder can handle duplicating multiple items at a time, so you
can simply say:
on adding folder items to this_folder after receiving added_items
tell application "Finder"
duplicate added_items to folder "Online:PDF's:In"
end tell
end adding folder items to
On 9/10/03 9:18 PM, "Bert Knabe" <email@hidden> wrote:
>
And I can't figure out what I'm missing - I have just enough knowledge
>
of programming/scripting to screw things up. I need a simple folder
>
action to duplicate files in another folder on the same machine. I do
>
not want the folders synchronized, just anything new added to the first
>
folder to be duplicated in the second. I modifed the "alert when a file
>
is added" script that is installed with Jaguar to duplicate files in
>
another folder (I thought), but I've attached it to the folder I want
>
duplicated, and it doesn't do anything. If anyone can tell me where I
>
went wrong, I would be very grateful. Here is what I've done:
>
>
on adding folder items to this_folder after receiving added_items
>
set old_delimiters to AppleScript's text item delimiters
>
set AppleScript's text item delimiters to ":"
>
try
>
tell application "Finder"
>
--get the name of the folder
>
set the folder_name to the name of this_folder
>
end tell
>
>
set the item_count to the number of items in the added_items
>
>
if the item_count is greater than 0 then
>
repeat item_count times
>
duplicate (item 0) + 1 to "Online:PDF'S:In"
>
end repeat
>
end if
>
end try
>
set AppleScript's text item delimiters to old_delimiters
>
end adding folder items to
>
>
I can send the script I modified, but if you're running in OS X it's
>
in "Library:Scripts:Folder Action Scripts".
>
>
Bert Knabe
>
Computer Technician
>
Lubbock Avalanche Journal
>
806-766-2158
>
_______________________________________________
>
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.
_______________________________________________
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.