seamonkeysproject Posted May 3, 2013 Share Posted May 3, 2013 (edited) Iam very new in this, but I cant get this to work 100%. This is what want it to do : Button1 = Start to activate to send 2 keys out. Until I press Button 5 it should set in pause mode. Button2 = Start to send 1 key out, while button1 is still activated. If I click the second time on it,i want it to deactivate button2. Button3 = Start to send 1 key out, while button 1 and 2 are activated. Until pressed again in a deactivated mode. Button4 = Start to send 2 keys out, if button1,button2 & button3 are avtivated. If pressed again, deactivate the mode of Button4. Button5 = Want I to set as a PauseMode/Stop. Like it deactivate all the buttons activity. But i do not get it to work 100%, I get only Button1s function to work, and if I press also button 5 it does not stop at all, if iam out of my script it starts again automatic Some who does now how I should do it, is there a easier way to do it? It collapse very often :/ I will be gratefull with some tips or hints. But I will still try to get it to work. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Form2", 405, 294, 391, 270) $Button1 = GUICtrlCreateButton("activate", 128, 64, 131, 25) $Button2 = GUICtrlCreateButton("send1", 136, 96, 115, 25) $Button3 = GUICtrlCreateButton("send2", 136, 136, 115, 25) $Button4 = GUICtrlCreateButton("pause/resume", 120, 176, 147, 25) $Button5 = GUICtrlCreateButton("exit", 120, 224, 147, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### HotKeySet( "{F3}", "exitthescript" ) Func activate() While 1 Send( "{s}" ) Sleep(10) Send( "{ENTER}" ) WEnd EndFunc Sleep(1000) Func send1() While 1 Send( "{}" ) Sleep(100) Send( "{}" ) WEnd EndFunc Func send2() While 1 Send( "{}" ) Sleep(100) Send( "{}" ) WEnd EndFunc Func pause/resume() While 1 Send( "{p}" ) Exit WEnd EndFunc Func exitthescript() Exit EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 activate() Case $Button2 send1() Case $Button3 send2() Case $Button4 pause/resume() Case $Button5 exitthescript() EndSwitch WEnd Edited May 4, 2013 by Melba23 Added autoit tags Link to comment Share on other sites More sharing options...
BrewManNH Posted May 3, 2013 Share Posted May 3, 2013 Hint #1, post the script, otherwise it's all guess work. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
seamonkeysproject Posted May 3, 2013 Author Share Posted May 3, 2013 Sorry I did forget that part,BrewManNH Thanks you Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 4, 2013 Moderators Share Posted May 4, 2013 seamonkeysproject, This scripts looks like an attempt to get help with this gamebot from your earlier locked thread. The descriptions of what you are trying to achieve in the 2 cases seem very similar. You would not be trying to get round the ban on gamebots, would you? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
seamonkeysproject Posted May 4, 2013 Author Share Posted May 4, 2013 (edited) seamonkeysproject, This scripts looks like an attempt to get help with this gamebot from your earlier locked thread. The descriptions of what you are trying to achieve in the 2 cases seem very similar. You would not be trying to get round the ban on gamebots, would you? M23 Its not a game bot, why should I use gamebot if I wanted to play a game?And I know thats not allowed to ask or show in here. And its also not allowed to use in games.But Im not a gamer, Iam a part of a artist who works as painting arts for music bands. Iam not a person who use bots on games. Im trying to gonna make something to a friend of me in a music band Melba23. And when Im gonna design it it gonna stand for that band. But first of all I need to learn me how to use these buttons correctly, so they can start to work 100% I have also started to do the design in PS PhotoShop). But its not in the PS I got the problems. in the end it will also be videos (musicvideos) in it and stuff. But I have to learn steps by steps,.But i need to got the buttons to work as they should do. Edited May 4, 2013 by seamonkeysproject Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 4, 2013 Moderators Share Posted May 4, 2013 seamonkeysproject,Interesting statements:why should I use gamebot if I wanted to play a game?Iam not a person who use bots on gamesfrom someone who in their previous locked thread said:That one I am working on are having 3 Buttons. 1 for Start Attack and send a Key.And the second Button is for to take on more ammo, while the First Button is still attacking,who should also send the key.The third Button is to Stop / Pause these ammo.What is that script for if not for a game? However, I will accept your assurances that this is not the same script. But for your sake I hope that it does not turn out that my suspicions were justified - I do not take it kindly when people take advantage. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
seamonkeysproject Posted May 4, 2013 Author Share Posted May 4, 2013 I am not trying to lie. Only thing I want to know in the beginning is how I can get more than 1 Button to work. While maybe some others is activated. And then have some who can send keys/msg to send you to another page. While the Video I will put in there should not stop when i wanna click on something else. And its not gonna be to anything to game to do, its to music, music video, homepage of the band. But iam sorry guys if you only think its a game bot, but I do understand it looks like 1. but it will not look like that in the end. And Iam sorry for my bad english, but I try as good as I can. But aslong this thread/topic looks like a something to do with a game again, I might will try to figure it out by my self. And read more about things about GUI and functions. So you can just remove or delete the topic. cause it dosent looks like someone want to learn me to use the functions with Buttons,Or tell me what Iam doing wrong since It dosent work like it should be. but I tried atleats and post here. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 4, 2013 Moderators Share Posted May 4, 2013 seamonkeysproject,I told you I accepted your explanation - so stop the martyr act. Your buttons do not work because your functions started by them never return from the loop inside the function. AutoIt cannot easily break into a running function - there is a very good Interrupting a running function tutorial in the Wiki but it might be a bit advanced for you at the moment. Let me have a look at the script and I will see what I can do to get you up and running. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
seamonkeysproject Posted May 4, 2013 Author Share Posted May 4, 2013 Ok thanks Melba23 Im gonna read abit about it. Sorry for might being a martyr, thats not what I want to let others see it from. But it might my bad english. But I dosent mean nothing personals with my words. But it did maybe look like that. Im gonna eat now, while iam reading a bit. :) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 4, 2013 Moderators Share Posted May 4, 2013 seamonkeysproject,I think this script runs as you wish - the buttons toggle the various "Send" processes as you press them. Look in the SciTE console to see what is happening - i have slowed the whole thing down so that you can see each keypress and Send action as the script runs. Note that I have kept the loop in the main part of the script - that way all your buttons remain active and you do not have to break into the functions as each one just toggles a flag and returns to the main loop:expandcollapse popup#include <GUIConstantsEx.au3> ; Create some flags to show whether to run a certain process Global $fActivated = False Global $fSend1 = False Global $fSend2 = False HotKeySet("{F3}", "exitthescript") $Form2 = GUICreate("Form2", 405, 294, 391, 270) $Button1 = GUICtrlCreateButton("activate", 128, 64, 131, 25) $Button2 = GUICtrlCreateButton("send1", 136, 96, 115, 25) GUICtrlSetState($Button2, $GUI_DISABLE) ; Disable this button $Button3 = GUICtrlCreateButton("send2", 136, 136, 115, 25) GUICtrlSetState($Button3, $GUI_DISABLE) ; Disable this button $Button4 = GUICtrlCreateButton("pause", 120, 176, 147, 25) GUICtrlSetState($Button4, $GUI_DISABLE) ; Disable this button $Button5 = GUICtrlCreateButton("exit", 120, 224, 147, 25) GUISetState(@SW_SHOW) $iBegin = TimerInit() ; This is just for testing to slow down the process so you can see what is happening While 1 ; Here we look for button presses Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Button5 ; Notice you can have more than 1 control per case exitthescript() Case $Button1 ; Change the button states GUICtrlSetState($Button1, $GUI_DISABLE) ; Disable this button GUICtrlSetState($Button2, $GUI_ENABLE) ; Enable the send1 button GUICtrlSetState($Button3, $GUI_ENABLE) ; Enable the send2 button GUICtrlSetState($Button4, $GUI_ENABLE) ; Enable the pause/resume button ContinueCase ; This means run the next case down - so we toggle the Main flag Case $Button4 pause_resume() ; Toggle the Main flag Case $Button2 send1() ; Toggle the Send1 flag Case $Button3 send2() ; Toggle the Send2 flag EndSwitch If TimerDiff($iBegin) > 1000 Then ; This is just for testing to slow down the process so you can see what is happening ; Here we see if the Mian process is activated If $fActivated Then ConsoleWrite("Main Send sending keys" & @CRLF) ; now check on the 2 Send processes If $fSend1 Then ConsoleWrite("Send1 sending keys" & @CRLF) EndIf If $fSend2 Then ConsoleWrite("Send2 sending keys" & @CRLF) EndIf EndIf $iBegin = TimerInit() ; This is just for testing to slow down the process so you can see what is happening EndIf ; This is just for testing to slow down the process so you can see what is happening WEnd Func send1() ; Toggle the Send1 flag $fSend1 = Not $fSend1 ; This is just for testing so that you can see what is happening If $fSend1 Then ConsoleWrite("+Send1 running" & @CRLF) Else ConsoleWrite("!Send1 paused" & @CRLF) EndIf EndFunc ;==>send1 Func send2() ; Toggle the Send2 flag $fSend2 = Not $fSend2 ; This is just for testing so that you can see what is happening If $fSend2 Then ConsoleWrite("+Send2 running" & @CRLF) Else ConsoleWrite("!Send2 paused" & @CRLF) EndIf EndFunc ;==>send2 Func pause_resume() ; Toggle the Main flag $fActivated = Not $fActivated ; We need this If structure to change the button text If $fActivated Then GUICtrlSetData($Button4, "Pause") ConsoleWrite("+Main process running" & @CRLF) ; But this is just for testing Else GUICtrlSetData($Button4, "Resume") ConsoleWrite("!Main process paused" & @CRLF) ; But this is just for testing EndIf EndFunc ;==>pause/resume Func exitthescript() Exit EndFunc ;==>exitthescriptI have changed a lot from your script. Read the comments carefully and ask if you do not understand what I have done or why I have done it. M23 seamonkeysproject 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
seamonkeysproject Posted May 4, 2013 Author Share Posted May 4, 2013 (edited) seamonkeysproject, I think this script runs as you wish - the buttons toggle the various "Send" processes as you press them. Look in the SciTE console to see what is happening - i have slowed the whole thing down so that you can see each keypress and Send action as the script runs. Note that I have kept the loop in the main part of the script - that way all your buttons remain active and you do not have to break into the functions as each one just toggles a flag and returns to the main loop: expandcollapse popup#include <GUIConstantsEx.au3> ; Create some flags to show whether to run a certain process Global $fActivated = False Global $fSend1 = False Global $fSend2 = False HotKeySet("{F3}", "exitthescript") $Form2 = GUICreate("Form2", 405, 294, 391, 270) $Button1 = GUICtrlCreateButton("activate", 128, 64, 131, 25) $Button2 = GUICtrlCreateButton("send1", 136, 96, 115, 25) GUICtrlSetState($Button2, $GUI_DISABLE) ; Disable this button $Button3 = GUICtrlCreateButton("send2", 136, 136, 115, 25) GUICtrlSetState($Button3, $GUI_DISABLE) ; Disable this button $Button4 = GUICtrlCreateButton("pause", 120, 176, 147, 25) GUICtrlSetState($Button4, $GUI_DISABLE) ; Disable this button $Button5 = GUICtrlCreateButton("exit", 120, 224, 147, 25) GUISetState(@SW_SHOW) $iBegin = TimerInit() ; This is just for testing to slow down the process so you can see what is happening While 1 ; Here we look for button presses Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Button5 ; Notice you can have more than 1 control per case exitthescript() Case $Button1 ; Change the button states GUICtrlSetState($Button1, $GUI_DISABLE) ; Disable this button GUICtrlSetState($Button2, $GUI_ENABLE) ; Enable the send1 button GUICtrlSetState($Button3, $GUI_ENABLE) ; Enable the send2 button GUICtrlSetState($Button4, $GUI_ENABLE) ; Enable the pause/resume button ContinueCase ; This means run the next case down - so we toggle the Main flag Case $Button4 pause_resume() ; Toggle the Main flag Case $Button2 send1() ; Toggle the Send1 flag Case $Button3 send2() ; Toggle the Send2 flag EndSwitch If TimerDiff($iBegin) > 1000 Then ; This is just for testing to slow down the process so you can see what is happening ; Here we see if the Mian process is activated If $fActivated Then ConsoleWrite("Main Send sending keys" & @CRLF) ; now check on the 2 Send processes If $fSend1 Then ConsoleWrite("Send1 sending keys" & @CRLF) EndIf If $fSend2 Then ConsoleWrite("Send2 sending keys" & @CRLF) EndIf EndIf $iBegin = TimerInit() ; This is just for testing to slow down the process so you can see what is happening EndIf ; This is just for testing to slow down the process so you can see what is happening WEnd Func send1() ; Toggle the Send1 flag $fSend1 = Not $fSend1 ; This is just for testing so that you can see what is happening If $fSend1 Then ConsoleWrite("+Send1 running" & @CRLF) Else ConsoleWrite("!Send1 paused" & @CRLF) EndIf EndFunc ;==>send1 Func send2() ; Toggle the Send2 flag $fSend2 = Not $fSend2 ; This is just for testing so that you can see what is happening If $fSend2 Then ConsoleWrite("+Send2 running" & @CRLF) Else ConsoleWrite("!Send2 paused" & @CRLF) EndIf EndFunc ;==>send2 Func pause_resume() ; Toggle the Main flag $fActivated = Not $fActivated ; We need this If structure to change the button text If $fActivated Then GUICtrlSetData($Button4, "Pause") ConsoleWrite("+Main process running" & @CRLF) ; But this is just for testing Else GUICtrlSetData($Button4, "Resume") ConsoleWrite("!Main process paused" & @CRLF) ; But this is just for testing EndIf EndFunc ;==>pause/resume Func exitthescript() Exit EndFunc ;==>exitthescript I have changed a lot from your script. Read the comments carefully and ask if you do not understand what I have done or why I have done it. M23 WoW! On that way it did work alot better,Melba23! So why do you use TimerInit, it runs better aslong we have a Button whos gonna have 2 separated activity?? I didnt know that I could have it without SLeep. I did understand your work, but the way you have done it it looks also more perfect! And now you have learned me also that I can have more in 1 button, aslong we toggle tha main flag? Am I correct ? Thank Alot,Melba23! I will show you later how my work will look And I know I will need that you learned me now You`re the best Edited May 4, 2013 by Melba23 Fixed BB tags Link to comment Share on other sites More sharing options...
seamonkeysproject Posted May 4, 2013 Author Share Posted May 4, 2013 Im gonna start use that Timerinit. When I do work in script, so not everything collapse on my computer like before. I think its a good way. Easier to might also find the things who do not work, step by step. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 4, 2013 Moderators Share Posted May 4, 2013 seamonkeysproject,I only used TimerInit to slow down the whole script so that you could see what was happening - otherwise things happened so fast that it was difficult to see the various processes being started and stopped. If you remove all the lines that I indicated as "testing" you will get the script back up to full speed. Of course you do not need to use TimerInit all the time, but it can help at times. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
seamonkeysproject Posted May 4, 2013 Author Share Posted May 4, 2013 Yes Thats true Yes I did understand that why you did use it, and that was very good, because then I saw the whole thing work step by step as it should do in a slowly motion :) Thats why Im also gonna use Timerinit now. You did show me that it can be good to use Thanks alot Melba23 That was very kind of you Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 4, 2013 Moderators Share Posted May 4, 2013 seamonkeysproject, Glad I could help. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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