delaghetto Posted September 14, 2008 Share Posted September 14, 2008 (edited) What i need is to add the second code to the first code and then execute when i push the run button in the gui. im a little stumped on how to do this... keep in mind this is my first day ever working with this stuff and the code may be a little crappy. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #Region ### START Koda GUI section ### Form=C:\Users\Heppy\Desktop\GUI design\Forms\PYPbot.kxf $Form1 = GUICreate("bot beta 1", 283, 421, -1, -1) $Label1 = GUICtrlCreateLabel("Your level 1", 23, 72, 85, 17) $Label2 = GUICtrlCreateLabel("Your level 2", 23, 112, 85, 17) $Label3 = GUICtrlCreateLabel("Your level 3", 23, 152, 85, 17) $Label4 = GUICtrlCreateLabel("Your level 4", 23, 192, 85, 17) $Label5 = GUICtrlCreateLabel("Your level 5", 23, 232, 85, 17) $Label7 = GUICtrlCreateLabel("last one", 23, 272, 72, 17) $x1 = GUICtrlCreateInput(" X", 152, 72, 41, 21) $y1 = GUICtrlCreateInput(" Y", 216, 72, 41, 21) $x2 = GUICtrlCreateInput(" X", 152, 112, 41, 21) $y2 = GUICtrlCreateInput(" Y", 216, 112, 41, 21) $x3 = GUICtrlCreateInput(" X", 152, 152, 41, 21) $y3 = GUICtrlCreateInput(" Y", 216, 152, 41, 21) $x4 = GUICtrlCreateInput(" X", 152, 192, 41, 21) $y4 = GUICtrlCreateInput(" Y", 216, 192, 41, 21) $x5 = GUICtrlCreateInput(" X", 152, 232, 41, 21) $y5 = GUICtrlCreateInput(" Y", 216, 232, 41, 21) $x6 = GUICtrlCreateInput(" X", 153, 272, 41, 21) $y6 = GUICtrlCreateInput(" Y", 216, 272, 41, 21) $Label6 = GUICtrlCreateLabel("BOT", 19, 16, 253, 27) GUICtrlSetFont(-1, 15, 800, 0, "Bauhaus 93") $runButton = GUICtrlCreateButton("Run It!!!", 16, 360, 97, 49, 0) $closebutton = GUICtrlCreateButton("Close", 164, 360, 97, 49, 0) $Group1 = GUICtrlCreateGroup("", 8, 56, 265, 249) GUICtrlCreateGroup("", -99, -99, 1, 1) $mouseX = GUICtrlCreateLabel("Mouse X =", 8, 312, 55, 17) $Mousey = GUICtrlCreateLabel("Mouse Y =", 8, 336, 55, 17) Opt('MustDeclareVars', 1) Global $Xcoord, $YCoord example() Func example() Local $msg HotKeySet("{space}", "GetPos") $Xcoord = GUICtrlCreateLabel("Press", 72, 312, 36, 17) $ycoord = GUICtrlCreateLabel("Space", 72, 336, 36, 17) GUISetState() ; Run the GUI until the dialog is closed Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE or $msg = $closebutton EndFunc ;==>Example Func GetPos() Local $a $a = _WinAPI_GetCursorInfo() GUICtrlSetData($Xcoord, $a[3]) GUICtrlSetData($Ycoord, $a[4]) EndFunc ;==>GetPos GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ###oÝ÷ Ù«¢+ÙÝ¡¥±Ä((ÀÌØíÉôA¥á±Ñ½±½È ÜÜ°ÄØؤ()%ÀÌØíÉôÁáQ¡¸(͹ ÅÕ½ÐííÕôÅÕ½Ðì¤)±Í)M±À ÔÀÀÀ¤)5½ÕÍ ±¥¬ ÅÕ½ÐíÁÉ¥µÉäÅÕ½Ðì°äÄÜ°ÈÜФ)M±À ÜÀÀÀ¤)5½ÕÍ ±¥¬ ÅÕ½ÐíÁÉ¥µÉäÅÕ½Ðì°ÄÀÔØ°ÌØä¤)M±À ÜÀÀÀ¤)5½ÕÍ ±¥¬ ÅÕ½ÐíÁÉ¥µÉäÅÕ½Ðì°ÄÄàà°ÐØܤ)M±À ÜÀÀÀ¤)5½ÕÍ ±¥¬ ÅÕ½ÐíÁÉ¥µÉäÅÕ½Ðì°ÄÄàØ°ÔṲ̈)M±À ÜÀÀÀ¤)5½ÕÍ ±¥¬ ÅÕ½ÐíÁÉ¥µÉäÅÕ½Ðì°ÄÄàØ°ØàÔ¤)M±À ÜÀÀÀ¤)5½ÕÍ ±¥¬ ÅÕ½ÐíÁÉ¥µÉäÅÕ½Ðì°ÐÔаàÔؤ)¹¥)ݹ Edited September 14, 2008 by delaghetto Link to comment Share on other sites More sharing options...
Andreik Posted September 14, 2008 Share Posted September 14, 2008 while 1 $ref = PixelGetcolor (77, 166)If $ref = 0xFFFFFF ThenIt`s wrong. PixelGetColor returns a decimal value of pixel's color. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
martin Posted September 14, 2008 Share Posted September 14, 2008 (edited) It`s wrong. PixelGetColor returns a decimal value of pixel's color.@Andreik It isn't wrong. Andreik you need to understand your numbers better. Decimal means that the number is represented using base 10, hexideciaml means the number is represented using base 16 and to show that it's using base 16 we stick 0x in front but they are still numbers. To put it another way 0xC dollars is the same as 12 dollars. The base is irrelevant as long as you know what the base is. 0x6 is a number and it is the same as decimal 6 0x20 is the same as decimal 32 The fact that one is represented hexidecimally and the other decimally doesn't matter. These are all idnentical numbers:- 15 base 7 10 base 12 0xC decimal 12 binary 1100 @delaghetto Maybe this does what you want expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #Region ### START Koda GUI section ### Form=C:\Users\Heppy\Desktop\GUI design\Forms\PYPbot.kxf $Form1 = GUICreate("bot beta 1", 283, 421, -1, -1) $Label1 = GUICtrlCreateLabel("Your level 1", 23, 72, 85, 17) $Label2 = GUICtrlCreateLabel("Your level 2", 23, 112, 85, 17) $Label3 = GUICtrlCreateLabel("Your level 3", 23, 152, 85, 17) $Label4 = GUICtrlCreateLabel("Your level 4", 23, 192, 85, 17) $Label5 = GUICtrlCreateLabel("Your level 5", 23, 232, 85, 17) $Label7 = GUICtrlCreateLabel("last one", 23, 272, 72, 17) $x1 = GUICtrlCreateInput(" X", 152, 72, 41, 21) $y1 = GUICtrlCreateInput(" Y", 216, 72, 41, 21) $x2 = GUICtrlCreateInput(" X", 152, 112, 41, 21) $y2 = GUICtrlCreateInput(" Y", 216, 112, 41, 21) $x3 = GUICtrlCreateInput(" X", 152, 152, 41, 21) $y3 = GUICtrlCreateInput(" Y", 216, 152, 41, 21) $x4 = GUICtrlCreateInput(" X", 152, 192, 41, 21) $y4 = GUICtrlCreateInput(" Y", 216, 192, 41, 21) $x5 = GUICtrlCreateInput(" X", 152, 232, 41, 21) $y5 = GUICtrlCreateInput(" Y", 216, 232, 41, 21) $x6 = GUICtrlCreateInput(" X", 153, 272, 41, 21) $y6 = GUICtrlCreateInput(" Y", 216, 272, 41, 21) $Label6 = GUICtrlCreateLabel("BOT", 19, 16, 253, 27) GUICtrlSetFont(-1, 15, 800, 0, "Bauhaus 93") $runButton = GUICtrlCreateButton("Run It!!!", 16, 360, 97, 49, 0) $closebutton = GUICtrlCreateButton("Close", 164, 360, 97, 49, 0) $Group1 = GUICtrlCreateGroup("", 8, 56, 265, 249) GUICtrlCreateGroup("", -99, -99, 1, 1) $mouseX = GUICtrlCreateLabel("Mouse X =", 8, 312, 55, 17) $Mousey = GUICtrlCreateLabel("Mouse Y =", 8, 336, 55, 17) Opt("MustDeclareVars", 1);<---------changed this (looks like you are used to HTML?) Global $Xcoord, $YCoord example() Func example() Local $msg HotKeySet("{space}", "GetPos") $Xcoord = GUICtrlCreateLabel("Press", 72, 312, 36, 17) $YCoord = GUICtrlCreateLabel("Space", 72, 336, 36, 17) GUISetState() ; Run the GUI until the dialog is closed Do $msg = GUIGetMsg() Switch $msg Case $runButton abc123() Case $GUI_EVENT_CLOSE, $msg = $closebutton Return EndSwitch Until 0 EndFunc ;==>example Func GetPos() Local $a $a = _WinAPI_GetCursorInfo() GUICtrlSetData($Xcoord, $a[3]) GUICtrlSetData($YCoord, $a[4]) EndFunc ;==>GetPos GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Func abc123() While 1 $ref = PixelGetColor(77, 166) If $ref = 0xFFFFFF Then Send("{F5}") Else Sleep(5000) MouseClick("primary", 917, 274) Sleep(7000) MouseClick("primary", 1056, 369) Sleep(7000) MouseClick("primary", 1188, 467) Sleep(7000) MouseClick("primary", 1186, 573) Sleep(7000) MouseClick("primary", 1186, 685) Sleep(7000) MouseClick("primary", 454, 856) EndIf WEnd EndFunc ;==>abc123 Edited September 14, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
delaghetto Posted September 19, 2008 Author Share Posted September 19, 2008 hmm... well for some reason when i click to test run it, it just closes instantly but i cant figure out exactly whats wrong... all the syntax works logically but i dont know why its closing the program 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