Gaboury Posted September 11, 2005 Posted September 11, 2005 Hey guys! I have a problem now...Here's what my program is supposed to do: #1 Have an input so you can write the scrim you want to find in mIRC. (A scrim is a war between to Counter-Strike teams.) #2 Ask you if the input is good, then search mIRC on your system, then launch it, wait until the "About mIRC" screen is clickable to pass it, then ask you if you are registered on Gamesurge (mIRC server to search for scrims). Now I can get the point 1 done and the point 2 is getting better and better... Here's the problem: If I put a "while" command for it to check if the button is enabled (because it is disabled for a certain time fpr versions unregistered....) so it checks it until it is enabled and when it gets enabled it clicks it. And then, there should be a msgbox that pops and ask if they are registered... but then the msgbox won't pop up, and I don't know why... I am a real newbie Here's the code anyway, a bit long and non well constructed as it is my first "real" program. expandcollapse popup#include <GuiConstants.au3> Dim $stop = 0, $start = 0, $time = 20;sleep time ;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 ;------------------------------------------------------------------------------------------------------------------------------------------ GUI GuiCreate("mIRC Scrim Finder", 365, 316,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Picture = GuiCtrlCreatePic("C:\Documents and Settings\Jaimie\Bureau\Jaimie\AutoIt\mIRC Scrim Finder\mircscrim.jpg", 20, 10, 325, 65) $Picture2 = GUICtrlCreatePic("C:\Documents and Settings\Jaimie\Bureau\Jaimie\AutoIt\mIRC Scrim Finder\bygab.jpg", 20, 230, 325, 65) $input1 = GuiCtrlCreateInput(".: 5 vs 5 | East | Yours | Cal-I | MAP | PM ME :.", 20, 85, 325, 22) GUICtrlSetState( -1, $GUI_FOCUS) $label1 = GuiCtrlCreateLabel("Hi. This is my first program. I made this mIRC Scrim Finder to make it easier to find scrims. Just paste whatever line you'd have posted on mIRC to find a scrim and then press Start. It will also log you in the good mIRC server and make sure you don't bypass the flood protection.", 20, 150, 320, 80) $startbutton = GuiCtrlCreateButton("Start Finding!", 130, 115, 96, 23) GUICtrlSetState( -1, $GUI_DEFBUTTON) $stopbutton = GuiCtrlCreateButton("Stop Finding!", 249, 115, 96, 23) $progress = GUICtrlCreateProgress( 20, 116, 96, 20) GUISetState() ;------------------------------------------------------------------------------------------------------------------------------------------ GUI ;------------------------------------------------------------------------------------------------------------------------------------------ Set On Event Opt("GUIOnEventMode", 1); Gui On Event ON GUICtrlSetOnEvent($startbutton, "startit") GUICtrlSetOnEvent($stopbutton, "stopit") GUISetOnEvent($GUI_EVENT_CLOSE, "Closeit") ;------------------------------------------------------------------------------------------------------------------------------------------ Set On Event ;------------------------------------------------------------------------------------------------------------------------------------------ GUI Commands While 1 If $start = 1 Then While 2 $getinput = GUICtrlRead($input1) $askbox1 = MsgBox(4, "Are you sure?", "Are those informations about the scrim the good ones?" & @CRLF & $getinput) If $askbox1 = 7 Then MsgBox(0, "Canceled", "The search has been canceled. Please rectify the informations and search again.", 3) $start = 0 ExitLoop ElseIf $askbox1 = 6 Then MsgBox(0, "Info", "The scrim information has been accepted. Please be patient while mIRC Scrim Finder tries to find your scrim.", 3) $readiniconfig = IniRead(@HomeDrive & "\mIRCScrimFinder\config.ini", "Path", "$mircpath", "NotFound") If Not $readiniconfig = "NotFound" Then Call("mircstart") ElseIf $readiniconfig = "NotFound" Then GUICtrlSetData($progress, 10) MsgBox(0, "Info", "Please wait as we find your mIRC executable. That action may take up to one minute depending on your system." & @CRLF & "Note that this will only happen the first time you launch this program.", 5) GUICtrlSetData($progress, 20) Sleep($time) If $stop = 1 Then ExitLoop Sleep(1000) GUICtrlSetData($progress, 30) Sleep($time) If $stop = 1 Then ExitLoop runWait(@comspec & ' /c dir /b /s ' & @HomeDrive & '\mirc.exe > "' & @HomeDrive & '\result.txt"', @HomeDrive, @SW_HIDE) GUICtrlSetData($progress, 60) Sleep($time) If $stop = 1 Then ExitLoop $resultopen = FileOpen(@HomeDrive & "\result.txt", 0 ) GUICtrlSetData($progress, 70) Sleep($time) If $stop = 1 then ExitLoop $resultread = FileReadLine($resultopen) GUICtrlSetData($progress, 80) Sleep($time) If $stop = 1 then ExitLoop FileClose($resultopen) DirCreate (@HomeDrive & "\mIRCScrimFinder\") GUICtrlSetData($progress, 90) Sleep($time) If $stop = 1 then ExitLoop IniWrite(@homeDrive & "\mIRCScrimFinder\config.ini", "Path", "$mircpath", $resultread) FileInstall("c:\documents and settings\jaimie\bureau\jaimie\AutoIt\mIRC Scrim Finder\mircscrim.jpg", @HomeDrive & "\mIRCScrimFinder\") FileInstall("c:\documents and settings\jaimie\bureau\jaimie\AutoIt\mIRC Scrim Finder\bygab.jpg", @HomeDrive & "\mIRCScrimFinder\") GUICtrlSetData($progress, 100) Sleep($time) EndIf If $stop = 1 then ExitLoop MsgBox(0, "Detected.", "mIRC Scrim Finder detected the path to your mIRC executable." & @CRLF & "The starting is now only a question of seconds." & @CRLF & "Click Ok when you are ready to continue.") $start = 0 MsgBox(0, "Don't Touch...", "Please don't touch anything unless the program asks you to." & @CRLF & "It will prevent this program from making errors. That means you cannot play Counter-Strike during the time it searches. Thanks.", 5) Call("mircstart") ExitLoop EndIf WEnd EndIf WEnd ;------------------------------------------------------------------------------------------------------------------------------------------------------- GUI Commands ;-------------------------------------------------------------------------------------------------------------------------------------------------------Function Func startit() $start = 1 EndFunc Func stopit() $stop = 1 WinActivate("mIRC") WinKill("mIRC") MsgBox(0, "Aborted", "Search has been aborted.") EndFunc Func closeit() $surequit = MsgBox(4, "Closing...", "Are you sure you want to quit?") If $surequit = 6 Then MsgBox(0, "Closing...", "You requested mIRC Scrim Finder to close." & @CRLF & " Now Exiting...", 1) Exit ElseIf $surequit = 7 Then EndIf EndFunc Func mircstart() $readiniconfig1 = IniRead(@HomeDrive & "\mIRCScrimFinder\config.ini", "Path", "$mircpath", "NotFound") Run($readiniconfig1) While 3 If WinWaitActive("About mIRC") = 1 Then While 4 WinActivate("About mIRC") $checkcontinue = ControlCommand("About mIRC", "", 1, "", "IsEnabled") If $checkcontinue = 1 Then ControlClick("About mIRC", "", 1) Else EndIf WEnd Else EndIf WEnd EndFunc Func creategui() GuiCreate("Registered?", 364, 119,(@DesktopWidth-364)/2, (@DesktopHeight-119)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $yesreg= GuiCtrlCreateButton("Ok", 70, 70, 100, 30) $noreg = GuiCtrlCreateButton("Register", 180, 70, 110, 30) GUICtrlSetOnEvent($noreg, "register") GUICtrlSetOnEvent($yesreg, "continue") $registered = GuiCtrlCreateLabel("To use the GameSurge Server to search for scrim, you must register on GameSurge's Website. If you already have an account, please click Ok. If you would like to be redirected to GameSurge's Website to create one, please click the Register button.", 20, 10, 320, 60) GUISetState(@SW_SHOW) EndFunc Func register() Guidelete() $url = "http://www.gamesurge.net/createaccount/" Run(@Comspec & " /c start " & $url) WinWaitActive("Game") MsgBox(0, "Info", "Please fill in the informations needed to create your account. When that is done, please press F10 to continue mIRC Scrim Finder.") HotKeySet("{F10}", "continue") EndFunc Func continue() Guidelete() HotKeySet("{F10}") MsgBox(0, "Continuing...", "mIRC Scrim Finder should restart searching soon.") EndFunc ;-------------------------------------------------------------------------------------------------------------------------------------------------------Functions I guess it's bad at the end that a function alls another function and everything, but it is my first so I didn't know how to do that without calling functions over functions Thanks ! - Gaboury.
CodeMaster Rapture Posted September 11, 2005 Posted September 11, 2005 Check out the attachment. I cleaned up some of your code and I believe I found the problem. Read the comments inside. -CMR
Gaboury Posted September 11, 2005 Author Posted September 11, 2005 Going to check that right now...thanks
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