Sign in to follow this  
Followers 0
k12k08

auto saving screen capture

11 posts in this topic

#1 ·  Posted (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!

HotKeySet ( "{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 by k12k08

Share this post


Link to post
Share on other sites



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" Then

73.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.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

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" Then

73.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:

HotKeySet ( "{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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

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" part

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

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?

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

#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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

You are starting it with the F10 key?

#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 by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

You are starting it with the F10 key?

#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 :/

Share this post


Link to post
Share on other sites

Try running it with admin

add

#RequireAdmin

Anywhere in script

Yes i am, I wonder what is going wrong?

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Try using a different hotkey

that worked thanks :P

Edited by k12k08

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0