AzKay Posted July 3, 2006 Share Posted July 3, 2006 Ok, Say, I press start autopost, then it starts, but then I go to start autopoll, or "Hide" and they dont function. If I start autopoll, then the autopost or "Hide" dont work, etc.. How can I fix it so, all of the buttons work, anytime? expandcollapse popup#include <GUIConstants.au3> #include <IE.au3> HotKeySet("^!h", "UnHide") If FileExists("GaiaBot.ini") Then TrayTip("", "**GaiaBot.ini Exists**", 5) Sleep(1000) TrayTip("", "", 0) Else FileOpen("GaiaBot.ini", 2) IniWrite("GaiaBot.ini", "Poster Thread", "Url", "") FileWriteLine("GaiaBot.ini", "") IniWrite("GaiaBot.ini", "Poster Reply Button", "Url", "") FileWriteLine("GaiaBot.ini", "") IniWrite("GaiaBot.ini", "Message", "ToPost", "") FileWriteLine("GaiaBot.ini", "") IniWrite("GaiaBot.ini", "Poller Thread", "Url", "") FileWriteLine("GaiaBot.ini", "") IniWrite("GaiaBot.ini", "Poller Edit Button", "ToEdit", "") FileClose("GaiaBot.ini") EndIf GUICreate("GaiaBot", 498, 456) GUISetFont(9, 300) $TAB = GUICtrlCreateTab (0,0, 500, 500) $Button3 = GUICtrlCreateButton("Hide", 413, 1, 85, 19) $TAB_POST = GUICtrlCreateTabitem ("Poster") $IE_POST = ObjCreate("Shell.Explorer.2") $IE_POST_CTRL = GUICtrlCreateObj($IE_Post, 1, 25, 496, 447) $Button1 = GUICtrlCreateButton("Start AutoPost", 328, 1, 85, 19) $TAB_POLL = GUICtrlCreateTabitem ( "Poller") $IE_POLL = ObjCreate("Shell.Explorer.2") $IE_POLL_CTRL = GUICtrlCreateObj($IE_Poll, 1, 25, 496, 447) $Button2 = GUICtrlCreateButton("Start AutoPoll", 328, 1, 85, 19) GUICtrlCreateTabitem ("") ; end tabitem definition GUISetState () ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 _IENavigate($IE_POST, IniRead("GaiaBot.ini", "Poster Thread", "Url", "")) While 1 _IEImgClick ($IE_POST, IniRead( "GaiaBot.ini", "Poster Reply Button", "Url", ""), "src", 1) _IENavigate ($IE_POST, "java script:emoticon('" & IniRead( "GaiaBot.ini", "Message", "ToPost", "") & "')", 0) $Post = _IEFormGetObjByName ($IE_POST, "Post") _IEFormImageClick ($Post, "Submit", "Alt") Sleep(50000) WEnd Case $msg = $Button2 _IENavigate($IE_POLL, IniRead("GaiaBot.ini", "Poller Thread", "Url", "")) While 1 _IEImgClick ($IE_POLL, IniRead("GaiaBot.ini", "Poller Edit Button", "ToEdit", "")) $Form1 = _IEFormGetObjByName ($IE_POLL, "post") $RemovePoll = _IEFormElementGetObjByName ($Form1, "delpollbtn") _IEAction ($RemovePoll, "click") _IELoadWait ($IE_POLL) $Form2 = _IEFormGetObjByName ($IE_POLL, "post") $Poll_Title = _IEFormElementGetObjByName ($Form2, "poll_title") $Poll_Option = _IEFormElementGetObjByName ($Form2, "add_poll_option_text") _IEFormElementSetValue ($Poll_Title, "=]") _IEFormElementSetValue ($Poll_Option, "=]") _IEFormImageClick ($Form2, "Submit", "alt") _IENavigate ($IE_POLL, IniRead("GaiaBot.ini", "Poller Thread", "Url", "")) $Poll = $IE_POLL.document.forms (0) $Radio = _IEFormElementGetObjByName ($Poll, "vote_id") $Submit = _IEFormElementGetObjByName ($Poll, "submit") _IEAction ($Radio, "click") _IEAction ($Submit, "click") Sleep(20000) WEnd Case $msg = $Button3 MsgBox(0, "", "To Unhide Press Ctrl Alt H") WinSetState("GaiaBot", "", @SW_HIDE) EndSelect Wend Func UnHide() WinSetState("GaiaBot", "", @SW_SHOW) EndFunc # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
AzKay Posted July 3, 2006 Author Share Posted July 3, 2006 Im guessing its something to do with my loops? # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
Developers Jos Posted July 3, 2006 Developers Share Posted July 3, 2006 (edited) Im guessing its something to do with my loops?Have you ever tried debugging your scripts ?Add consoleWrite() at places you want to know when your script get there and try to understand the flow of your program.....This way you can answer your own questions in stead of doing this guessing game .. Edited July 3, 2006 by JdeB SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
AzKay Posted July 3, 2006 Author Share Posted July 3, 2006 Hehe, oke, Ill try that ^^ # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
AzKay Posted July 3, 2006 Author Share Posted July 3, 2006 Hehe, oke, Ill try that ^^Im already confused ^^; I looked up consolewrite()But, I dont understand, where am I meant to put that, what data etc. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
Developers Jos Posted July 3, 2006 Developers Share Posted July 3, 2006 Im already confused ^^; I looked up consolewrite()But, I dont understand, where am I meant to put that, what data etc.Are you running your scripts from SciTE ?If so: put your cursor on a field and hit Alt+D. this will insert a ConsoleWite() below the line and then when you run your script, these consolewrite() stataments will display the info in the Output pane. SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
AzKay Posted July 3, 2006 Author Share Posted July 3, 2006 Are you running your scripts from SciTE ?If so: put your cursor on a field and hit Alt+D. this will insert a ConsoleWite() below the line and then when you run your script, these consolewrite() stataments will display the info in the Output pane.Im still confused ^^; & yes, I get confused VERY easily... # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
Developers Jos Posted July 3, 2006 Developers Share Posted July 3, 2006 Im still confused ^^; & yes, I get confused VERY easily...Could you try to :- give more info about what you are confused about?- What you tried ?- where you got stuck?- If you are using SciTE?In other words you need to think about what it is you want to get an answer on before posting these one-liners. I am sure you will get more and better help..... SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
AzKay Posted July 3, 2006 Author Share Posted July 3, 2006 Ok, Im using SciTE Im having trouble, basically, getting the buttons to work. The purpose of the script, is to continously, post in a topic, and/or poll in a topic continuously. Im completly stuck on how to use the consolewrite, I know how to add it, like you said "alt d" then run it, but I dont know what im actually supposed to be looking at. Im thinking its something to do with the loops under $Button1 & $Button2. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
Developers Jos Posted July 3, 2006 Developers Share Posted July 3, 2006 (edited) Ok, Im using SciTEIm having trouble, basically, getting the buttons to work.The purpose of the script, is to continously, post in a topic, and/or poll in a topic continuously.Im completly stuck on how to use the consolewrite, I know how to add it, like you said "alt d" then run it, but I dont know what im actually supposed to be looking at. Im thinking its something to do with the loops under $Button1 & $Button2.Ok that sets the stage...Now... what is it you want your script to do after you press a button ?and what does your script do when either button is pressed ?Currently it looks to me that it goes into an endless loop.How does it ever leave the Do-Until loop when $Button1 or $Button2 are pressed ?Now ask yourself again your own question but this time add the question... How does my script know what button is pressed ?You need to constantly check for that by doing: $msg = GUIGetMsg() and checking the result.Now anytime you wonder what the value of a Variable is you add a Debug line in your script so it will display that value at the time the line is executed.ok.. I am stopping here but have just tried to give you some guidelines in how you should be testing/debugging scrips. Edited July 3, 2006 by JdeB SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
AzKay Posted July 4, 2006 Author Share Posted July 4, 2006 Ok that sets the stage...Now... what is it you want your script to do after you press a button ?I want it to, repeat the autoposting, autopolling & keep the ability to hide-unhide, its currently, only letting me either autopost or autopoll, it wont let me do It simultaniouslty (arhg spelling).and what does your script do when either button is pressed ?After I press, AutoPost, it navigates to the url, clicks the reply button, posts a message, clicks submit, then repeats, until I exit the script. Same with the poller, but it votes in the poll. the hide button, I guess you know what that would do.Currently it looks to me that it goes into an endless loop.That is correct, well, I want it to be endless, yet be able to use the other buttons to call the other functionsHow does it ever leave the Do-Until loop when $Button1 or $Button2 are pressed ?Now ask yourself again your own question but this time add the question... How does my script know what button is pressed ?You need to constantly check for that by doing: $msg = GUIGetMsg() and checking the result.Now anytime you wonder what the value of a Variable is you add a Debug line in your script so it will display that value at the time the line is executed.ok.. I am stopping here but have just tried to give you some guidelines in how you should be testing/debugging scrips.And, the rest, im getting even confused more, Im about to just ditch the script and let it rot away >< # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
WTS Posted July 4, 2006 Share Posted July 4, 2006 Im guessing its something to do with my loops? You're probably right.. You used a while 1/wend loops with a sleep() I'm going to guess but that will probably freeze the entire script. try you're script in onevent mode.. with debugging expandcollapse popup#include <GUIConstants.au3> #include <IE.au3> HotKeySet("^!h", "UnHide") Opt('GUIOnEventMode',1) Opt('TrayIconDebug',1);<<< Debug If FileExists("GaiaBot.ini") Then TrayTip("", "**GaiaBot.ini Exists**", 5) Sleep(1000) TrayTip("", "", 0) Else FileOpen("GaiaBot.ini", 2) IniWrite("GaiaBot.ini", "Poster Thread", "Url", "") FileWriteLine("GaiaBot.ini", "") IniWrite("GaiaBot.ini", "Poster Reply Button", "Url", "") FileWriteLine("GaiaBot.ini", "") IniWrite("GaiaBot.ini", "Message", "ToPost", "") FileWriteLine("GaiaBot.ini", "") IniWrite("GaiaBot.ini", "Poller Thread", "Url", "") FileWriteLine("GaiaBot.ini", "") IniWrite("GaiaBot.ini", "Poller Edit Button", "ToEdit", "") FileClose("GaiaBot.ini") EndIf GUICreate("GaiaBot", 498, 456) GUISetFont(9, 300) $TAB = GUICtrlCreateTab (0,0, 500, 500) $Button3 = GUICtrlCreateButton("Hide", 413, 1, 85, 19) $TAB_POST = GUICtrlCreateTabitem ("Poster") $IE_POST = ObjCreate("Shell.Explorer.2") $IE_POST_CTRL = GUICtrlCreateObj($IE_Post, 1, 25, 496, 447) $Button1 = GUICtrlCreateButton("Start AutoPost", 328, 1, 85, 19) $TAB_POLL = GUICtrlCreateTabitem ( "Poller") $IE_POLL = ObjCreate("Shell.Explorer.2") $IE_POLL_CTRL = GUICtrlCreateObj($IE_Poll, 1, 25, 496, 447) $Button2 = GUICtrlCreateButton("Start AutoPoll", 328, 1, 85, 19) GUISetOnEvent($GUI_EVENT_CLOSE,'MyFunc') GUISetOnEvent($GUI_EVENT_MINIMIZE,'MyFunc') GUISetOnEvent($GUI_EVENT_MAXIMIZE,'MyFunc') GUICtrlSetOnEvent($Button3,'MyFunc') GUICtrlSetOnEvent($Button2,'MyFunc') GUICtrlSetOnEvent($Button1,'MyFunc') GUICtrlCreateTabitem ("") ; end tabitem definition GUISetState () While 1 Wend Func MyFunc() If @GUI_CtrlId = $GUI_EVENT_CLOSE Then Exit If @GUI_CtrlId = $GUI_EVENT_MINIMIZE Then GUISetState(@SW_MINIMIZE) If @GUI_CtrlId = $GUI_EVENT_MAXIMIZE Then GUISetState(@SW_MAXIMIZE) Select Case @GUI_CtrlId = $Button1 ConsoleWrite('Clicked Button 1');<<< Debug _IENavigate($IE_POST, IniRead("GaiaBot.ini", "Poster Thread", "Url", "")) While 1 _IEImgClick ($IE_POST, IniRead( "GaiaBot.ini", "Poster Reply Button", "Url", ""), "src", 1) _IENavigate ($IE_POST, "java script:emoticon('" & IniRead( "GaiaBot.ini", "Message", "ToPost", "") & "')", 0) $Post = _IEFormGetObjByName ($IE_POST, "Post") _IEFormImageClick ($Post, "Submit", "Alt") ;Sleep(50000);< Sleep doesn't get along with a gui. WEnd Case @GUI_CtrlId = $Button2 ConsoleWrite('Clicked Button 2');<<< Debug _IENavigate($IE_POLL, IniRead("GaiaBot.ini", "Poller Thread", "Url", "")) While 1 _IEImgClick ($IE_POLL, IniRead("GaiaBot.ini", "Poller Edit Button", "ToEdit", "")) $Form1 = _IEFormGetObjByName ($IE_POLL, "post") $RemovePoll = _IEFormElementGetObjByName ($Form1, "delpollbtn") _IEAction ($RemovePoll, "click") _IELoadWait ($IE_POLL) $Form2 = _IEFormGetObjByName ($IE_POLL, "post") $Poll_Title = _IEFormElementGetObjByName ($Form2, "poll_title") $Poll_Option = _IEFormElementGetObjByName ($Form2, "add_poll_option_text") _IEFormElementSetValue ($Poll_Title, "=]") _IEFormElementSetValue ($Poll_Option, "=]") _IEFormImageClick ($Form2, "Submit", "alt") _IENavigate ($IE_POLL, IniRead("GaiaBot.ini", "Poller Thread", "Url", "")) $Poll = $IE_POLL.document.forms (0) $Radio = _IEFormElementGetObjByName ($Poll, "vote_id") $Submit = _IEFormElementGetObjByName ($Poll, "submit") _IEAction ($Radio, "click") _IEAction ($Submit, "click") ;Sleep(20000) WEnd Case @GUI_CtrlId = $Button3 MsgBox(0, "", "To Unhide Press Ctrl Alt H") WinSetState("GaiaBot", "", @SW_HIDE) EndSelect EndFunc Func UnHide() WinSetState("GaiaBot", "", @SW_SHOW) EndFunc Link to comment Share on other sites More sharing options...
WTS Posted July 4, 2006 Share Posted July 4, 2006 Ok that sets the stage...Now... what is it you want your script to do after you press a button ?and what does your script do when either button is pressed ?Currently it looks to me that it goes into an endless loop.How does it ever leave the Do-Until loop when $Button1 or $Button2 are pressed ?Now ask yourself again your own question but this time add the question... How does my script know what button is pressed ?You need to constantly check for that by doing: $msg = GUIGetMsg() and checking the result.Now anytime you wonder what the value of a Variable is you add a Debug line in your script so it will display that value at the time the line is executed.ok.. I am stopping here but have just tried to give you some guidelines in how you should be testing/debugging scrips.he means your script is dead/sleeping forever after you press the button you'd figure out where to fix the problem by have autoit tell you where autoit has ended up.. thats where Opt('TrayIconDebug',1);<<< Debug comes in.. Link to comment Share on other sites More sharing options...
AzKay Posted July 4, 2006 Author Share Posted July 4, 2006 Hmm, you said the sleeps dont go with gui's, Is alternate way? Becuase, I need sleeps, Because, its, liek, the forum has flood control you can post every 50 seconds # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
Developers Jos Posted July 4, 2006 Developers Share Posted July 4, 2006 And, the rest, im getting even confused more, Im about to just ditch the script and let it rot away ><Typical reaction of a young person still learning to walk and wants to win the 100M sprint at the same time.Take it one step at the time and also you will get there.Important first lesson: ONLY work on scripts you understand first. Programming isn't about trial and error. SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
AzKay Posted July 4, 2006 Author Share Posted July 4, 2006 Typical reaction of a young person still learning to walk and wants to win the 100M sprint at the same time.Take it one step at the time and also you will get there.Important first lesson: ONLY work on scripts you understand first. Programming isn't about trial and error.Hehe, Then, I guess, Ill keep doing other scripts, simpliar (sp) until I get it working. Thanks for the help anyway. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
Developers Jos Posted July 4, 2006 Developers Share Posted July 4, 2006 (edited) Hmm, you said the sleeps dont go with gui's, Is alternate way? Becuase, I need sleeps, Because, its, liek, the forum has flood control you can post every 50 secondsThere are other ways to accomplish this.Main requirement with GUI scripts: You must run the loop that reads the message pump if you want the GUI to respond to your control actions.Just use TimerInit() and TimerDiff() in the main loop to test to see how long has gone by since an action. Edited July 4, 2006 by JdeB SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
WTS Posted July 4, 2006 Share Posted July 4, 2006 did you even try the script i posted? :"> Link to comment Share on other sites More sharing options...
AzKay Posted July 5, 2006 Author Share Posted July 5, 2006 Mhm. # MY LOVE FOR YOU... IS LIKE A TRUCK- # 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