Is this a sandboxing problem (file duplication to a new folder)?
Is this a sandboxing problem (file duplication to a new folder)?
- Subject: Is this a sandboxing problem (file duplication to a new folder)?
- From: Laine Lee <email@hidden>
- Date: Thu, 26 Jul 2018 18:24:08 -0500
- Thread-topic: Is this a sandboxing problem (file duplication to a new folder)?
I’m using the latest High Sierra to date. I adapted one of the old standard
folder action scripts to make this. Put at least one file with name extension
“rtf” in a folder and run this script on it (drop or select the folder on run).
Why does it time out without duplicating a file? Is it breaking a sandboxing
rule? Thanks.
----
property done_foldername : "done"
property originals_foldername : "originals"
property extension_list : {"rtf"}
on open these_items
my build_distribution(these_items)
end open
on build_distribution(these_items)
set this_folder to these_items as string
tell application "Finder"
if not (exists folder of folder (this_folder & done_foldername)) then
make new folder at this_folder with properties {name:done_foldername}
end if
if not (exists folder of folder (this_folder & originals_foldername)) 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 (this_folder & originals_foldername) 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_foldername --with replacing
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 these_items to ((choose folder) as list)
build_distribution(these_items)
end run
Laine Lee
_______________________________________________
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