Enno Posted November 28, 2009 Share Posted November 28, 2009 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? Link to comment Share on other sites More sharing options...
jebus495 Posted November 28, 2009 Share Posted November 28, 2009 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... Link to comment Share on other sites More sharing options...
Fire Posted November 28, 2009 Share Posted November 28, 2009 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] Link to comment Share on other sites More sharing options...
Enno Posted November 28, 2009 Author Share Posted November 28, 2009 #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.... Link to comment Share on other sites More sharing options...
TwentyFourEyes Posted November 28, 2009 Share Posted November 28, 2009 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 EndFuncGood luck Link to comment Share on other sites More sharing options...
Enno Posted November 28, 2009 Author Share Posted November 28, 2009 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? Link to comment Share on other sites More sharing options...
dantay9 Posted November 28, 2009 Share Posted November 28, 2009 (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 November 28, 2009 by dantay9 Link to comment Share on other sites More sharing options...
Enno Posted November 28, 2009 Author Share Posted November 28, 2009 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! Link to comment Share on other sites More sharing options...
jebus495 Posted November 29, 2009 Share Posted November 29, 2009 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now