Rép: Is this a sandboxing problem (file duplication to a new folder)?
Rép: Is this a sandboxing problem (file duplication to a new folder)?
- Subject: Rép: Is this a sandboxing problem (file duplication to a new folder)?
- From: Yvan KOENIG <email@hidden>
- Date: Fri, 27 Jul 2018 15:45:18 +0200
My understanding is that you are asking the Finder to a folder pointed by its
name when it must be pointed by a path.
Here is a modified version.
property done_foldername : "done"
property originals_foldername : "originals"
property extension_list : {"rtf"}
on open these_items -- may be a list of several items
my build_distribution(these_items's item 1) -- pass only one item
end open
on build_distribution(this_item)
set this_folder to this_item as string
set done_FolderPath to this_folder & done_foldername
set originals_FolderPath to this_folder & originals_foldername
tell application "Finder"
if not (exists folder done_FolderPath) then
make new folder at this_folder with properties
{name:done_foldername}
end if
if not (exists folder originals_FolderPath) then
make new folder at this_folder with properties
{name:originals_foldername}
set current view of container window of folder
this_folder to list view
end if
set the originals_folder to originals_FolderPath as alias
set these_items to (every file of entire contents of folder
this_folder as list)
end tell
try
repeat with i from 1 to number of items in these_items
set this_item to (item i of these_items) as alias
set the item_info to the info for this_item
if (alias of the item_info is false and the name
extension of the item_info is in the extension_list) then
tell application "Finder"
duplicate this_item to folder
done_FolderPath --with replacing -- now we trigger a full path
end tell
end if
end repeat
on error error_message number error_number
if the error_number is not -128 then
tell application "Finder"
activate
display dialog error_message buttons {"Cancel"}
default button 1 giving up after 120
end tell
end if
end try
end build_distribution
on run
set this_item to (choose folder)
my build_distribution(this_item)
end run
It seams that the folder oiginals is created but not used.
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi
27 juillet 2018 14:47:31
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden