Jump to content

Recommended Posts

Posted

Here's a quick ditty to show how this can be done. This will launch the RDP session for you and take a screen shot every X seconds:

#include <GUIConstants.au3>
#include <A3LIPAddress.au3>
#include <A3LScreenCap.au3>

Opt("MustDeclareVars"  , 1)
Opt("WinTitleMatchMode", 2)

Global $hGUI, $iLabel1, $iLabel2, $iSeconds, $hIP, $iOK, $bPaused

; Create GUI
$hGUI     = GUICreate("RDP Screen Capture", 280, 112, -1, -1, $WS_SIZEBOX)
$iLabel1  = GUICtrlCreateLabel ("Seconds between captures:", 4, 12, 140, 20, $SS_RIGHT)
$iLabel2  = GUICtrlCreateLabel ("Remote IP Address:"       , 4, 34, 140, 20, $SS_RIGHT)
$iSeconds = GUICtrlCreateInput ("1"  , 146,  8,  60, 20)
$hIP      = _IPAddress_Create  ($hGUI, 146, 30, 125, 20)
$iOK      = GUICtrlCreateButton("OK" , 100, 54,  75, 25)
HotKeySet("{PAUSE}", "Pause")
GUISetState()

; Message loop
while 1
  Switch GUIGetMsg()
    case $iOK
      Run("mstsc.exe /v:" & _IPAddress_GetAddressStr($hIP) & " /console")
      AdlibEnable("ScreenShot", 1000 * GUICtrlRead($iSeconds))
    case $GUI_EVENT_CLOSE
      Exit
  EndSwitch
wend

; Take a screen shot
Func ScreenShot()
  if $bPaused or not WinExists(_IPAddress_GetAddressStr($hIP)) then Return
  WinActivate(_IPAddress_GetAddressStr($hIP))
  _ScreenCap_CaptureWnd(@HOUR & @SEC & ".jpg", WinGetHandle(_IPAddress_GetAddressStr($hIP)), False)
EndFunc

; Pause/Unpause script
Func Pause()
  $bPaused = not $bPaused
EndFunc
Auto3Lib: A library of over 1200 functions for AutoIt

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
  • Recently Browsing   0 members

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