ileandros 13 Posted April 10, 2012 Share Posted April 10, 2012 Hello, I got sth complicated that i dont get it. I got 2 functions. One creating the program and the other that navigate $oIE = _IECreate($url) In my programm i got a combo box. What i want to do is each time i pick an item from the combo box to set the different data of the $url Here is the code #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include <IE.au3> Local $input , $input1, $button, $List1, $sPath, $Input3, $input111, $combo, $url $url = "" _func1() Func _func1() $Form1 = GUICreate("Form1", 784, 591, 245, 90) $Button2 = GUICtrlCreateButton("random",585,540,75,22) $combo = GUICtrlCreateCombo("first url",20,530,100) GUICtrlSetData(-1,"second url|third url") GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $combo = "first url" GUICtrlSetData($url, "[url="http://www.autoitscript.com/site/autoit/"]http://www.autoitscript.com/site/autoit/[/url]") Case $combo = "second url" GUICtrlSetData($url, "[url="http://www.google.be/"]http://www.google.be/[/url]") Case $Button2 _navigate() EndSwitch WEnd EndFunc Func _navigate() $oIE = _IECreate($url) EndFunc I feel nothing.It feels great. Link to post Share on other sites
BrewManNH 1,317 Posted April 10, 2012 Share Posted April 10, 2012 (edited) GUICtrlSetData sets the data of a CONTROL, not a variable, just use $url = "http://www.autoitscript.com/site/autoit/"Edit:Forgot some quote marks Edited April 10, 2012 by BrewManNH If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to post Share on other sites
Zedna 376 Posted April 10, 2012 Share Posted April 10, 2012 #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include <IE.au3> Local $input, $input1, $button, $List1, $sPath, $Input3, $input111, $combo, $url $url = "http://www.autoitscript.com/site/autoit" _func1() Func _func1() $Form1 = GUICreate("Form1", 784, 591, 245, 90) $Button2 = GUICtrlCreateButton("random", 585, 540, 75, 22) $combo = GUICtrlCreateCombo("first url", 20, 530, 100) GUICtrlSetData(-1, "second url|third url", "first url") GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $combo $value = GUICtrlRead($combo) Switch $value Case "first url" $url = "http://www.autoitscript.com/site/autoit" Case "second url" $url = "http://www.google.be/" Case Else $url = "about" EndSwitch Case $Button2 _navigate() EndSwitch WEnd EndFunc ;==>_func1 Func _navigate() $oIE = _IECreate($url) EndFunc ;==>_navigate Resources UDF ResourcesEx UDF AutoIt Forum Search Link to post Share on other sites
ileandros 13 Posted April 10, 2012 Author Share Posted April 10, 2012 Honestly, the statement is not complicated. What's wrong? The less complicated answer is, What's right?If you want a button to open a url random, you need an organized list so you can randomly choose one. The good news is, you can create an array and base everything off that (the combo, the random button).I did some commenting in the script to explain what you're looking to do(hmmmmmm - keeps converting URLs)Attaching file since I can't seem to get this editor to stop converting urls Dude ur out of theme. Go play somewhere else. GUICtrlSetData sets the data of a CONTROL, not a variable, just use $url = "http://www.autoitscript.com/site/autoit/"Edit:Forgot some quote marks I had already done it that way but it didnt work. I also did it like Zedna but the problem is that i was using an already existing $var for the $value.That was a stupid mistake. Thanks guys. I feel nothing.It feels great. Link to post Share on other sites
BrewManNH 1,317 Posted April 10, 2012 Share Posted April 10, 2012 Zedna's example was demonstrating what I said to do, and his example works just fine. Maybe you need to explain what exactly didn't work, what was it supposed to do that it didn't, or what did it do that you didn't want? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to post Share on other sites
ileandros 13 Posted April 10, 2012 Author Share Posted April 10, 2012 No its fine. I wanted to do what you did. The only problem as i said is that i was setting $var of $value with an already existing one and i hadnt seen that. Thats all!!! I feel nothing.It feels great. Link to post Share on other sites
ZacUSNYR 4 Posted April 10, 2012 Share Posted April 10, 2012 (edited) Dude ur out of theme. Go play somewhere else.I had already done it that way but it didnt work. I also did it like Zedna but the problem is that i was using an already existing $var for the $value.That was a stupid mistake. Thanks guys.Huh? Are you upset because I told you your script is all wrong? (I apologize if honesty came across harsh, tone is hard to tell online) Are you not looking to have URLs that are selectable via a combo and did I not provide you with a complete, working example, to assist you in figuring it out? Did you download the script and look at it? Edited April 10, 2012 by ZacUSNYR Link to post Share on other sites
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