I am trying to make a repeat loop stop when the amount of items of one folder equal the amount of items in another folder. (in this case x)
x in the bottom script was defined earlier in my larger script as:
tell application "Finder"
set theList to files of folder "Illustrations:Users:admin:Desktop:PDF_Franchise_Calls:Files_With_Dot:"
set x to number of items in theList
end tell
I can’t seem to make the below script work. Can anyone explain why?
tell application "Finder"
set OutFolder to alias "Illustrations:Users:admin:Desktop:PDF_Franchise_Calls:Out:"
set upload_folder to alias "Illustrations:Users:admin:Desktop:PDF:"
set wait to true
repeat while wait is true
repeat 10 times
try
duplicate entire contents of OutFolder to folder "Illustrations:Users:admin:Desktop:PDF" with replacing
duplicate entire contents of OutFolder to folder "Illustrations:Users:admin:Desktop:PDF_Franchise_Calls:Backup_PDF_Files" with replacing
end try
set folderCheck to list folder upload_folder without invisibles
if folderCheck = {} then
--display dialog "still repeating"
delay 3
else if folderCheck = x then
set wait to false
display dialog "Your PDF has been created. Check inside the folder on your desktop called 'PDF'." buttons {"OK"} default button 1
return
end if
end repeat
end repeat
end tell