k12k08 Posted July 30, 2012 Share Posted July 30, 2012 (edited) Hi, I am trying to capture this document, I can browse through the pages on the document with left and right arrow keys on my keyboard. Since I can not rip it directly, I want to to screen capture it and then save it. However it is around 900 pages! So doing it manually would be very cumbersome. The end result I want is to load up the script takes a picture of the site, automatically saves it and the press right on the keyboard, screen capture again, automatically save it.....rinse and repeat and after 900 times the "right key" has been pressed it would stop. I stole a script from a site and tried editing however I am still a novice on autoit, can someone modify my script to point me to the right direction? TIA! expandcollapse popupHotKeySet ( "{F10}", "DID_CLICK" ) HotKeySet ( "{F11}", "CLOSE" ) TraySetToolTip("Mr.Numbers Quick Screen Shot") Opt("TrayMenuMode",1) $JPEG_ITEM = TrayCreateItem("JPEG") TrayCreateItem("") $EXIT_ITEM = TrayCreateItem("Exit") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Welcome to Mr.Numbers quick screen shot tool! Using this tool, you can take quick screenshots!") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Please tell me where to save your files!") $WINDOWSPATH = FileSelectFolder ( "Choose A Folder", "" , 1 ) If $WINDOWSPATH = "" Then Exit 0 Endif MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Press OK to start your screen capturing! Simply press F10! (Your clipboard will be erased)") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Edit the DATA.INI File to change the desired file format") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Press F11 to close this program") $NUMBER = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "NUMBER", "x") If $NUMBER = "X" Then IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "NUMBER", "1") IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") IniWrite( $WINDOWSPATH & "DATA.INI", "COMMENTS", "DIFFERENT FILE TYPES", "JPEG, PNG, BMP") $NUMBER = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "NUMBER", "") $FILETYPE = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "FILETYPE", "JPEG") EndIf TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $JPEG_ITEM IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") Case $msg = $PNG_ITEM IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "PNG") Case $msg = $BMP_ITEM IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "BMP") Case $msg = $EXIT_ITEM ExitLoop EndSelect WEnd Func DID_CLICK() $NUMBER = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "NUMBER", "x") $FILETYPE = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "FILETYPE", "JPEG") Send("{PRINTSCREEN}") Run( "mspaint.exe" ) WinWaitActive("Untitled - Paint") Send("^v") WinClose("Untitled - Paint") WinWaitActive( "Paint") Send("s") WinWaitActive( "Save As" ) Send($WINDOWSPATH & "" & $NUMBER) If $FILETYPE = "JPEG" Then Send("{Enter}") Send("{Right}") INIWrite( $WINDOWSPATH & "DATA.INI", "INI", "NUMBER", $NUMBER + 1) EndFunc Func CLOSE() Exit 0 EndFunc Edited July 30, 2012 by k12k08 Link to comment Share on other sites More sharing options...
JohnOne Posted July 30, 2012 Share Posted July 30, 2012 Looks like the only editing you did was, replacing this...68.Elseif $FILETYPE = "PNG" Then69.Send("{TAB}")70.Send("p")71.Send("{ENTER}")72.Elseif $FILETYPE = "BMP" Then73.Send("{TAB}")74.Send("{DOWN}")75.Send("{UP}")76.Send("{ENTER}")77.Send("{ENTER}")78.Endifwith this....Send("{Right}")You will notice you forgot to replace the EndIf.Anyway, you should replace the code in the function fromSend("{PRINTSCREEN}")toSend("{Enter}")With _ScreenCaptureCapture function <- helpfileand loop it 900 times. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
k12k08 Posted July 30, 2012 Author Share Posted July 30, 2012 Looks like the only editing you did was, replacing this... 68.Elseif $FILETYPE = "PNG" Then 69.Send("{TAB}")70.Send("p")71.Send("{ENTER}")72.Elseif $FILETYPE = "BMP" Then73.Send("{TAB}")74.Send("{DOWN}")75.Send("{UP}")76.Send("{ENTER}")77.Send("{ENTER}")78.Endif with this.... Send("{Right}") You will notice you forgot to replace the EndIf.Anyway, you should replace the code in the function from Send("{PRINTSCREEN}") to Send("{Enter}") With _ScreenCaptureCapture function <- helpfile and loop it 900 times. Okay I re modified the code and I now have: expandcollapse popupHotKeySet ( "{F10}", "DID_CLICK" ) HotKeySet ( "{F11}", "CLOSE" ) TraySetToolTip("Mr.Numbers Quick Screen Shot") Opt("TrayMenuMode",1) $JPEG_ITEM = TrayCreateItem("JPEG") TrayCreateItem("") $EXIT_ITEM = TrayCreateItem("Exit") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Welcome to Mr.Numbers quick screen shot tool! Using this tool, you can take quick screenshots!") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Please tell me where to save your files!") $WINDOWSPATH = FileSelectFolder ( "Choose A Folder", "" , 1 ) If $WINDOWSPATH = "" Then Exit 0 Endif MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Press OK to start your screen capturing! Simply press F10! (Your clipboard will be erased)") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Edit the DATA.INI File to change the desired file format") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Press F11 to close this program") $NUMBER = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "NUMBER", "x") If $NUMBER = "X" Then IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "NUMBER", "1") IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") IniWrite( $WINDOWSPATH & "DATA.INI", "COMMENTS", "DIFFERENT FILE TYPES", "JPEG, PNG, BMP") $NUMBER = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "NUMBER", "") $FILETYPE = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "FILETYPE", "JPEG") EndIf TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $JPEG_ITEM IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") Case $msg = $PNG_ITEM IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "PNG") Case $msg = $BMP_ITEM IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "BMP") Case $msg = $EXIT_ITEM ExitLoop EndSelect WEnd Func DID_CLICK() $NUMBER = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "NUMBER", "x") $FILETYPE = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "FILETYPE", "JPEG") Local $p = Send("{Right}") Send("{Right}") = 1 Do _ScreenCapture_Capture(@MyDocumentsDir & "GDIPlus_Image1.jpg") Sleep(25000) Send("{Right}") $p = $p + 1 Until $p = 900 INIWrite( $WINDOWSPATH & "DATA.INI", "INI", "NUMBER", $NUMBER + 1) EndFunc Func CLOSE() Exit 0 EndFunc Yet it still is not working. Link to comment Share on other sites More sharing options...
JohnOne Posted July 30, 2012 Share Posted July 30, 2012 (edited) Try this Func DID_CLICK() $NUMBER = IniRead($WINDOWSPATH & "DATA.INI", "INI", "NUMBER", "x") $FILETYPE = IniRead($WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") Local $p = 1 Do _ScreenCapture_Capture(@MyDocumentsDir & "GDIPlus_Image" & $p & ".jpg") Sleep(25000) Send("{Right}") $p += 1 Until $p = 900 IniWrite($WINDOWSPATH & "DATA.INI", "INI", "NUMBER", $NUMBER + 1) EndFunc ;==>DID_CLICK EDIT: Also be sure to add #include at top of code Edited July 30, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
k12k08 Posted July 30, 2012 Author Share Posted July 30, 2012 Try this Func DID_CLICK() $NUMBER = IniRead($WINDOWSPATH & "DATA.INI", "INI", "NUMBER", "x") $FILETYPE = IniRead($WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") Local $p = 1 Do _ScreenCapture_Capture(@MyDocumentsDir & "GDIPlus_Image" & $p & ".jpg") Sleep(25000) Send("{Right}") $p += 1 Until $p = 900 IniWrite($WINDOWSPATH & "DATA.INI", "INI", "NUMBER", $NUMBER + 1) EndFunc ;==>DID_CLICK EDIT: Also be sure to add #include at top of code Hi, I just want to clarify the "#include" partTry this Func DID_CLICK() $NUMBER = IniRead($WINDOWSPATH & "DATA.INI", "INI", "NUMBER", "x") $FILETYPE = IniRead($WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") Local $p = 1 Do _ScreenCapture_Capture(@MyDocumentsDir & "GDIPlus_Image" & $p & ".jpg") Sleep(25000) Send("{Right}") $p += 1 Until $p = 900 IniWrite($WINDOWSPATH & "DATA.INI", "INI", "NUMBER", $NUMBER + 1) EndFunc ;==>DID_CLICK EDIT: Also be sure to add #include at top of code I want to thank you for all the help you have given to me, I made the new script and it does not give me error opening it however it does not saves the picture mind looking over it again? expandcollapse popupHotKeySet ( "{F10}", "DID_CLICK" ) HotKeySet ( "{F11}", "CLOSE" ) TraySetToolTip("Mr.Numbers Quick Screen Shot") Opt("TrayMenuMode",1) $JPEG_ITEM = TrayCreateItem("JPEG") TrayCreateItem("") $PNG_ITEM = TrayCreateItem("PNG") TrayCreateItem("") $BMP_ITEM = TrayCreateItem("BMP") TrayCreateItem("") $EXIT_ITEM = TrayCreateItem("Exit") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Welcome to Mr.Numbers quick screen shot tool! Using this tool, you can take quick screenshots!") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Please tell me where to save your files!") $WINDOWSPATH = FileSelectFolder ( "Choose A Folder", "" , 1 ) If $WINDOWSPATH = "" Then Exit 0 Endif MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Press OK to start your screen capturing! Simply press F10! (Your clipboard will be erased)") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Edit the DATA.INI File to change the desired file format") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Press F11 to close this program") $NUMBER = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "NUMBER", "x") If $NUMBER = "X" Then IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "NUMBER", "1") IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") IniWrite( $WINDOWSPATH & "DATA.INI", "COMMENTS", "DIFFERENT FILE TYPES", "JPEG, PNG, BMP") $NUMBER = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "NUMBER", "") $FILETYPE = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "FILETYPE", "JPEG") EndIf TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $JPEG_ITEM IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") Case $msg = $PNG_ITEM IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "PNG") Case $msg = $BMP_ITEM IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "BMP") Case $msg = $EXIT_ITEM ExitLoop EndSelect WEnd #include "C:\Program Files (x86)\AutoIt3\Include\ScreenCapture.au3" Func DID_CLICK() $NUMBER = IniRead($WINDOWSPATH & "DATA.INI", "INI", "NUMBER", "x") $FILETYPE = IniRead($WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") Local $p = 1 Do _ScreenCapture_Capture(@MyDocumentsDir & "GDIPlus_Image" & $p & ".jpg") Sleep(50) Send("{Right}") $p += 1 Until $p = 2 IniWrite($WINDOWSPATH & "DATA.INI", "INI", "NUMBER", $NUMBER + 1) EndFunc ;==>DID_CLICK Func CLOSE() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
JohnOne Posted July 30, 2012 Share Posted July 30, 2012 (edited) You are starting it with the F10 key? expandcollapse popup#include <ScreenCapture.au3> HotKeySet ( "{F10}", "DID_CLICK" ) HotKeySet ( "{F11}", "CLOSE" ) TraySetToolTip("Mr.Numbers Quick Screen Shot") Opt("TrayMenuMode",1) $JPEG_ITEM = TrayCreateItem("JPEG") TrayCreateItem("") $PNG_ITEM = TrayCreateItem("PNG") TrayCreateItem("") $BMP_ITEM = TrayCreateItem("BMP") TrayCreateItem("") $EXIT_ITEM = TrayCreateItem("Exit") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Welcome to Mr.Numbers quick screen shot tool! Using this tool, you can take quick screenshots!") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Please tell me where to save your files!") $WINDOWSPATH = FileSelectFolder ( "Choose A Folder", "" , 1 ) If $WINDOWSPATH = "" Then Exit 0 Endif MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Press OK to start your screen capturing! Simply press F10! (Your clipboard will be erased)") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Edit the DATA.INI File to change the desired file format") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Press F11 to close this program") $NUMBER = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "NUMBER", "x") If $NUMBER = "X" Then IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "NUMBER", "1") IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") IniWrite( $WINDOWSPATH & "DATA.INI", "COMMENTS", "DIFFERENT FILE TYPES", "JPEG, PNG, BMP") $NUMBER = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "NUMBER", "") $FILETYPE = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "FILETYPE", "JPEG") EndIf TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $JPEG_ITEM IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") Case $msg = $PNG_ITEM IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "PNG") Case $msg = $BMP_ITEM IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "BMP") Case $msg = $EXIT_ITEM ExitLoop EndSelect WEnd Func DID_CLICK() $Filename = "" $NUMBER = IniRead($WINDOWSPATH & "DATA.INI", "INI", "NUMBER", "x") $FILETYPE = IniRead($WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") Local $p = 1 Do $Filename = @MyDocumentsDir & "GDIPlus_Image" & $p & ".jpg" _ScreenCapture_Capture($Filename) Sleep(50) Send("{Right}") $p += 1 Until $p = 2 IniWrite($WINDOWSPATH & "DATA.INI", "INI", "NUMBER", $NUMBER + 1) EndFunc ;==>DID_CLICK Func CLOSE() Exit 0 EndFunc Edited July 30, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
k12k08 Posted July 30, 2012 Author Share Posted July 30, 2012 You are starting it with the F10 key? expandcollapse popup#include <ScreenCapture.au3> HotKeySet ( "{F10}", "DID_CLICK" ) HotKeySet ( "{F11}", "CLOSE" ) TraySetToolTip("Mr.Numbers Quick Screen Shot") Opt("TrayMenuMode",1) $JPEG_ITEM = TrayCreateItem("JPEG") TrayCreateItem("") $PNG_ITEM = TrayCreateItem("PNG") TrayCreateItem("") $BMP_ITEM = TrayCreateItem("BMP") TrayCreateItem("") $EXIT_ITEM = TrayCreateItem("Exit") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Welcome to Mr.Numbers quick screen shot tool! Using this tool, you can take quick screenshots!") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Please tell me where to save your files!") $WINDOWSPATH = FileSelectFolder ( "Choose A Folder", "" , 1 ) If $WINDOWSPATH = "" Then Exit 0 Endif MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Press OK to start your screen capturing! Simply press F10! (Your clipboard will be erased)") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Edit the DATA.INI File to change the desired file format") MsgBox( 0, "Mr.Numbers Quick Screen Shot", "Press F11 to close this program") $NUMBER = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "NUMBER", "x") If $NUMBER = "X" Then IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "NUMBER", "1") IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") IniWrite( $WINDOWSPATH & "DATA.INI", "COMMENTS", "DIFFERENT FILE TYPES", "JPEG, PNG, BMP") $NUMBER = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "NUMBER", "") $FILETYPE = IniRead( $WINDOWSPATH & "" & "DATA.INI", "INI", "FILETYPE", "JPEG") EndIf TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $JPEG_ITEM IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") Case $msg = $PNG_ITEM IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "PNG") Case $msg = $BMP_ITEM IniWrite( $WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "BMP") Case $msg = $EXIT_ITEM ExitLoop EndSelect WEnd Func DID_CLICK() $Filename = "" $NUMBER = IniRead($WINDOWSPATH & "DATA.INI", "INI", "NUMBER", "x") $FILETYPE = IniRead($WINDOWSPATH & "DATA.INI", "INI", "FILETYPE", "JPEG") Local $p = 1 Do $Filename = @MyDocumentsDir & "GDIPlus_Image" & $p & ".jpg" _ScreenCapture_Capture($Filename) Sleep(50) Send("{Right}") $p += 1 Until $p = 2 IniWrite($WINDOWSPATH & "DATA.INI", "INI", "NUMBER", $NUMBER + 1) EndFunc ;==>DID_CLICK Func CLOSE() Exit 0 EndFunc Yes I am, is it possible I need to edit data.ini before hand? It closes just fine but does not save the picture :/ Link to comment Share on other sites More sharing options...
JohnOne Posted July 30, 2012 Share Posted July 30, 2012 Try running it with admin add #RequireAdmin Anywhere in script AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
k12k08 Posted July 30, 2012 Author Share Posted July 30, 2012 Try running it with adminadd#RequireAdminAnywhere in scriptYes i am, I wonder what is going wrong? Link to comment Share on other sites More sharing options...
JohnOne Posted July 30, 2012 Share Posted July 30, 2012 Try using a different hotkey AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
k12k08 Posted July 31, 2012 Author Share Posted July 31, 2012 (edited) Try using a different hotkeythat worked thanks Edited July 31, 2012 by k12k08 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now