Gaboury Posted September 4, 2005 Share Posted September 4, 2005 Hi guys... I am making a mIRC Scrim Finder. Now, the gui is okay, and it works pretty good BUT! When I launch it, sometimes it gives an error, sometimes it doesn't (it says it cannot read the ini file...) and then also when you launch it, it works all etc, and then it opens mIRC, and when you close mIRC then there is a weird problem..because now it makes a loop that doesn't make itself the first time you launch it...and there's no way of removing that... Well here's the code, if there is anything that I should change tell me why 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 Auto Searcher", 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 Automatic Scrim Searcher\mircscrim.jpg", 20, 10, 325, 65) $Picture2 = GUICtrlCreatePic("C:\Documents and Settings\Jaimie\Bureau\Jaimie\AutoIt\mIRC Automatic Scrim Searcher\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") ExitLoop ElseIf $readiniconfig = "NotFound" Then GUICtrlSetData($progress, 10) MsgBox(0, "Info", "Please wait as we find your mIRC executable" & @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) 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.", 2) $start = 0 $readiniconfig1 = IniRead(@HomeDrive & "\mIRCScrimFinder\config.ini", "Path", "$mircpath", "NotFound") Call("mircstart") ExitLoop EndIf WEnd EndIf WEnd ;------------------------------------------------------------------------------------------------------------------------------------------------------- GUI Commands ;-------------------------------------------------------------------------------------------------------------------------------------------------------Function Func startit() $start = 1 EndFunc Func stopit() $stop = 1 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...", 2) Exit ElseIf $surequit = 7 Then EndIf EndFunc Func mircstart() $start = 0 $stop = 1 Run($readiniconfig1) WinActivate("mIRC") WinWaitActive("mIRC") Send("{ENTER}") EndFunc ;-------------------------------------------------------------------------------------------------------------------------------------------------------Functions Link to comment Share on other sites More sharing options...
quaizywabbit Posted September 4, 2005 Share Posted September 4, 2005 curious.....what is a 'Scrim'? [u]Do more with pre-existing apps![/u]ANYGUIv2.8 Link to comment Share on other sites More sharing options...
Gaboury Posted September 4, 2005 Author Share Posted September 4, 2005 I fight between 2 counter-strike teams Please someone help me! Link to comment Share on other sites More sharing options...
Gaboury Posted September 5, 2005 Author Share Posted September 5, 2005 Someone?!? Link to comment Share on other sites More sharing options...
LxP Posted September 5, 2005 Share Posted September 5, 2005 (edited) Hmm, the way you have indented your script is quite confusing. When you say:If $askbox1 = 7 Then MsgBox(...) $start = 0 ExitLoop ElseIf $askbox1 = 6 Then MsgBox(...) $readiniconfig = IniRead(...) If Not $readiniconfig = "NotFound" Thendo you mean for the final line to be part of the ElseIf block? Logically this is what is happening, but your indentation suggests that you do not want it to work this way in which case you would say:If $askbox1 = 7 Then MsgBox(...) $start = 0 ExitLoopElseIf $askbox1 = 6 Then MsgBox(...) $readiniconfig = IniRead(...)EndIfIf Not $readiniconfig = "NotFound" ThenEdit: To be clear on what I'm saying, it is good practice to indent blocks of code like this:while (1) ; code wEnd ··· if (condition) then ; code else ; code endIfTake note of how the outside statements are all aligned equally. Edited September 5, 2005 by LxP Link to comment Share on other sites More sharing options...
Gaboury Posted September 5, 2005 Author Share Posted September 5, 2005 Well I got it alone I had a "ExitLoop" somewhere that hadn't to be there, thus making the loop to restart always (because it was closing the "while 2", but not the "while 1")... Got it to work now Works perfectly Now I only have to add the mIRC part into that and it should be fine Thanks for your help 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