Hello,
I have a workflow that takes all the files from a directory and any within subdirectories, then moves them. The files are filtered, then moved. But, as you can see my filter picks up three files but only moves two. This must be because it can't move two files with the same name into the one destination (I assume). I want to stop/end the workflow if this happens, unfortunately renaming or adding a number to any duplicates is not an option due to their filename linkages within other applications.
I've added an AppleScript step now which prompts me if their are duplicates found:
How can I end/stop/kill a running workflow from the AppleScript step? Ideally that would happen when the user hits "Okay" on the existing alert dialog.
I am testing as a .workflow file. But this will eventually become an application once ready.
Thanks!
I have a workflow that takes all the files from a directory and any within subdirectories, then moves them. The files are filtered, then moved. But, as you can see my filter picks up three files but only moves two. This must be because it can't move two files with the same name into the one destination (I assume). I want to stop/end the workflow if this happens, unfortunately renaming or adding a number to any duplicates is not an option due to their filename linkages within other applications.
I've added an AppleScript step now which prompts me if their are duplicates found:
Code:
on run {input, parameters}
set nameList to {}
repeat with i from 1 to count input
try
set thisItem to item i in input
set thisItemsInfo to info for thisItem
set thisItemsFileName to name in thisItemsInfo
if thisItemsFileName is in nameList then
set theAlertText to thisItemsFileName
set theAlertMessage to "To stop overwriting files, the job was cancelled. This is because atleast two files with the same filename were found throughout the selected folder and it's subfolders."
display alert theAlertText message theAlertMessage
end if
copy thisItemsFileName to the end of the nameList
end try
end repeat
end run
How can I end/stop/kill a running workflow from the AppleScript step? Ideally that would happen when the user hits "Okay" on the existing alert dialog.
I am testing as a .workflow file. But this will eventually become an application once ready.
Thanks!