Hi all.
I’m realizing an application that has to continuous check a folder for new uploaded files.
When it finds a new file, copies it to a local folder and change the label of the original file to red.
If I type the folder address, all works fine, but I want to choose the folder only when the application starts. If I put the corresponding line into the idle handler, of course it opens the dialog at the beginning of a new cycle.
Otherwise, if I put the corresponding line in a Run handler, the erro is that it doesn’t recognize the variable.
Is there a way to make the window open only one time or to choose automatically the same directory if user doesn’t interact within n seconds?
Thank you in advance for help.
I post here my code
Luigi
on idle
tell application “Finder”
set itemGroup to (every document file of folder “prova” of startup disk)
repeat with x from 1 to count of itemGroup
set groupItem to item x of itemGroup
set labelItem to the label index of groupItem
if labelItem = 2 or labelItem = 6 then
else
tell application "Preview"
print groupItem without dialog
delay 1 * 10
quit
end tell
copy groupItem to folder "arrivo" of startup disk
set the label index of groupItem to 2
set the_file to groupItem
end if
end repeat
end tell
return 2 * 60
end idle