SofaKingWeTardEd Posted February 12, 2008 Share Posted February 12, 2008 Heya! Yes, i'm back, with another question. I'm creating a script (duh!) and i'm having alot of trouble figuring out If/EndIf/Then/Next etc If this is an easy part, please slap me as hard as you can.I've made some of my script (Works fine), but I need an If entering in it. I need it to check if "[CLASSNN:TStaticText1]" has the Text "1", and if it does; Give a MsgBox and stop the bot. And if it isn't "1", then to send a few keys then repeat. Just helping me with the layout of this would be extremely appreciatedNow, i'm not asking for all the script to be written, but the fundementals of If/EndIf/Then/Next so I can be on my way to make more advanced scripts in the future.Thank you ever so much if you take your time to help me! Link to comment Share on other sites More sharing options...
Tomb Posted February 12, 2008 Share Posted February 12, 2008 (edited) ok how it works is you start out with an If statement and after you put your If you put a Then ---> If $x = 1 Then now you can put an Else or ElseIf. Else is just if the If is not true. ElseIf requires a second statement. for example ----------------------------------> ElseIf $x = 2 Then you can use as many ElseIf's as you want. when all of your ElseIf's are added, you end with a EndIf -------------------------> EndIf so for example you could say $x = random(1, 2, 1) If $x = 1 Then MsgBox(0, "hi", "Autoit is cool and your result is " & $x) ElseIf $x = 2 Then MsgBox(0, "hi", "AUTOIT F*CKING OWNS. RESULT IS " & $x) EndIf Edited February 12, 2008 by Tomb616 Link to comment Share on other sites More sharing options...
SofaKingWeTardEd Posted February 12, 2008 Author Share Posted February 12, 2008 ok how it works is you start out with an If statement and after you put your If you put a Then ---> If $x = 1 Then now you can put an Else or ElseIf. Else is just if the If is not true. ElseIf requires a second statement. for example ----------------------------------> ElseIf $x = 2 Then you can use as many ElseIf's as you want. when all of your ElseIf's are added, you end with a EndIf -------------------------> EndIf so for example you could say $x = random(1, 2, 1) If $x = 1 Then MsgBox(0, "hi", "Autoit is cool and your result is " & $x) ElseIf $x = 2 Then MsgBox(0, "hi", "AUTOIT F*CKING OWNS. RESULT IS " & $x) EndIf Hey, I get it! That's awesome, thank yooooouuuu Is there anyway to get the MsgBox to Display what text is in TStaticText2 & TStaticText3 also? What make an excellent addition. Link to comment Share on other sites More sharing options...
Tomb Posted February 12, 2008 Share Posted February 12, 2008 sure no problem actually yes you can change MsgBox text Local $ChangeText[4] = ['', 'Enable', 'Disable', 'Quit'] $iMsg = _MsgBoxEx(3, 'nothing', 'something', 0, $ChangeText) MsgBox(64, 'Info', 'The Return Was: ' & $iMsg) Func _MsgBoxEx($iFlag, $sTitle, $sText, $iTime = 0, $sCIDChange = '') Local $_MsgBox_ = '"' & "ConsoleWrite(MsgBox(" & $iFlag & ', ""' & $sTitle & '"", ""' & $sText & '"", ' & $iTime & '"))' Local $iPID = Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $_MsgBox_, '', @SW_SHOW, 6) Do Sleep(10) Until WinExists($sTitle) If IsArray($sCIDChange) Then For $iCC = 1 To UBound($sCIDChange) - 1 ControlSetText($sTitle, '', 'Button' & $iCC, $sCIDChange[$iCC]) Next Else ControlSetText($sTitle, '', 'Button1', $sCIDChange) EndIf While ProcessExists($iPID) Local $iStdOut = StdoutRead($iPID) If Number($iStdOut) Then Return $iStdOut Sleep(10) WEnd If IsArray($sCIDChange) Then Return SetError(1, 0, 2) Return SetError(1, 0, 1) EndFunc Link to comment Share on other sites More sharing options...
SofaKingWeTardEd Posted February 12, 2008 Author Share Posted February 12, 2008 sure no problem actually yes you can change MsgBox text Local $ChangeText[4] = ['', 'Enable', 'Disable', 'Quit'] $iMsg = _MsgBoxEx(3, 'nothing', 'something', 0, $ChangeText) MsgBox(64, 'Info', 'The Return Was: ' & $iMsg) Func _MsgBoxEx($iFlag, $sTitle, $sText, $iTime = 0, $sCIDChange = '') Local $_MsgBox_ = '"' & "ConsoleWrite(MsgBox(" & $iFlag & ', ""' & $sTitle & '"", ""' & $sText & '"", ' & $iTime & '"))' Local $iPID = Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $_MsgBox_, '', @SW_SHOW, 6) Do Sleep(10) Until WinExists($sTitle) If IsArray($sCIDChange) Then For $iCC = 1 To UBound($sCIDChange) - 1 ControlSetText($sTitle, '', 'Button' & $iCC, $sCIDChange[$iCC]) Next Else ControlSetText($sTitle, '', 'Button1', $sCIDChange) EndIf While ProcessExists($iPID) Local $iStdOut = StdoutRead($iPID) If Number($iStdOut) Then Return $iStdOut Sleep(10) WEnd If IsArray($sCIDChange) Then Return SetError(1, 0, 2) Return SetError(1, 0, 1) EndFunc Is there no other way? That's looks way out of my league. Lol Link to comment Share on other sites More sharing options...
Tomb Posted February 12, 2008 Share Posted February 12, 2008 a way to change message box text? or something else? Link to comment Share on other sites More sharing options...
SofaKingWeTardEd Posted February 12, 2008 Author Share Posted February 12, 2008 a way to change message box text?or something else?ControlGetText I was/am using. The Text inside TStaticTextX I would like displayed inside the MsgBox? :/ Link to comment Share on other sites More sharing options...
SofaKingWeTardEd Posted February 12, 2008 Author Share Posted February 12, 2008 Nevermind! I found out by trail and error! Thank you Tomb for your help. Hugely appreciated! Link to comment Share on other sites More sharing options...
Tomb Posted February 12, 2008 Share Posted February 12, 2008 sure no problem now im curious, how did you do it. Link to comment Share on other sites More sharing options...
SofaKingWeTardEd Posted February 12, 2008 Author Share Posted February 12, 2008 sure no problem now im curious, how did you do it. Kinda like: $x = ControlGetText ("Window","","[CLASSNN:TStaticTextX]") MsgBox (46,"Window Name","X=" & $x,0) Link to comment Share on other sites More sharing options...
FreeFry Posted February 12, 2008 Share Posted February 12, 2008 A tip when you're looking for help is to post the actuall code you have, it will be alot easier to understand what you're having problems with. 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