Jump to content

Help Sending F9 Key For Screen Capture


Recommended Posts

I am writing a script to visit internal web pages and capture them.

So Ive decided to use Lazycats' script and dll.

Here is the problem, The script works great (ie. logs onto the site via user/pass, then it gets stuck)

It does not respond to the "coded" F9 send, but it will capture the screen to file if I manually press 'Keyboard' F9, I would like it to AutoCapture after loading the page.

The script just pauses it self and does not seem to finish.

Will setting a hotkey to a 'key' alow it to be activated using Send()?

I also just added (now commented out) a function call to the OnScreenCapture()

but that did not work either.

Here is my code:

Any Help is appreciated! Thanks for the script and dll Lazycat.....

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:       Surphrat 
;
; Script Function:
;   AutoIt script To gather HTTP info from MTA's and SIP phones on local network
;
; ----------------------------------------------------------------------------
;
; Script Start - Add your code below here
HotKeySet("{F9}", "OnScreenShot")
HotKeySet("{ESC}", "Terminate")


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Load Page
;Authenticate user/pass 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Run("C:\Program Files\Internet Explorer\IEXPLORE.exe 196.196.209.9")
WinWaitActive("Login - Microsoft Internet Explorer")
WinSetState("Login - Microsoft Internet Explorer","",@SW_MAXIMIZE)
MouseClick ("left",607,208,2)
Send("admin")
MouseClick("left",620,253,2)
Send("####")
MouseClick("left",628,278)
Sleep(3000)
Send("{F9}")
;Call("OnScreenShot")
Exit




Func OnScreenShot()
    If Not FileExists (@scriptdir & "\screenshots") Then DirCreate (@scriptdir & "\screenshots")
    If Not FileExists(@scriptdir & "\captdll.dll") Then FileInstall( "captdll.dll", @scriptdir & "" ,1)
    Local $Cwin1 = WinGetHandle(""); gets the handle of the active window
    Local $Cwin2 = WinGetPos($Cwin1); gets active window dimensions
    Local $Quality = 85; use -1 to save as BMP or use number between 0 - 100 to save as JPG quality
    If $Quality = -1 Then
        Local $SaveAs = ".bmp"
    Else
        Local $SaveAs = ".jpg"
    EndIf   
    Local $CaptureDirectory = @ScriptDir & "\Screenshots\"; directory uses to store screen caps
    Local $CaptureFile = @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & @MIN & "-" & @SEC & $SaveAs
    DllCall(@scriptdir & "\captdll.dll", "int", "CaptureRegion", "str", $CaptureDirectory & $CaptureFile, "int", $Cwin2[0], "int", $Cwin2[1], "int", $Cwin2[2], "int", $Cwin2[3], "int", $Quality)
    If @error Then MsgBox(262160,"ERROR","The screen was not captured",4)
EndFunc


Func Terminate()
    Exit
EndFunc
Link to comment
Share on other sites

Ok well i kinda figured it out....

The problem was, after the first time 'logging' onto the site it would stay logged in and when i re-ran the script it would watch for the "login title" of the page before continuing, well this was the problem when the browser remebered me and brought me right to the page to be captured, but the control was still waiting to login!

So no big deal....in the realworld application of this app the modem will not have been logged into! thanks....to myslef, for being so bright at 9am.

Link to comment
Share on other sites

Ok well i kinda figured it out....

The problem was, after the first time 'logging' onto the site it would stay logged in and when i re-ran the script it would watch for the "login title" of the page before continuing, well this was the problem when the browser remebered me and brought me right to the page to be captured, but the control was still waiting to login!

So no big deal....in the realworld application of this app the modem will not have been logged into! thanks....to myslef, for being so bright at 9am.

Can you not use Run("C:\Program Files\Internet Explorer\IEXPLORE.exe Admin:####@196.196.209.9")

so it just goes straight in and skip most of the first part anyway?

Edited by ChrisL
Link to comment
Share on other sites

Can you not use Run("C:\Program Files\Internet Explorer\IEXPLORE.exe Admin:####@196.196.209.9")

so it just goes straight in and skip most of the first part anyway?

yes that did work 90% of the time, but some ofthe modems did not respond well to that

testing about 8 different brands and models right now.

thanks again!

Link to comment
Share on other sites

thanks....to myslef, for being so bright at 9am.

I am at my brightest when at the Bar!

Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...