Stuck Script

hi I have the following script…

on adding folder items to StartFolder after receiving these_items
	
	tell application "Adobe Photoshop CS"
		do action "ContactSheet" from "TestSet"
	end tell
	set ContactSheet to 1
	tell application "Adobe Photoshop CS"
		repeat until ContactSheet is 0
			do action "FlattenSaveClose" from "TestSet"
			if (count (open documents)) is 0 then set ContactSheet to 0
		end repeat
	end tell
	tell application "Finder"
		try
			set filesTocopy to every file of StartFolder
			repeat with aFIle in filesTocopy
				move aFIle to folder (alias "Macintosh HD:Users:geoffsmith:Desktop:Jpegs:")
			end repeat
		on error the errormessage number the errornumber
			set the errortext to "Error: " & the errornumber & ". " & the errormessage
			display dialog the errortext & return & ¬
				"Return to Script.... SOMETHINGS MESSED UP!!" buttons {"OK"} default button 1
			return the errortext
		end try
		
		try
			set subFolders to (every folder of StartFolder)
			repeat with aFolder in subFolders
				move aFolder to folder (alias "Macintosh HD:Users:geoffsmith:Desktop:Jpegs:")
			end repeat
		on error the errormessage number the errornumber
			set the errortext to "Error: " & the errornumber & ". " & the errormessage
			display dialog the errortext & return & ¬
				"Return to Script.... SOMETHINGS MESSED UP!!" buttons {"OK"} default button 1
			return the errortext
		end try
	end tell
end adding folder items to

For some reason if put more than 4 files through the script ( 4 would create 2 contact sheets). The script will only work on the last open document.
Yet if i only try it with 4 files they will contactsheet then save and close perfectly.

Can anyone see any errors here?

Thanks

Jax

Model: iBook G4
AppleScript: 1.10.3
Browser: Safari 417.8
Operating System: Mac OS X (10.4)

Hmmm… nothing jumps out at me. Is there any possiblity that the problem lies in the actions?

Hi

I’ve tested the Photoshop actions using the following script…

on adding folder items to StartFolder after receiving these_items
	tell application "Adobe Photoshop CS"
		do action "ContactSheet" from "TestSet"
	end tell
	tell application "Adobe Photoshop CS"
		set ContactSheet to 1
		repeat until ContactSheet = 0
			do action "FlattenSaveClose" from "TestSet"
		end repeat
	end tell
end adding folder items to

This worked fine but the repeat doesnt stop after the last document is closed so it cant go onto the next part of the script.
I think the problem lies somewhere in this part of my original script…

on adding folder items to StartFolder after receiving these_items
   
   tell application "Adobe Photoshop CS"
       do action "ContactSheet" from "TestSet"
   end tell
   set ContactSheet to 1
   tell application "Adobe Photoshop CS"
       repeat until ContactSheet is 0
           do action "FlattenSaveClose" from "TestSet"
           if (count (open documents)) is 0 then set ContactSheet to 0
       end repeat
   end tell

I am completely baffled as to where tho

Any ideas

Thanks
Jax

jax0101,

You do not have a process to change ContactSheet to 0 so the loop continues infinitely.

As for your original problem, have you run the actions out of PS on a variety of files? Are there items that the actions are not working on? It could be an error in the actions as digest4d has suggested.

PreTech

Hi

I used the script…

on adding folder items to StartFolder after receiving these_items
   tell application "Adobe Photoshop CS"
       do action "ContactSheet" from "TestSet"
   end tell
   tell application "Adobe Photoshop CS"
       set ContactSheet to 1
       repeat until ContactSheet = 0
           do action "FlattenSaveClose" from "TestSet"
       end repeat
   end tell
end adding folder items to

to test the PS actions to make sure there wasnt a problem with the actions… i know this scriptwill keep repeating because there is no value to stop it but once i add a value to stop i.e…

on adding folder items to StartFolder after receiving these_items

tell application "Adobe Photoshop CS"
do action "ContactSheet" from "TestSet"
end tell
set ContactSheet to 1
tell application "Adobe Photoshop CS"
repeat until ContactSheet is 0
do action "FlattenSaveClose" from "TestSet"
if (count (open documents)) is 0 then set ContactSheet to 0
end repeat
end tell

The script will not process more than 4 files.
I’ve tried with different files and have the same problem, It runs fine on the 1st script…but wont stop. But it wont create more than 2 contact sheets with 4 files on the 2nd script.

Any ideas?

I’ve fixed the problem now…

on adding folder items to StartFolder
	tell application "Adobe Photoshop CS"
		do action "ContactSheet" from "TestSet"
	end tell
	set ContactSheet to (count (every document))
	tell application "Adobe Photoshop CS"
		repeat until (count (every document)) = 0
			do action "FlattenSaveClose" from "TestSet"
		end repeat
	end tell
end adding folder items to

The problem was in the "(count (open documents)) it should read (count (every document))
Thanks for all your help

Jax