Sign in to follow this  
Followers 0
Enno

Make screenshot when clicking.

9 posts in this topic

Hello all,

I am trying to make something, but I just can't get it to work ....

I want it to make a screenshot when you click, but only if a certain window exists,

could someone here please guide me?

Share this post


Link to post
Share on other sites



Hello all,

I am trying to make something, but I just can't get it to work ....

I want it to make a screenshot when you click, but only if a certain window exists,

could someone here please guide me?

#Include <ScreenCapture.au3>
Global $hWnd, $times = 0

banana()
Func banana()
While 1
    If WinActive("AutoIt Help") Then
        $times += 1
        $hWnd = WinGetHandle("[ACTIVE]")
        _capture()

    EndIf
Sleep(50)
WEnd
EndFunc

Func _capture()
_ScreenCapture_CaptureWnd("capture.bmp", $hWnd)
TrayTip("Screenshots taken", $times & " is the number taken", 5)
Sleep(2000)
EndFunc

This example should help explain some of the things that can be done related to what you're looking for. I don't know how to make it take a screenshot when you click though...

Share this post


Link to post
Share on other sites

I`m sorry and i`m not cool coder in AuToIt but i try learn it :

IMHO this may help to you try this:

if WinGetTitle("Title of Your will existed apps") Then
    
$a = Send("{PRINTSCREEN}")
Run("mspaint.exe")
Else
    msgbox(64, "NO Your App...", "Your application is not exist")
    EndIf

[size="5"] [/size]

Share this post


Link to post
Share on other sites

#Include <ScreenCapture.au3>
Global $hWnd, $times = 0

banana()
Func banana()
While 1
    If WinActive("AutoIt Help") Then
        $times += 1
        $hWnd = WinGetHandle("[ACTIVE]")
        _capture()

    EndIf
Sleep(50)
WEnd
EndFunc

Func _capture()
_ScreenCapture_CaptureWnd("capture.bmp", $hWnd)
TrayTip("Screenshots taken", $times & " is the number taken", 5)
Sleep(2000)
EndFunc

This example should help explain some of the things that can be done related to what you're looking for. I don't know how to make it take a screenshot when you click though...

wow, I'll look it through a few times, since I don't quite understand it. looks nice :)

I`m sorry and i`m not cool coder in AuToIt but i try learn it :

IMHO this may help to you try this:

if WinGetTitle("Title of Your will existed apps") Then
    
$a = Send("{PRINTSCREEN}")
Run("mspaint.exe")
Else
    msgbox(64, "NO Your App...", "Your application is not exist")
    EndIf

hmm, this is easy, but I dont like it that it has to open mspaint....

Share this post


Link to post
Share on other sites

We'll I'm new to autoit but I got something.

You will have to use the s key to make screenshots.

In this topic http://www.autoitscript.com/forum/index.php?showtopic=91335is a solution for mouseclicks as a hotkey.

#Include <ScreenCapture.au3>

Global $hWnd

While 1
        HotKeySet("s","_screen")
WEnd

Func _screen()
    If WinActivate("Title of your window") Then
        $hWnd = WinGetHandle("Title of your window")
        _ScreenCapture_CaptureWnd(@MyDocumentsDir & "\screenshotname.jpg", $hWnd)
    Else
        MsgBox(64,"Window", "Put up your window")
    EndIf
EndFunc

Good luck

Share this post


Link to post
Share on other sites

We'll I'm new to autoit but I got something.

You will have to use the s key to make screenshots.

In this topic http://www.autoitscript.com/forum/index.php?showtopic=91335is a solution for mouseclicks as a hotkey.

#Include <ScreenCapture.au3>

Global $hWnd

While 1
        HotKeySet("s","_screen")
WEnd

Func _screen()
    If WinActivate("Title of your window") Then
        $hWnd = WinGetHandle("Title of your window")
        _ScreenCapture_CaptureWnd(@MyDocumentsDir & "\screenshotname.jpg", $hWnd)
    Else
        MsgBox(64,"Window", "Put up your window")
    EndIf
EndFunc

Good luck

hmmm....

#include <ScreenCapture.au3>

$sFileName = "Screen1.jpg"
$HotKey = HotKeySet ("{ENTER}",_ScreenCapture_Capture($sFileName1))


while 1
    Select
    Case $msg[0] = $HotKey
        $sFileName2 = "Screen2.jpg"
        _ScreenCapture_Capture($sFileName2)
    EndSelect
WEnd

COuld this work?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I think you are looking for _IsPressed().

#include <Misc.au3>
#include <ScreenCapture.au3>

$Filename = "screenshotname"
$Index = 0

While 1
    If _IsPressed("01") Then
        TakeScreenShot()

        ;wait for mouse to be released
        While _IsPressed("01")
            Sleep(10)
        WEnd
    EndIf
    Sleep(10) ;lower cpu usage
WEnd

Func TakeScreenShot()
    If WinActivate("Title of your window") Then
        $Index += 1
        $hWnd = WinGetHandle("Title of your window")
        _ScreenCapture_CaptureWnd(@MyDocumentsDir & "\" & $Filename & $Index & ".jpg", $hWnd)
    Else
        MsgBox(64, "Window", "Put up your window")
    EndIf
EndFunc ;==>TakeScreenShot
Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

I think you are looking for _IsPressed().

#include <Misc.au3>
#include <ScreenCapture.au3>

$Filename = "screenshotname"
$Index = 0

While 1
    If _IsPressed("01") Then
        TakeScreenShot()

        ;wait for mouse to be released
        While _IsPressed("01")
            Sleep(10)
        WEnd
    EndIf
    Sleep(10) ;lower cpu usage
WEnd

Func TakeScreenShot()
    If WinActivate("Title of your window") Then
        $Index += 1
        $hWnd = WinGetHandle("Title of your window")
        _ScreenCapture_CaptureWnd(@MyDocumentsDir & "\" & $Filename & $Index & ".jpg", $hWnd)
    Else
        MsgBox(64, "Window", "Put up your window")
    EndIf
EndFunc ;==>TakeScreenShot

OMG THANK YOU SOOOO MUCH :) you helped me out alot!

Share this post


Link to post
Share on other sites

I think you are looking for _IsPressed().

#include <Misc.au3>
#include <ScreenCapture.au3>

$Filename = "screenshotname"
$Index = 0

While 1
    If _IsPressed("01") Then
        TakeScreenShot()

        ;wait for mouse to be released
        While _IsPressed("01")
            Sleep(10)
        WEnd
    EndIf
    Sleep(10) ;lower cpu usage
WEnd

Func TakeScreenShot()
    If WinActivate("Title of your window") Then
        $Index += 1
        $hWnd = WinGetHandle("Title of your window")
        _ScreenCapture_CaptureWnd(@MyDocumentsDir & "\" & $Filename & $Index & ".jpg", $hWnd)
    Else
        MsgBox(64, "Window", "Put up your window")
    EndIf
EndFunc ;==>TakeScreenShot

LOL! _IsPressed! Of course!

durr durr durr

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