rony2006 Posted January 5, 2016 Share Posted January 5, 2016 Hello, I am beginner in autoit coding and I have made a script that contains some loops and now I want to include a code that makes a screenshot but is not working.The structure of my script is like:#include blablabla the code for GUI $run=1 DO While 1 if then else endif Wend if then else endif ;here i included the folowing code but is not working: _GDIPlus_Startup("gdiplus.dll") ; Capture region _ScreenCapture_Capture("c:\blap\GDIPlus_Image2.jpg", 0, 0, 796, 596) ShellExecute("c:\blap\GDIPlus_Image2.jpg") _GDIPlus_Shutdown() Until $run=1 What should be the correct coding for having a dinamic information in gui based on if and then statementes from code? My code is:expandcollapse popup#include <ImageSearch.au3> #include <MsgBoxConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ScreenCapture.au3> $run = 2 $Form1 = GUICreate("Form1", 250, 855, -1, -1) $Label1 = GUICtrlCreateLabel("Origine:", 8, 16, 58, 23) GUICtrlSetFont(-1, 12, 800, 0, "Calibri") $orx = GUICtrlCreateInput("", 24, 40, 57, 21) $Label2 = GUICtrlCreateLabel("X:", 8, 45, 14, 19) GUICtrlSetFont(-1, 10, 400, 0, "Calibri") $Label3 = GUICtrlCreateLabel("Y:", 95, 44, 13, 19) GUICtrlSetFont(-1, 10, 400, 0, "Calibri") $ory = GUICtrlCreateInput("", 113, 39, 57, 21) $Pic1 = GUICtrlCreatePic("", 72, 16, 17, 21) Global $Label4 = GUICtrlCreateLabel("OK", 68, 17, 24, 23) GUICtrlSetFont(-1, 12, 800, 0, "Calibri") GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetState(-1, $GUI_HIDE) Global $Label5 = GUICtrlCreateLabel("NOK", 68, 17, 35, 23) GUICtrlSetFont(-1, 12, 800, 0, "Calibri") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetState(-1, $GUI_HIDE) do $Label6 = GUICtrlCreateLabel("Start ciclu:", 8, 80, 77, 23) GUICtrlSetFont(-1, 12, 800, 0, "Calibri") $iColori = GUICtrlCreateInput("", 96, 80, 81, 21) $Label7 = GUICtrlCreateLabel("Pozitie:", 5, 123, 54, 23) GUICtrlSetFont(-1, 12, 800, 0, "Calibri") $pozitie = GUICtrlCreateInput("", 66, 124, 57, 21) GUISetState(@SW_SHOW) Do While 1 Global $x1=0 Global $y1=0 $result = _ImageSearch("origine.bmp",1,$x1,$y1,70) GUICtrlSetData($orx, $x1) GUICtrlSetData($ory, $y1) ;Referinta ok sau nokW If $x1 > 0 Then GUICtrlSetState($Label4, $GUI_SHOW) GUICtrlSetState($Label5, $GUI_HIDE) Else GUICtrlSetState($Label5, $GUI_SHOW) GUICtrlSetState($Label4, $GUI_HIDE) EndIf ;Coordonate fata de origine pentru carti, sa vad cand trebuie sa inceapa un ciclu de joc $var1 = 610 $var2 = 255 Global $xs = $x1 - $var1 Global $ys = $y1 + $var2 Global $iColor = PixelGetColor($xs, $ys) Global $stc1 = 0 Global $stc2 = 0 If $iColor > 2300000 And $iColor < 2800000 And $stc1 = 0 Then $stc2 = 1 ExitLoop 1 EndIf Sleep (500) Beep (500, 300) WEnd ;##Pozitia## Coordonate fata de origine pentru butonul de dealer $var3 = 621 $var4 = 297 Global $x1s = $x1 - $var3 Global $y1s = $y1 + $var4 Global $ipozitie = PixelGetColor($x1s, $y1s) ; o fost xs GUICtrlSetData($iColori, $ipozitie) Global $poz If $ipozitie > 5000000 Then $poz = "SB" Else $poz = "BB" EndIf ;Crop eff stack Global $xc = $x1 - 525 Global $yc = $y1 + 85 _GDIPlus_Startup("gdiplus.dll") ; Capture region _ScreenCapture_Capture("c:\blap\GDIPlus_Image2.jpg", 0, 0, 796, 596) ShellExecute("c:\blap\GDIPlus_Image2.jpg") _GDIPlus_Shutdown() GUICtrlSetData($pozitie, $poz) Until $run = 1 Link to comment Share on other sites More sharing options...
JohnOne Posted January 5, 2016 Share Posted January 5, 2016 (edited) First of all, get rid of _GDIPlus_Startup("gdiplus.dll") and its shutdown, they're not needed.Next, verify you can write to location without admin.Then, verify your script is actually reaching that part of the code.If all that fails, expand on "is not working" Edited January 5, 2016 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...
InunoTaishou Posted January 5, 2016 Share Posted January 5, 2016 This is already a good example on _ScreenCapture_CaptureMy guess is your script is never making it to the _ScreenCapture_Capture because it's stuck in your While 1...WEnd loop, it's always true. 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