Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Auto screen capture script


  • Please log in to reply
6 replies to this topic
homamk
  • Members
  • 7 posts
  • Last active: Apr 27 2011 06:08 AM
  • Joined: 19 Sep 2010
i wanted to write a script to capture a specific region then click or send a keystroke then capture another screen shot for the same region for n number of times.

So the user assigns an active window, and N for the number of times he wants the screen shot THEN keystroke to happen.

for example: i have a 400 page ebook, i want the script to snap a screen shot of the page's region, then send keystroke {down} then capture the screen 400 times.

I was trying to use Easy Copy AHK located http://www.autohotke...5273&highlight= but i was not able to use it the way i wanted.

So i wrote my incredibly simple AHK script and named it Auto screen capture AHK.

main features are:

*capture specific pre-defined regions automatically (or the whole desktop)
*Dual monitor support
*can run automatic keystroke with each screen capture

all the heavy lifting is done by greenshot http://getgreenshot.org/ my script just executes the hotkeys.

so in order to use this script follow these simple steps:

step 1: download and install greenshot.

step 2: go to greenshot -> preferences then the output tab, uncheck everything and check the save directly option. then manage the settings below to your liking.

step 3: hit the print screen key on your keyboard to define your region

step 4: get the auto capture script and edit the loop number for however many times you need it to run (for example number of pages in a document)

step 5: run the script

step 6: go to your ebook reader or whatever program you want and hit "Ctrl+ALT+R"

the script will run for as many times as you specified in the loop. your output will be in the folder you selected from the greenshot preferences

note that the assigned keystore after each screen capture is {down}, you can change it to whatever depending on your program (like {right} or {enter}...)

so here is Auto screen capture AHK, the simple code to use with greenshot:

^!R::				; CTRL+ALT+R to run the script


	loop 400	; keep going for n number of times in this case 400 times
    {  
	Send +{Printscreen}	;keystroke [shift]+[PrintScreen]
	SetKeyDelay, 1500	; delay for 1.5 seconds
	Send {down}		; keystroke down
	SetKeyDelay, 1500	; delay for 1.5 seconds
	
    }
return

tags for google and searching: screen, screen capture, automatic screen capture, screen print, screen region, select region, region, keystorke print, auto, auto capture, screenshot, shot, auto screenshot

x79animal
  • Members
  • 1021 posts
  • Last active: May 14 2013 04:21 PM
  • Joined: 01 May 2010
^!R::            ; CTRL+ALT+R to run the script
   loop 400   ; keep going for n number of times in this case 400 times
    { 
   Send +{Printscreen}   ;keystroke [shift]+[PrintScreen]
   [color=red]Sleep[/color] 1500   ; delay for 1.5 seconds
   Send {down}      ; keystroke down
   [color=red]Sleep[/color] 1500   ; delay for 1.5 seconds   
    }
return

why not this?

homamk
  • Members
  • 7 posts
  • Last active: Apr 27 2011 06:08 AM
  • Joined: 19 Sep 2010

^!R::            ; CTRL+ALT+R to run the script
   loop 400   ; keep going for n number of times in this case 400 times
    { 
   Send +{Printscreen}   ;keystroke [shift]+[PrintScreen]
   [color=red]Sleep[/color] 1500   ; delay for 1.5 seconds
   Send {down}      ; keystroke down
   [color=red]Sleep[/color] 1500   ; delay for 1.5 seconds   
    }
return

why not this?


won't it accomplish the same thing though? how would it differ by using sleep?

x79animal
  • Members
  • 1021 posts
  • Last active: May 14 2013 04:21 PM
  • Joined: 01 May 2010

won't it accomplish the same thing though?


yeah it will but it makes more sense to sleep rather than use setkeydelay, also its worth noteing that you only need to state it once, like so

^!R::            ; CTRL+ALT+R to run the script
   SetKeyDelay, 1500 
   loop 400   ; keep going for n number of times in this case 400 times
    { 
   Send +{Printscreen}
   Send {down}   
    }
return


homamk
  • Members
  • 7 posts
  • Last active: Apr 27 2011 06:08 AM
  • Joined: 19 Sep 2010
can you use sleep in the same way you used setkeydelay? (once at the top) if you can't then isn't it better to just use setkeydelay?

i might read up more on writing scripts and make the user input the loop cycles and hot key through a msg box.

maxxhi2010
  • Guests
  • Last active:
  • Joined: --
How do u edit the script?? :?:

pastalover
  • Members
  • 1 posts
  • Last active: Oct 01 2014 09:46 PM
  • Joined: 05 Sep 2014

Glorious script

I encountered a local issue, which can be solved relatively easy. I was trying to capture an ebook on a flash player (yes, I don't know what they were thinking). My screen was a bit too small so I changed the display using ctrl + alt + {arrow key}. Run the script, and everything works smoothly. Thank you friend