Damein Posted October 6, 2010 Share Posted October 6, 2010 Alrighty, so I have a script with a basic GUI that when I press a button I want something to happen. I can get it to work in a different script.. but in this one it doesn't work. This one works fine for me: #include <StaticConstants.au3> #include <GUIConstantsEx.au3> HotKeySet("`", "ShowGUI") Local $SearchFunction, $GoogleSearchButton GUICreate("Quick Search", 200, 130) GUICtrlCreateLabel("You are current searching: Google", 0, 0) $SearchFunction = GUICtrlCreateEdit("What would you like to search for?", -1, 18, 200, 20) $GoogleSearchButton = GUICTRLCreateButton("Submit", 60, 46, 60, 20) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GoogleSearchButton Then MsgBox(0, "Test", "GOOGLE!") WEnd That was a test one to see if I could get it to work, and it works that whenever I press the submit button I get the MsgBox Now this one, as soon as I choose a website from the menu I start getting the MsgBox's for the buttons, as if I was pressing them. expandcollapse popup#include <StaticConstants.au3> #include <GUIConstantsEx.au3> HotKeySet("`", "ShowGUI") Local $WebSite, $GoogleSearchButton, $YahooSearchButton, $BingSearchButton, $YouTubeSearchButton, $LyricsSearchButton, $msg GUICreate("Quick Search", 200, 100) $WebsiteMenu = GUICtrlCreateMenu("Websites") $WebsiteItemGoogle = GUICtrlCreateMenuItem("Google", $WebsiteMenu) $WebsiteItemYahoo = GUICtrlCreateMenuItem("Yahoo!", $WebsiteMenu) $WebsiteItemBing = GUICtrlCreateMenuItem("Bing", $WebsiteMenu) $WebsiteItemYouTube = GUICtrlCreateMenuItem("YouTube", $WebsiteMenu) $WebsiteItemLyrics = GUICtrlCreateMenuItem("Lyrics", $WebsiteMenu) GUICtrlCreateLabel("You are current searching: " & $WebSite, 0, 0) $state = 1 While $WebSite = "" $msg = GUIGetMsg() If $msg = $WebsiteItemGoogle Then $WebSite = "Google" If $msg = $WebsiteItemYahoo Then $WebSite = "Yahoo" If $msg = $WebsiteItemBing Then $WebSite = "Bing" If $msg = $WebsiteItemYouTube Then $WebSite = "YouTube" If $msg = $WebsiteItemLyrics Then $WebSite = "Lyrics" if $msg = $GUI_EVENT_CLOSE then Exit WEnd If $WebSite = "Google" Then GUIDelete() GUICreate("Quick Search", 200, 130) $WebsiteMenu = GUICtrlCreateMenu("Websites") $WebsiteItemGoogle = GUICtrlCreateMenuItem("Google", $WebsiteMenu) $WebsiteItemYahoo = GUICtrlCreateMenuItem("Yahoo!", $WebsiteMenu) $WebsiteItemBing = GUICtrlCreateMenuItem("Bing", $WebsiteMenu) $WebsiteItemYouTube = GUICtrlCreateMenuItem("YouTube", $WebsiteMenu) $WebsiteItemLyrics = GUICtrlCreateMenuItem("Lyrics", $WebsiteMenu) GUICtrlCreateLabel("You are current searching: Google", 0, 0) $SearchFunction = GUICtrlCreateEdit("What would you like to search for?", -1, 18, 200, 20) $GoogleSearchButton = GUICTRLCreateButton("Submit", 60, 46, 60, 20) GUISetState(@SW_SHOW) EndIf If $WebSite = "Yahoo" Then GUIDelete() GUICreate("Quick Search", 200, 100) $WebsiteMenu = GUICtrlCreateMenu("Websites") $WebsiteItemGoogle = GUICtrlCreateMenuItem("Google", $WebsiteMenu) $WebsiteItemYahoo = GUICtrlCreateMenuItem("Yahoo!", $WebsiteMenu) $WebsiteItemBing = GUICtrlCreateMenuItem("Bing", $WebsiteMenu) $WebsiteItemYouTube = GUICtrlCreateMenuItem("YouTube", $WebsiteMenu) $WebsiteItemLyrics = GUICtrlCreateMenuItem("Lyrics", $WebsiteMenu) GUICtrlCreateLabel("You are current searching: Yahoo!", -1, 18, 200, 20) $YahooSearchButton = GUICTRLCreateButton("Submit", 60, 46, 60, 20) GUISetState(@SW_SHOW) EndIf If $WebSite = "Bing" Then GUIDelete() GUICreate("Quick Search", 200, 100) $WebsiteMenu = GUICtrlCreateMenu("Websites") $WebsiteItemGoogle = GUICtrlCreateMenuItem("Google", $WebsiteMenu) $WebsiteItemYahoo = GUICtrlCreateMenuItem("Yahoo!", $WebsiteMenu) $WebsiteItemBing = GUICtrlCreateMenuItem("Bing", $WebsiteMenu) $WebsiteItemYouTube = GUICtrlCreateMenuItem("YouTube", $WebsiteMenu) $WebsiteItemLyrics = GUICtrlCreateMenuItem("Lyrics", $WebsiteMenu) GUICtrlCreateLabel("You are current searching: Bing", -1, 18, 200, 20) $BingSearchButton = GUICTRLCreateButton("Submit", 60, 46, 60, 20) GUISetState(@SW_SHOW) EndIf If $WebSite = "YouTube" Then GUIDelete() GUICreate("Quick Search", 200, 100) $WebsiteMenu = GUICtrlCreateMenu("Websites") $WebsiteItemGoogle = GUICtrlCreateMenuItem("Google", $WebsiteMenu) $WebsiteItemYahoo = GUICtrlCreateMenuItem("Yahoo!", $WebsiteMenu) $WebsiteItemBing = GUICtrlCreateMenuItem("Bing", $WebsiteMenu) $WebsiteItemYouTube = GUICtrlCreateMenuItem("YouTube", $WebsiteMenu) $WebsiteItemLyrics = GUICtrlCreateMenuItem("Lyrics", $WebsiteMenu) GUICtrlCreateLabel("You are current searching: YouTube", -1, 18, 200, 20) $YouTubeSearchButton = GUICTRLCreateButton("Submit", 60, 46, 60, 20) GUISetState(@SW_SHOW) EndIf If $WebSite = "Lyrics" Then GUIDelete() GUICreate("Quick Search", 200, 100) $WebsiteMenu = GUICtrlCreateMenu("Websites") $WebsiteItemGoogle = GUICtrlCreateMenuItem("Google", $WebsiteMenu) $WebsiteItemYahoo = GUICtrlCreateMenuItem("Yahoo!", $WebsiteMenu) $WebsiteItemBing = GUICtrlCreateMenuItem("Bing", $WebsiteMenu) $WebsiteItemYouTube = GUICtrlCreateMenuItem("YouTube", $WebsiteMenu) $WebsiteItemLyrics = GUICtrlCreateMenuItem("Lyrics", $WebsiteMenu) GUICtrlCreateLabel("You are current searching: Lyrics", -1, 18, 200, 20) $LyricsSearchButton = GUICTRLCreateButton("Submit", 60, 46, 60, 20) GUISetState(@SW_SHOW) EndIf While 1 $msg = GUIGetMsg() Select Case $msg = $GoogleSearchButton MsgBox(0, "Test", "GOOGLE!") Case $msg = $YahooSearchButton MsgBox(0, "Test", "YAHOO!") Case $msg = $BingSearchButton MsgBox(0, "Test", "BING!") Case $msg = $YouTubeSearchButton MsgBox(0, "Test", "YOUTUBE!") Case $msg = $LyricsSearchButton MsgBox(0, "Test", "LYRICS!!") EndSelect WEnd Func ShowGUI() if $state = 1 Then GUISetState(@SW_SHOW) $state = 0 Else GUISetState(@SW_HIDE) $state = 1 EndIf EndFunc Not quite sure why it is.. I've been at it for a while now and can't figure it out.. :/ Thanks. Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 6, 2010 Moderators Share Posted October 6, 2010 Damein,I have answered in the other topic. Next time, rather than double posting, just use the "Report" button at bottom left of your post to explain and ask to a Mod to move it. As long as you do not make a habit of it, no-one will mind! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Damein Posted October 6, 2010 Author Share Posted October 6, 2010 Thanks Melba, I send the report, didn't realize there was a button for it Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
Recommended Posts