So I’m trying to write a script/folder action that’ll watch a folder until x amount of files drop in, then it’ll run the next part (PDF files dropping in, then when x amount of PDFs are made, make in to 1 PDF, where x is defined from another script processing docs)
So far, the script works if I replace ‘PDFCount’ with an actual number. I just can’t get it to read the text file as the input number, instead of a number I enter. The dialogs are just until I can get a result I want, so that’ll change later when it progresses past this hurdle. Inside the text file is just simply a digit, so 4 for example, nothing else.
set fileCount to read file ("Megatron:Users:kit:Desktop:File count.txt")
set PDFCount to "" & fileCount & ""
tell application "Finder"
	
	repeat count (folder "4")'s files times
		count files of entire contents of (folder "4")
		if the result = PDFCount then
			display dialog "And it's off!"
		else
			delay 3
			display dialog "counting down"
			
		end if
	end repeat
end tell
For fyi, the script that makes the text file is (after this part is done, it continues on to move files one by one from one folder to another until the folder is empty);
tell application "Finder"
	
	set the FileNumber to (number of files in folder "1")
	set FileText to "" & FileNumber & ""
	
	tell application "TextEdit"
		make new document
		
		set the text of the front document to FileText
		save document "Untitled" in file "Megatron:Users:kit:Desktop:File count.txt"
		quit saving no
	end tell
end tell