snoopy Posted January 14, 2009 Posted January 14, 2009 Hey guys im kinda new and made my own little outo thingy for Toontown: $answer = MsgBox(4, "Toontown Trainer (English Only)", "F4=stop F5=Stop. Run?") ; Check the user's answer to the prompt (see the help file for MsgBox return values) ; If "No" was clicked (7) then exit the script If $answer = 7 Then MsgBox(0, "AutoIt", "OK. Bye!") exit Endif HotKeySet("{F4}", "ExitProg") ;;Sets F4 as a hotkey to exit the progam HotKeySet("{F5}", "StartProg") ;;Sets F5 as a hotkey to start the program While 1 Sleep(100) Wend Func StartProg() while 1 MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) MouseClick("left", 217, 65, 1) MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) MouseClick("left", 228, 79, 1) MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) MouseClick("left", 173, 81, 1) MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) MouseClick("left", 223, 93, 1) MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) MouseClick("left", 190, 110, 1) MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) MouseClick("left", 214, 112, 1) MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) MouseClick("left", 255, 138, 1) Sleep(500) WEnd EndFunc Func ExitProg() Exit 0 EndFunc as you can see every 3 lines are seperate and i would like to make them go random ,random order but dunno how! and also when making it exe. using complie exe. i would like to put icons or maybe some thing fancier, so if i dont ask too much please help me , to learn. thank you oh and as you can see i have 2 hot keys and would like to make it alittle clearer , maybe alittle box that says the hot keys while it all runs but i have about 0 skill in all this. :-(
azure Posted January 14, 2009 Posted January 14, 2009 Hey guys im kinda new and made my own little outo thingy for Toontown: as you can see every 3 lines are seperate and i would like to make them go random ,random order but dunno how! and also when making it exe. using complie exe. i would like to put icons or maybe some thing fancier, so if i dont ask too much please help me , to learn. thank you oh and as you can see i have 2 hot keys and would like to make it alittle clearer , maybe alittle box that says the hot keys while it all runs but i have about 0 skill in all this. :-( Like This? TraySetIcon("shell32.dll",246) $answer = MsgBox(4, "Toontown Trainer (English Only)", "F4=Stop F5=Start. Run?") ; Check the user's answer to the prompt (see the help file for MsgBox return values) ; If "No" was clicked (7) then exit the script If $answer = 7 Then MsgBox(0, "AutoIt", "OK. Bye!") exit Endif HotKeySet("{F4}", "ExitProg") ;;Sets F4 as a hotkey to exit the progam HotKeySet("{F5}", "StartProg") ;;Sets F5 as a hotkey to start the program While 1 Sleep(100) Wend Func StartProg() Local $randomcoords[7][2] = [[217,65],[228,79],[173,81],[223,93],[190,110],[214,112],[255,138]] While 1 For $i = 0 To 7 MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) $r = Random(0,6,1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) Next Sleep(500) WEnd EndFunc Func ExitProg() Exit 0 EndFunc
FireFox Posted January 14, 2009 Posted January 14, 2009 (edited) @snoopyWelcome to autoit forumUse Random() function and you can with it switch between functions etc...$rdm = Random(1, 3, 1) _Func($rdm) Func _Func($nb) If $nb = 1 Then ;do something ElseIf $nb = 2 Then ;do something else ElseIf $nb = 3 Then ;do something else EndIf EndFuncEdit : @azureNice example Cheers, FireFox. Edited January 14, 2009 by FireFox
snoopy Posted January 14, 2009 Author Posted January 14, 2009 (edited) wow the speed of helpers here, lol you guys sure did help but one more thing, i was wondering is it acctually posible , maybe puting like hmm , say i converted it to exe. than when you run it , itlll open abig window with pic on its backround and there will be like start button or something similar but keeping it simple though btw could i make the thing go any faster? Edited January 14, 2009 by snoopy
FireFox Posted January 14, 2009 Posted January 14, 2009 GuiCreate() GuiCtrlCreatePic() GuiCtrlCreateButton() GuiSetState() Now please read helpfile Cheers, FireFox.
azure Posted January 14, 2009 Posted January 14, 2009 wow the speed of helpers here, lol you guys sure did help but one more thing, i was wondering is it acctually posible , maybe puting like hmm , say i converted it to exe. than when you run it , itlll open abig window with pic on its backround and there will be like start button or something similar but keeping it simple though btw could i make the thing go any faster? expandcollapse popupTraySetIcon("shell32.dll",246) #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 298, 226, 193, 115, $WS_POPUP, 0) $Pic1 = GUICtrlCreatePic(@WINDOWSDIR&"\Greenstone.bmp", 0, 0, 297, 225, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GuiCtrlSetState(-1,$GUI_DISABLE) $START = GUICtrlCreateButton("START", 96, 64, 113, 49, 0) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x808000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $START GUIDelete($Form1) ExitLoop EndSwitch WEnd HotKeySet("{F4}", "ExitProg") ;;Sets F4 as a hotkey to exit the progam HotKeySet("{F5}", "StartProg") ;;Sets F5 as a hotkey to start the program While 1 Sleep(100) Wend Func StartProg() Local $randomcoords[7][2] = [[217,65],[228,79],[173,81],[223,93],[190,110],[214,112],[255,138]] While 1 For $i = 0 To 7 MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) $r = Random(0,6,1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) Next Sleep(500) WEnd EndFunc Func ExitProg() Exit 0 EndFunc
FireFox Posted January 14, 2009 Posted January 14, 2009 @azure you like giving the fish... How can he learn if you give him all ? Cheers, FireFox.
snoopy Posted January 14, 2009 Author Posted January 14, 2009 ahh i seee tnx, 1 leads to the other ok thats fine ill try and master all this tnx for all your help dudes
snoopy Posted January 14, 2009 Author Posted January 14, 2009 ok now, i wrote all that in Scite and on top of the script i wrote #AutoIt3Wrapper_icon=Cool-256x256.ico so the exe. will have my icon on it but it seems like it doesent work well its located in my desktop, do i have to relocate it to the autoit folder or what?
FireFox Posted January 14, 2009 Posted January 14, 2009 @snoopy right click on your script > compile with options Cheers, FireFox.
azure Posted January 14, 2009 Posted January 14, 2009 @azureyou like giving the fish... How can he learn if you give him all ? Cheers, FireFox.Meh.. I was bored at work, waiting on other people to answer questions.. Gives me something to do.. I'm still learning AutoIT, so it's good for me.
FireFox Posted January 14, 2009 Posted January 14, 2009 @azure If youre boring you can learn all functions of helpfile and then see important udfs Cheers, FireFox.
snoopy Posted January 15, 2009 Author Posted January 15, 2009 Am i doing something wrong? #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=Beta #AutoIt3Wrapper_icon=Cool-256x256.ico #AutoIt3Wrapper_Res_Comment=this is my first time making anything like taht #AutoIt3Wrapper_Res_Fileversion=0.0.1 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** TraySetIcon("shell32.dll",246) #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 298, 226, 193, 115, $WS_POPUP, 0) $Pic1 = GUICtrlCreatePic(@WINDOWSDIR&"\Greenstone.bmp", 0, 0, 297, 225, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GuiCtrlSetState(-1,$GUI_DISABLE) $START = GUICtrlCreateButton("START", 96, 64, 113, 49, 0) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x808000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $START GUIDelete($Form1) ExitLoop EndSwitch WEnd HotKeySet("{F4}", "ExitProg") ;;Sets F4 as a hotkey to exit the progam HotKeySet("{F5}", "StartProg") ;;Sets F5 as a hotkey to start the program HotKeySet("{F6}", "StartProg") ;;Sets F6 as a hotkey to start the program 2# Sleep(100) Wend Func StartProg() Local $randomcoords[7][2] = [[217,65],[228,79],[173,81],[223,93],[190,110],[214,112],[255,138]] While 1 For $i = 0 To 7 MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) $r = Random(0,6,1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) Next Sleep(500) while if F6 was pressed than; Switch Func StartProg 2#() Local $randomcoords[7][2] = [[217,75],[228,79],[173,81],[223,93],[190,110],[214,112],[255,138]] While 1 For $i = 0 To 7 MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) $r = Random(0,6,1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) Next Sleep(500) WEnd EndFunc as you can see i am trieng to do this: if you press f6 you will get startprog no.2 and if you press f5 you get start prog n.1 but seems like it has 0 effect :-X BTW thanks for all the help and support
azure Posted January 15, 2009 Posted January 15, 2009 (edited) Am i doing something wrong? #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=Beta #AutoIt3Wrapper_icon=Cool-256x256.ico #AutoIt3Wrapper_Res_Comment=this is my first time making anything like taht #AutoIt3Wrapper_Res_Fileversion=0.0.1 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** TraySetIcon("shell32.dll",246) #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 298, 226, 193, 115, $WS_POPUP, 0) $Pic1 = GUICtrlCreatePic(@WINDOWSDIR&"\Greenstone.bmp", 0, 0, 297, 225, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GuiCtrlSetState(-1,$GUI_DISABLE) $START = GUICtrlCreateButton("START", 96, 64, 113, 49, 0) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x808000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $START GUIDelete($Form1) ExitLoop EndSwitch WEnd HotKeySet("{F4}", "ExitProg") ;;Sets F4 as a hotkey to exit the progam HotKeySet("{F5}", "StartProg") ;;Sets F5 as a hotkey to start the program HotKeySet("{F6}", "StartProg") ;;Sets F6 as a hotkey to start the program 2# Sleep(100) Wend Func StartProg() Local $randomcoords[7][2] = [[217,65],[228,79],[173,81],[223,93],[190,110],[214,112],[255,138]] While 1 For $i = 0 To 7 MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) $r = Random(0,6,1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) Next Sleep(500) while if F6 was pressed than; Switch Func StartProg 2#() Local $randomcoords[7][2] = [[217,75],[228,79],[173,81],[223,93],[190,110],[214,112],[255,138]] While 1 For $i = 0 To 7 MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) $r = Random(0,6,1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) Next Sleep(500) WEnd EndFunc as you can see i am trieng to do this: if you press f6 you will get startprog no.2 and if you press f5 you get start prog n.1 but seems like it has 0 effect :-X BTW thanks for all the help and support Yes... for one, you're not using [ autoit ] tags in your posts which makes reading code annoying. Another thing.. why have an icon file if you're not using it (trayseticon function) Another thing.. your startprog #2 function name is all wrong. You can't use spaces in function names. Another thing.. Your loops were all wacky.. You didn't have WEnd's where you had While's. You can't just start functions in the middle of loops too. Did you even check the errors you got when you tried compiling this? Try this: expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=Beta #AutoIt3Wrapper_icon=Cool-256x256.ico #AutoIt3Wrapper_Res_Comment=this is my first time making anything like taht #AutoIt3Wrapper_Res_Fileversion=0.0.1 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** TraySetIcon("Cool-256x256.ico") #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 298, 226, 193, 115, $WS_POPUP, 0) $Pic1 = GUICtrlCreatePic(@WINDOWSDIR&"\Greenstone.bmp", 0, 0, 297, 225, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GuiCtrlSetState(-1,$GUI_DISABLE) $START = GUICtrlCreateButton("START", 96, 64, 113, 49, 0) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x808000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $START GUIDelete($Form1) ExitLoop EndSwitch WEnd HotKeySet("{F4}", "ExitProg") ;;Sets F4 as a hotkey to exit the progam HotKeySet("{F5}", "StartProg") ;;Sets F5 as a hotkey to start the program HotKeySet("{F6}", "StartProg2") ;;Sets F6 as a hotkey to start the program 2# While 1 Sleep(100) Wend Func StartProg() Local $randomcoords[7][2] = [[217,65],[228,79],[173,81],[223,93],[190,110],[214,112],[255,138]] While 1 For $i = 0 To 7 MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) $r = Random(0,6,1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) Next Sleep(500) WEnd EndFunc ;while if F6 was pressed than; ;Switch Func StartProg2() Local $randomcoords[7][2] = [[217,75],[228,79],[173,81],[223,93],[190,110],[214,112],[255,138]] While 1 For $i = 0 To 7 MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) $r = Random(0,6,1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) Next Sleep(500) WEnd EndFunc Edited January 15, 2009 by azure
snoopy Posted January 15, 2009 Author Posted January 15, 2009 Yes... for one, you're not using [ autoit ] tags in your posts which makes reading code annoying. Another thing.. why have an icon file if you're not using it (trayseticon function) Another thing.. your startprog #2 function name is all wrong. You can't use spaces in function names. Another thing.. Your loops were all wacky.. You didn't have WEnd's where you had While's. You can't just start functions in the middle of loops too. Did you even check the errors you got when you tried compiling this? Try this: expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=Beta #AutoIt3Wrapper_icon=Cool-256x256.ico #AutoIt3Wrapper_Res_Comment=this is my first time making anything like taht #AutoIt3Wrapper_Res_Fileversion=0.0.1 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** TraySetIcon("Cool-256x256.ico") #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 298, 226, 193, 115, $WS_POPUP, 0) $Pic1 = GUICtrlCreatePic(@WINDOWSDIR&"\Greenstone.bmp", 0, 0, 297, 225, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GuiCtrlSetState(-1,$GUI_DISABLE) $START = GUICtrlCreateButton("START", 96, 64, 113, 49, 0) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x808000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $START GUIDelete($Form1) ExitLoop EndSwitch WEnd HotKeySet("{F4}", "ExitProg") ;;Sets F4 as a hotkey to exit the progam HotKeySet("{F5}", "StartProg") ;;Sets F5 as a hotkey to start the program HotKeySet("{F6}", "StartProg2") ;;Sets F6 as a hotkey to start the program 2# While 1 Sleep(100) Wend Func StartProg() Local $randomcoords[7][2] = [[217,65],[228,79],[173,81],[223,93],[190,110],[214,112],[255,138]] While 1 For $i = 0 To 7 MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) $r = Random(0,6,1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) Next Sleep(500) WEnd EndFunc ;while if F6 was pressed than; ;Switch Func StartProg2() Local $randomcoords[7][2] = [[217,75],[228,79],[173,81],[223,93],[190,110],[214,112],[255,138]] While 1 For $i = 0 To 7 MouseClick("left", 57, 45, 1) MouseClick("left", 127, 61, 1) $r = Random(0,6,1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) Next Sleep(500) WEnd EndFunc it shows an ERROR: C:\Users\Snoopy\Desktop\1st project.au3(35,29) : ERROR: ExitProg(): undefined function. HotKeySet("{F4}", "ExitProg") ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Snoopy\Desktop\1st project.au3 - 1 error(s), 0 warning(s)
azure Posted January 15, 2009 Posted January 15, 2009 it shows an ERROR: C:\Users\Snoopy\Desktop\1st project.au3(35,29) : ERROR: ExitProg(): undefined function. HotKeySet("{F4}", "ExitProg") ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Snoopy\Desktop\1st project.au3 - 1 error(s), 0 warning(s) Add this to the end.. you left it out of the code you posted, but it's in your earlier responses. Func ExitProg() Exit 0 EndFunc
snoopy Posted January 16, 2009 Author Posted January 16, 2009 Hi ,, thnx alot Azura , now i would like to know more about pixel ditecters and pixel clickers , what if i got HTML colour and i would like to make my script click into it? what do i do? tnx alot for the attention , although ive tried to find , they were all hard to undarstand and i would like to get it as simple as posible tnx
snoopy Posted January 18, 2009 Author Posted January 18, 2009 (edited) $coord = PixelSearch(0, 0, 1, 1, 0xb3ee90, 2, 2); If Not @error Then MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1]); MouseClick("left", $coord[0], $coord[1]); EndIf Seems like it doesent take any action, suppose to press the icon below but doesent could any one give me little tips? Edited January 18, 2009 by snoopy
Aceguy Posted January 18, 2009 Posted January 18, 2009 thats becase the func "ExitProg()" has not been written into the script. [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock
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