Indesign: select frames by content - unlock - group all but.....

I have a script to set text frames to nonprinting, unlock the text frames, group the text frames, move thegroup, and export pfd
I could use some help to edit the script with the following:

if a frame contains a certain image (name) set nonprinting true
if a frame contains a certain filling (PANTONE) set nonprinting true
if frames( text and graphics) are locked - unlock
group all frames ( text and graphics) except frames with a certain image and a certain filling
move this group to…

It would also be nice if the script could move all docs to the subfolder “Oud” after Indesign has processed these docs

The script:

set processFolder to choose folder with prompt "Kies een folder met Indd Docs"
tell application "Finder"
	if not (exists folder "Nieuw" of processFolder) then
		make new folder at processFolder with properties {name:"Nieuw"}
	end if
	if not (exists folder "Oud" of processFolder) then
		make new folder at processFolder with properties {name:"Oud"}
	end if
	if not (exists folder "PDF" of processFolder) then
		make new folder at processFolder with properties {name:"PDF"}
	end if
	if not (exists folder "Error" of processFolder) then
		make new folder at processFolder with properties {name:"Error"}
	end if
	set the destination1_folder to folder "Nieuw" of processFolder as alias
	set the destination2_folder to folder "Oud" of processFolder as alias
	set the destination3_folder to folder "PDF" of processFolder as alias
	set the destination4_folder to folder "Error" of processFolder as alias
end tell

tell application "Finder"
	try
		set listFiles to (files of contents of processFolder) as alias list
	on error
		set listFiles to (files of contents of processFolder) as alias as list
	end try
	repeat with thisFile in listFiles
		
		
		tell application "Adobe InDesign CS3"
			with timeout of 120 seconds
				activate
				open thisFile
				set myDoc to document 1
				tell myDoc
					try
						set properties of view preferences to {horizontal measurement units:millimeters, vertical measurement units:millimeters, ruler origin:page origin}
						set docName to name
						set transform reference point of layout window 1 to top left anchor
						set nonprinting of all graphics to true
						set locked of every text frame to false
						set myBox to every text frame of page 1
						if (count myBox) > 1 then
							set theGroup to (make group at page 1 with properties {group items:every text frame of page 1})
							move theGroup to {8, 10}
						else
							move myBox to {8, 10}
						end if
					on error the error_message number the error_number
						tell application "Finder" to move thisFile to destination4_folder with replacing
						display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
					end try
				end tell
				
				export document 1 format PDF type to (destination3_folder as string) & docName & ".pdf" using PDF export preset "[PDF/X-1a:2001]" without showing options
				save document 1 to (destination1_folder as string) & docName
				close document 1 saving yes
				
				--tell application "Finder" to move thisFile to destination2_folder with replacing
			end timeout
		end tell
	end repeat
end tell
end
end

Any help is greatly appreciated !

–Peter–