OneSolution Posted April 8, 2014 Share Posted April 8, 2014 Hello talented people, I have a gui with multi combox that I use to link to my favorite websites and emails. Though its working like I wanted. I'm just carious if there's a way that I can have a submit button that will submit the website or email that I select from the combobox instead of it redirecting me when the selection is made from the dropdown menu. For example; if I select yahoo under my favorite menu it will redirect to yahoo.com. I'm trying to prevent this from happening because sometime the wrong website will be selected. So to simplify this I think by having a submit button to redirect it when press submit will solve that issue. Here is my code. I may need a little suggestions if there's something wrong with it. Thank you very much!Any help will be much appreciated!! expandcollapse popup#include-once #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <GuiButton.au3> #include<EditConstants.au3> #include <IE.au3> $hGUI = GUICreate("Test", 1500, 900) $oIE=_IECreateEmbedded() GUICtrlCreateObj($oIE,4,1,1267,880) _IENavigate($oIE, 'http://www.autoitscript.com') $Label1 = GUICtrlCreateLabel("Favorite",1370,10, 80, 27) $Label2 = GUICtrlCreateLabel("Email",1370,80, 80, 27) $button = GUICtrlCreateButton("Submit", 1350, 150, 89, 40, $WS_GROUP) $hCombo = GUICtrlCreateCombo("", 1290, 30, 200, 20) GUICtrlSetData(-1, "Google|Yahoo|Ebay|MSN") $hCombo1 = GUICtrlCreateCombo("", 1290, 100, 200, 20) GUICtrlSetData(-1, "Yahoo|Hotmail|Gmail") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hCombo Switch GUICtrlRead($hCombo) Case "Google" _IENavigate($oIE, 'https://google.com') Case "Yahoo" _IENavigate($oIE, 'https://Yahoo.com') Case "Ebay" _IENavigate($oIE, 'http://www.ebay.com/') Case "MSN" _IENavigate($oIE, 'http://www.msn.com/') EndSwitch Case $hCombo1 Switch GUICtrlRead($hCombo1) Case "GMail" _IENavigate($oIE, 'https://mail.google.com') Case "Yahoo" _IENavigate($oIE, 'https://login.yahoo.com/') Case "Hotmail" _IENavigate($oIE, 'https://login.live.com') EndSwitch EndSwitch WEnd Link to comment Share on other sites More sharing options...
Palestinian Posted April 8, 2014 Share Posted April 8, 2014 Create one? I must be misunderstanding what you are trying to achieve, because all you need to do is to actually create a button, and replace the $hCombo1 case with the button's case Link to comment Share on other sites More sharing options...
Bert Posted April 8, 2014 Share Posted April 8, 2014 There is a simpler way to do this without a GUI. IE supports a favorites bar. A trick you can do with it is add folders to it as well as links. What I do is I add folders and put links in the folders. Then it is a simple matter of clicking the folder and a drop down of links appears. Select the one one you want and off you go. Easy to manage and it takes up only a small amount of space. The below picture show what it will look like: The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 8, 2014 Moderators Share Posted April 8, 2014 (edited) If you do want a GUI, why not get rid of the dropdowns altogether and use buttons? I did something similar for the "Deal a Day Sites" script in my signature. You could do something like this, giving your GUI more real estate for the actual IE object: expandcollapse popup#include-once #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <GuiButton.au3> #include<EditConstants.au3> #include <IE.au3> $hGUI = GUICreate("Test", 1500, 900) $oIE=_IECreateEmbedded() GUICtrlCreateObj($oIE,4,1,1267,880) _IENavigate($oIE, 'http://www.autoitscript.com') $Label1 = GUICtrlCreateLabel("Favorites",1370,10, 80, 27) $Label2 = GUICtrlCreateLabel("Email",1370,170, 80, 27) $Googlebtn = GUICtrlCreateButton("Google", 1350, 50, 89, 40) $Yahoobtn = GUICtrlCreateButton("Yahoo", 1350, 100, 89, 40) $Gmailbtn = GUICtrlCreateButton("GMail", 1350, 200, 89, 40) $Hotmailbtn = GUICtrlCreateButton("Hotmail", 1350, 250, 89, 40) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Googlebtn _IENavigate($oIE, 'https://google.com') Case $Yahoobtn _IENavigate($oIE, 'https://Yahoo.com') Case $Gmailbtn _IENavigate($oIE, 'https://mail.google.com') Case $Hotmailbtn _IENavigate($oIE, 'https://login.live.com') EndSwitch WEnd Edited April 8, 2014 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
OneSolution Posted April 15, 2014 Author Share Posted April 15, 2014 Create one? I must be misunderstanding what you are trying to achieve, because all you need to do is to actually create a button, and replace the $hCombo1 case with the button's case Yes I know how to do that. What if I have 100 or more favorite website. That would be alot of button to put on a Gui. Combobox just seem neater . I'm more interested in learning how it can be done. Just got stuck. Thank you for advice. Link to comment Share on other sites More sharing options...
OneSolution Posted April 15, 2014 Author Share Posted April 15, 2014 There is a simpler way to do this without a GUI. IE supports a favorites bar. A trick you can do with it is add folders to it as well as links. What I do is I add folders and put links in the folders. Then it is a simple matter of clicking the folder and a drop down of links appears. Select the one one you want and off you go. Easy to manage and it takes up only a small amount of space. The below picture show what it will look like: favoritebar.jpg That's a very nice trick. Thank you. But like I told Palestinian. It's about learning how it can be done. Might need it for a project in the future. Thank you. Link to comment Share on other sites More sharing options...
OneSolution Posted April 15, 2014 Author Share Posted April 15, 2014 If you do want a GUI, why not get rid of the dropdowns altogether and use buttons? I did something similar for the "Deal a Day Sites" script in my signature. You could do something like this, giving your GUI more real estate for the actual IE object: expandcollapse popup#include-once #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <GuiButton.au3> #include<EditConstants.au3> #include <IE.au3> $hGUI = GUICreate("Test", 1500, 900) $oIE=_IECreateEmbedded() GUICtrlCreateObj($oIE,4,1,1267,880) _IENavigate($oIE, 'http://www.autoitscript.com') $Label1 = GUICtrlCreateLabel("Favorites",1370,10, 80, 27) $Label2 = GUICtrlCreateLabel("Email",1370,170, 80, 27) $Googlebtn = GUICtrlCreateButton("Google", 1350, 50, 89, 40) $Yahoobtn = GUICtrlCreateButton("Yahoo", 1350, 100, 89, 40) $Gmailbtn = GUICtrlCreateButton("GMail", 1350, 200, 89, 40) $Hotmailbtn = GUICtrlCreateButton("Hotmail", 1350, 250, 89, 40) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Googlebtn _IENavigate($oIE, 'https://google.com') Case $Yahoobtn _IENavigate($oIE, 'https://Yahoo.com') Case $Gmailbtn _IENavigate($oIE, 'https://mail.google.com') Case $Hotmailbtn _IENavigate($oIE, 'https://login.live.com') EndSwitch WEnd Thank you for the suggestion. I do know how to create one like your example. Here's what I done so far put a large list in the combobox and have it redirect to my favorite website when I click the link from the dropdown menu. What I'm looking for is for it not to redirect to the website unless I click a submit button. Yes button can do that but there's only so much you can put in a Gui. Just trying to learn different ways to create a little program for quick access to emails and websites. In my case this is one feature that I'm stuck on. Link to comment Share on other sites More sharing options...
Palestinian Posted April 15, 2014 Share Posted April 15, 2014 Yes I know how to do that. What if I have 100 or more favorite website. That would be alot of button to put on a Gui. Combobox just seem neater . I'm more interested in learning how it can be done. Just got stuck. Thank you for advice. I didn't say you should get rid of the combobox, I said replace the combobox case with the button case. $Website = GUICtrlRead($hCombo) Case $hButton If $Website = "Google" Then _IENavigate($oIE, 'https://google.com') Endif 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