DarkNecromancer Posted September 13, 2005 Share Posted September 13, 2005 (edited) I am having problems getting GUICtrlRead to work properly. I have it 'read' an edit box and it returns everything fine the first time it reads it, but if i have it read it again, the guictrlread returns 0, it always returns 0 no matter what i try. I have a this:Dim $var =engine("0", GuiCtrlRead($script)) this leads to the functionFunc Engine($code, $text) If $code = 0 Then Dim $script = StringSplit($text, @CRLF, 1) Dim $parsedcode For $i=1 To $script[0] Dim $temp, $temp2 $temp = Stringsplit($script[$i], "(", 1) If $temp[0] = 2 Then $temp2 = StringSplit($temp[2], ")", 1) If $temp[1] = "runas" Then Else Return("Error: " & $script[$i] & " on line " & $i & " is not a recognized command") EndIf Else Return("Error: " & $script[$i] & " on line " & $i & ". Need ()") EndIf Next Return("") ElseIf $code = 1 Then Else return("ERROR, invalid process code") EndIf EndFunc I have tryed several different 'parsing' code variations and i've checked the $text variable coming into the loop, and no matter what i do, the second time the function is called the GuiCtrlRead returns 0. ~Dark Edited September 13, 2005 by DarkNecromancer Link to comment Share on other sites More sharing options...
GaryFrost Posted September 13, 2005 Share Posted September 13, 2005 I am having problems getting GUICtrlRead to work properly. I have it 'read' an edit box and it returns everything fine the first time it reads it, but if i have it read it again, the guictrlread returns 0, it always returns 0 no matter what i try. I have a this:Dim $var =engine("0", GuiCtrlRead($script))this leads to the functionFunc Engine($code, $text) If $code = 0 Then Dim $script = StringSplit($text, @CRLF, 1) Dim $parsedcode For $i=1 To $script[0] Dim $temp, $temp2 $temp = Stringsplit($script[$i], "(", 1) If $temp[0] = 2 Then $temp2 = StringSplit($temp[2], ")", 1) If $temp[1] = "runas" Then Else Return("Error: " & $script[$i] & " on line " & $i & " is not a recognized command") EndIf Else Return("Error: " & $script[$i] & " on line " & $i & ". Need ()") EndIf Next Return("") ElseIf $code = 1 Then Else return("ERROR, invalid process code") EndIf EndFuncI have tryed several different 'parsing' code variations and i've checked the $text variable coming into the loop, and no matter what i do, the second time the function is called the GuiCtrlRead returns 0. ~Dark<{POST_SNAPBACK}>I see you have you read on the same line as the dim, so i'm guessing it's not in a loop or after a button? SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
DarkNecromancer Posted September 14, 2005 Author Share Posted September 14, 2005 (edited) yeah the Dim line is executed by a button, and if i click th ebutton twice, no matter what i do, after the first time, it always 'reads' 0 ElseIf $msg = $load Then Dim $var = engine("0", GuiCtrlRead($script)) msgbox(0,"",$var) ~Dark Edited September 14, 2005 by DarkNecromancer Link to comment Share on other sites More sharing options...
GaryFrost Posted September 14, 2005 Share Posted September 14, 2005 (edited) I am having problems getting GUICtrlRead to work properly. I have it 'read' an edit box and it returns everything fine the first time it reads it, but if i have it read it again, the guictrlread returns 0, it always returns 0 no matter what i try. I have a this:Dim $var =engine("0", GuiCtrlRead($script))this leads to the functionFunc Engine($code, $text) If $code = 0 Then Dim $script = StringSplit($text, @CRLF, 1) Dim $parsedcode For $i=1 To $script[0] Dim $temp, $temp2 $temp = Stringsplit($script[$i], "(", 1) If $temp[0] = 2 Then $temp2 = StringSplit($temp[2], ")", 1) If $temp[1] = "runas" Then Else Return("Error: " & $script[$i] & " on line " & $i & " is not a recognized command") EndIf Else Return("Error: " & $script[$i] & " on line " & $i & ". Need ()") EndIf Next Return("") ElseIf $code = 1 Then Else return("ERROR, invalid process code") EndIf EndFuncI have tryed several different 'parsing' code variations and i've checked the $text variable coming into the loop, and no matter what i do, the second time the function is called the GuiCtrlRead returns 0. ~Dark<{POST_SNAPBACK}>Name your variable for the Edit control something like $EditBox, then do the read using that name, should worklook in your function for what name of variables you have and what your edit control id is stored in. Edited September 14, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
DarkNecromancer Posted September 14, 2005 Author Share Posted September 14, 2005 O sorry, here is all the relevent information $load = GuiCtrlCreateButton ( "Load Script", 10, 35 ) $script = GuiCtrlCreateEdit ( "", 5, 70, 490, 400) ;Msg loop ElseIf $msg = $load Then Dim $var = engine("0", GuiCtrlRead($script)) msgbox(0,"",$var) EndIf ;engine function Func Engine($code, $text) If $code = 0 Then Dim $script = StringSplit($text, @CRLF, 1) Dim $dead1, $dead2, $temp, $command[10] $temp = StringSplit ( $script[1], "(" ) If ($temp[0] > 1) Then $dead1 = StringSplit ( $temp[2], ")" ) $dead2 = StringSplit ( $dead1[1], ",") $command[0] = $temp[1] For $i = 1 to $dead2[0] $command[$i] = $dead2[$i] Next Else $command[0] = $temp[1] EndIf Return($command[0]) ElseIf $code = 1 Then ;other code Else return("ERROR, invalid process code") EndIf EndFunc All this is going to provide the ability of a basic scripting language for a program i have to right. I need to be able to read the script contained in the edit box, parse it up line by line, and error check it before it is executed. This problem that i'm having isn't really an issue except when the code returns with an error, the user fixes it and tries to submit it again, then it would 'read' the $script editbox and return 0. Hope i explained it well enough, i've just never seen anything like this so i dont know where to start to look for changes to make. ~Dark Link to comment Share on other sites More sharing options...
GaryFrost Posted September 14, 2005 Share Posted September 14, 2005 $load = GUICtrlCreateButton("Load Script", 10, 35)$EditBox = GUICtrlCreateEdit("", 5, 70, 490, 400);Msg loop ElseIf $msg = $load Then Dim $var = Engine("0", GUICtrlRead($EditBox)) MsgBox(0, "", $var) EndIf;engine functionFunc Engine($code, $text) If $code = 0 Then Dim $script = StringSplit($text, @CRLF, 1) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
DarkNecromancer Posted September 14, 2005 Author Share Posted September 14, 2005 om.... i can't beleive i missed that... thanks alot for the help ~Dark 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