Taking screenshots with opensesame
Hi all!
I would like to be able to save the contents of my sketchpad items as image files (in other words, take a screenshot). I would like this to occur throughout the task automatically. Is this possible? Would I need to use inline script to make this happen?
Thank you!
Sarah
Comments
Hi Sarah,
You should be able to achieve this with an inline script. There are python modules for this, see for instance this page: http://stackoverflow.com/questions/2846947/get-screenshot-on-windows-with-python
I am wondering though; what do you want to use this for? You can also deduce what your trial screen would've looked like by logging all experimental variables and then diving into your logfile. I hope you're not planning to assign data to conditions by means of manually looking at hundreds of screenshots?
Cheers,
Josh
Hi Josh,
Okay thank you! I wanted to use it for exactly that but I thought about it after posting and realized that that wouldn't really work.
Thank you though!
Just as a reference for someone who is really looking for a way to turn canvases into screenshots: A long time ago, I wrote a script that does exactly this (make screenshots from canvases that is). I planned to make it into a plugin, but never got to it. You can find the code at https://github.com/smathot/OpenSesame/issues/318.
Hi,
I would like to know how to use the code above to save a sketchpad item as an image.
I copied and pasted the code into a inline script icon (placed after my sketchpad icon), but the code seems to make a new canvas (with text) and then save this item as the image. I need the image saved to be of the sketchpad I have just made. How do I alter the code to do this?
And how do I alter the code so that the image's filename saves as the name of one of my variables (i.e. I want to set the image name as the name of the original image used in the sketchpad item, save as variable [file_name]). Struggling to do this as filename in the code above is a string, so I'm not sure how to reference a variable here.
Thanks!