Is it possible to write a script to capture images for you

I want to create a function that takes in some parameters and then in the function change the viewer window to capture mode take a picture and store it in the images folder for a certain suite and keep cycling through for different pictures.

The reason for this is to limit me from having to manually go through and take 50 pictures at once when the capture area is never changing. Not sure if it is possible and haven’t found any information on it.

Sure, you can do this. As I understand it, the parameters you’re passing are things that will change the appearance of the application, not the dimensions of the capture rectangle, so I’m going to base my example on that assumption. Here’s what the code would look like:

put the folder of my folder into suiteFolder
put "Images/" after suiteFolder
set the directory to suiteFolder

set the worddelimiter to tab
repeat with each line of file "/path/to/my/datafile.txt"
	doSomething word 1 of it, word 2 of it, repeatIndex
end repeat

to doSomething text1, text2, count
	click "textField1"
	typetext text1, tab, text2
	click "submit"
	captureScreen(Name:"myPict" & count, rectangle: ((100,100),(200,200)))
end doSomething

Having provided this example, I’m going to ask if what is changing on the screen is text? And if so, do you know what the text values are going to be? If the answer to both of these questions is yes, then what you really want to do is use the text image generation feature. Add a column of output values to the text file that provides your data and you can submit inputs and check output with code like the following:


repeat with each line of file "/path/to/my/datafile.txt"
	click "textField1"
	typetext word 1 of it, tab, word 2 of it
	click "submit"
	if not imageFound((Text:word 3 of it, TextFont:"Geneva", TextPlatform:"MacOSX_10.5", TextSize:"10", Bold:"Yes")) then
		LogError "wrong output"
	end if
end repeat

Of course, both examples would need to be customized for your specific situation. I hope this is helpful.

Changed the code around a bit and worked great thanks.