Jump to content
Sign in to follow this  
tonyrocks

Screen Capture Browser Window Only

Recommended Posts

I'm having a blast capturing images of IE using AutoIT.

_ScreenCapture_Capture("C:\blap\" & $alarmName)

 However I only want to capture just the browser window...not a region, not the whole screen (which includes my Windows start menu and other icons).  Is there some switch that says only capture immediate window?

Thanks!

-Tony

Share this post


Link to post
Share on other sites

_ScreenCapture_CaptureWnd
#include <ScreenCapture.au3>

Example()

Func Example()
    Local $hGUI

    ; Create GUI
    $hGUI = GUICreate("Screen Capture", 400, 300)
    GUISetState(@SW_SHOW)
    Sleep(250)

    ; Capture window
    _ScreenCapture_CaptureWnd(@MyDocumentsDir & "\GDIPlus_Image.jpg", $hGUI)

    ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg")
EndFunc   ;==>Example

Edited by Autolaser

Share this post


Link to post
Share on other sites

this is subetley become more clear to me 

Im trying to accomplish the same thing and have a slight issue with defining the window I want to use

I thought it might work the same as controlclick where I could define $handle as the destination but I think my application is incorrect

I understand the basis of what this script is doing but when I look at the page this is posted as an example for it itemized and explains everything except the entire gui function

so basically the changes I made

insert a variable definition to be used as a target for the screen capture

changed the function name to screencap

set the save path to d:\test\test

changed what I thought was optional coords

 

I get an error regarding line 18

$handle = WinGetHandle( "Test" )

Sceencap()

Func Screencap()
    Local $hGUI

    ; Create GUI
    $hGUI = GUICreate("Screen Capture", , )
    GUISetState(@SW_SHOW)
    Sleep(250)

    ; Capture window
    _ScreenCapture_CaptureWnd(D:\test\test.bmp, $handle)

    ShellExecute(D:\test\test.bmp")
EndFunc   ;==>Example

Share this post


Link to post
Share on other sites

I'm not sure what error you're getting, but you're missing several quote marks around your strings.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

ok by my logic which is not very fluent this should 

include screen cap

get a variable $handle

insert that variable as a destination window for screencapture

and save the capture to d:\test\test.bmp

 

 

#include <ScreenCapture.au3>

$handle = WinGetHandle( "test1" )

_ScreenCapture_CaptureWnd("d:\test\test.bmp", "$handle")

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  

×
×
  • Create New...