jakub Posted November 10, 2007 Share Posted November 10, 2007 ive got 3 inputs, and i want to set data in depends of condition $c Switch $c Case 1 $v=$input1 Case 2 $v=$input2 Case 3 $v=$input3 Endswitch GUICtrlSetdata($v,$m) but it doesnt work like that :/ Expected a "=" operator in assignment statement.: $v=$input1 and i wont do it this way: Case 1 GUICtrlSetdata($input1,$m) casue my script is a lot more complicated so if there is better option i would be gratefull for help Link to comment Share on other sites More sharing options...
Josbe Posted November 10, 2007 Share Posted November 10, 2007 ive got 3 inputs, and i want to set data in depends of condition $cSwitch $cCase 1$v=$input1Case 2$v=$input2Case 3$v=$input3EndswitchGUICtrlSetdata($v,$m)but it doesnt work like that :/Expected a "=" operator in assignment statement.: $v=$input1and i wont do it this way:Case 1GUICtrlSetdata($input1,$m)casue my script is a lot more complicatedso if there is better option i would be gratefull for helpA simple look would be work, but we don't know the types of values in the ID's. Maybe you need some tests for encounter the problem. A suggestion: Adding an Else statement to Switch and checking the result in $v and $c vars. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
jakub Posted November 10, 2007 Author Share Posted November 10, 2007 variable $input1 is created as a $input1=GUICtrlCreateInput("",...) so i can set data in this input by GUICtrlSetData($input,"") but cause i dont know in wich input data should be set i use GUICtrlSetData($v,"") and function data chose input func choseinput() $v=$input1 endfunc [its example to show in simple way what the problem is] Link to comment Share on other sites More sharing options...
Generator Posted November 10, 2007 Share Posted November 10, 2007 Correction... func choseinput() $v=GUICtrlRead($input1) endfunc Link to comment Share on other sites More sharing options...
jakub Posted November 11, 2007 Author Share Posted November 11, 2007 NO. Totaly wrong. Why? Link to comment Share on other sites More sharing options...
picaxe Posted November 11, 2007 Share Posted November 11, 2007 As Josbe saysA simple look would be work, but we don't know the types of values in the ID'sIn your case if $c is not numeric then your switch statement will not work Link to comment Share on other sites More sharing options...
therks Posted November 11, 2007 Share Posted November 11, 2007 It works for me. $gui = GUICreate('', 200, 200) $input1 = GUICtrlCreateInput('', 0, 0, 100, 20) $input2 = GUICtrlCreateInput('', 0, 20, 100, 20) $input3 = GUICtrlCreateInput('', 0, 40, 100, 20) GUISetState() $c = 1 Switch $c Case 1 $v = $input1 Case 2 $v = $input2 Case 3 $v = $input3 EndSwitch $m = 'Text' GUICtrlSetData($v, $m) While 1 $gm = GUIGetMsg() Switch $gm Case -3 ; $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
picaxe Posted November 11, 2007 Share Posted November 11, 2007 As long as $v is between 1-3, no problems otherwise the guictrlsetdata will crash the program. Just put a case else in the switch statement and force a valid input-id for guictrlsetdata. 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