pdark1987 Posted March 28, 2015 Share Posted March 28, 2015 Func IMR12() while 1 sleep(1000) $IMR12= _ImageSearch('5star.bmp', 0, $X, $Y, 0) if $IMR12 = 1 Then MouseClick("left") sleep(600) IMR21() else sleep(100) start() EndIf WEnd EndFunc i want know if its possible for this function to have a screenshot when the 5star.bmp is there? so maybe like right before IMR21()? and also the screenshot shouldnt replace an exist screenshot? i did find a this script from some1 else and was wondering if it possible to add the screenshot function to mine script? or im not sure how to go about it. thanks for the help! expandcollapse popup#cs AU3 Screen Shot Utility 1.0 Author : Solixious Klein #ce #include<WindowsConstants.au3> #include<GUIConstants.au3> #include<ScreenCapture.au3> init() Func init() Global $frame=GUICreate("AU3 Screen Shot Utility 1.0",300,100,200,200) GUISetIcon("icon.ico") TraySetIcon("icon.ico") Global $file=GUICtrlCreateMenu("File") Global $name=GUICtrlCreateMenuItem("Change Name",$file) Global $loc=GUICtrlCreateMenuItem("Storage Location",$file) Global $form=GUICtrlCreateMenuItem("Screenshot Format",$file) Global $exit=GUICtrlCreateMenuItem("Exit",$file) Global $help=GUICtrlCreateMenu("Help") Global $about=GUICtrlCreateMenuItem("About",$help) Global $lab=GUICtrlCreateLabel("Shift + F8 -------> Take Screen Shot" & @CRLF & @CRLF & "Shift + F3 -------> Show or Hide this Window Frame",10,15) Opt("TrayOnEventMode", 1) Opt("TrayMenuMode", 1) Global $shw=TrayCreateItem("Show Frame") Global $capt=TrayCreateItem("Capture Screen Shot") Global $ex=TrayCreateItem("Exit") TrayItemSetOnEvent($shw,"show") TrayItemSetOnEvent($ex,"ex") TrayItemSetOnEvent($capt,"Cap") If FileExists("name.dat") Then Global $prename=FileRead("name.dat") If $prename="" Then $prename="Screen" EndIf Else Global $prename="Screen" EndIf If FileExists("loc.dat") Then Global $path=FileRead("loc.dat") If $path="" Then $path=@WorkingDir EndIf Else Global $path=@WorkingDir EndIf If FileExists("form.dat") Then Global $format=FileRead("form.dat") If $format="" Then $format="jpg" EndIf Else Global $format="jpg" EndIf HotKeySet("+{F3}","show") HotKeySet("+{F8}","Cap") While 1 $event=GUIGetMsg() If $event=$GUI_EVENT_CLOSE Or $event=$exit Then Exit ElseIf $event=$GUI_EVENT_MINIMIZE Then GUISetState(@SW_HIDE,$frame) HotKeySet("+{F3}","hide") TrayItemSetState($shw,64) ElseIf $event=$loc Then $p=FileSelectFolder("Open Location","",1+2+4,FileRead("loc.dat")) If $p<>"" Then $f=FileOpen("loc.dat",2+8) FileWrite($f,$p) $path=$p EndIf ElseIf $event=$name Then $x=InputBox("New Name","Enter the file name",FileRead("name.dat")) If $x<>"" Then $f=FileOpen("name.dat",2+8) FileWrite($f,$x) $prename=$x EndIf ElseIf $event=$form Then $o=InputBox("Format","jpg / bmp / gif / tif / png",FileRead("form.dat")) $o=StringLower($o) If $o="jpg" Or $o="bmp" Or $o="gif" Or $o="tif" Or $o="png" Then $f=FileOpen("form.dat",2+8) FileWrite($f,$o) $format=$o EndIf ElseIf $event=$about Then MsgBox(0,"About","Screen Shot Utility 1.0" & @CRLF & "Author : Solixious" & @CRLF & "Date of Creation : 10th October, 2012") EndIf WEnd EndFunc Func show() GUISetState(@SW_SHOW,$frame) HotKeySet("+{F3}","hide") TrayItemSetState($shw,128) EndFunc Func hide() GUISetState(@SW_HIDE,$frame) HotKeySet("+{F3}","show") TrayItemSetState($shw,64) EndFunc Func Cap() $fname=getname() $c=_ScreenCapture_Capture() _ScreenCapture_SaveImage($fname,$c,True) EndFunc Func ex() Exit EndFunc Func getname() $i=1 While FileExists($path & "\" & $prename & " " & $i & "." & $format) $i=$i+1 WEnd Return $path & "\" & $prename & " " & $i & "." & $format EndFunc Link to comment Share on other sites More sharing options...
JohnOne Posted March 28, 2015 Share Posted March 28, 2015 (edited) Add file path to first param of _ScreenCapture_Capture. You can omit _ScreenCapture_SaveImage. Edited March 28, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
pdark1987 Posted March 30, 2015 Author Share Posted March 30, 2015 (edited) #include <ScreenCapture.au3> Func IMR12() while 1 sleep(1000) $IMR12= _ImageSearch('5star.bmp', 0, $X, $Y, 0) if $IMR12 = 1 Then MouseClick("left") sleep(600) ss() ;<---- this is screenshot function below IMR21() else sleep(100) start() EndIf WEnd EndFunc and this is my edit of add ss() havent test it yet ------------------------------------------------------------------- ss() Func ss() Local $hBmp ; Capture full screen $hBmp = _ScreenCapture_Capture("") ; Save bitmap to file _ScreenCapture_SaveImage(@MyDocumentsDir & "\GDIPlus_Image.jpg", $hBmp) ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg") EndFunc ;==>ss this is the example i just saw would this work fine? and or do i need any file screenshot.au3? if so where would i get it or its part of autoit. and also if i want to save at this location would i just change @mydocumentsdir to @C:UsersSaadDesktopautoit would this work? GDIplus i just rename both to what every i want the screenshot to be? Edited March 30, 2015 by pdark1987 Link to comment Share on other sites More sharing options...
JohnOne Posted March 30, 2015 Share Posted March 30, 2015 What did your testing tell you? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
pdark1987 Posted March 31, 2015 Author Share Posted March 31, 2015 (edited) so that worked fine, (@MyDocumentsDir & "\GDIPlus_Image.jpg", $hBmp) how can i say to save screenshot in /mydocuments/screenshot?(cuz right now it just my doucments) and also each time it take a screenshoot it replaces the other one . i want it to add a number? GDIPlus_Image1.jpg,GDIPlus_Image2.jpg, and so on? so it does not just override it other screenshot. thank you johnone for ur help! Edited March 31, 2015 by pdark1987 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