I can’t solve this problem:
several files are coming from computer A to one folder at computer B and using “on adding folder files…” command, I want to display one dialog box.
But, because there are several files coming into the folder, the “trigger” (adding folders) repeats several times, so several dialog boxes appears.
Resemble a behavior described some times ago in ASUsersList.
Some dropped files had the Quarantine bit set others hadn’t so the script received two separated groups of files.
Shane STANLEY gave a script getting rid of that.
Here it is :
# Must be saved in a stay-open applet
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
property filesToOpen : {}
on open fileList
set my filesToOpen to my filesToOpen & fileList
-- cancel any pending performSelector: requests
current application's NSObject's cancelPreviousPerformRequestsWithTarget:me
-- handle files after a short delay in case further events are received
tell me to performSelector:"doOpen" withObject:(missing value) afterDelay:0.5
end open
on doOpen()
copy my filesToOpen to fileList
set my filesToOpen to {} -- reset for next time
set aRes to length of fileList
display dialog aRes as string
repeat with i in fileList
set j to POSIX path of i
display dialog j
end repeat
tell me to quit
end doOpen
on quit
continue quit
end quit
Yvan KOENIG running Sierra 10.12.3 in French (VALLAURIS, France) jeudi 23 mars 2017 11:15:04