turbochugz Posted September 20, 2013 Share Posted September 20, 2013 I have written a script with 3 buttons on it... 1 to call internet explorer and open up yahoo mail, 2nd button to open up word 3 to open up the my pictures folder. if the drive doesn't exits, the script seems to run in an endless loop? any thoughts? [snippet] while 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button1 but1() case $button2 but2() Case $button3 but3() EndSwitch WEnd Link to comment Share on other sites More sharing options...
turbochugz Posted September 20, 2013 Author Share Posted September 20, 2013 any thoughts as to why this happens? Link to comment Share on other sites More sharing options...
Geir1983 Posted September 20, 2013 Share Posted September 20, 2013 So it seems the problem is in one of your but() functions, not the gui part you have posted... Link to comment Share on other sites More sharing options...
turbochugz Posted September 24, 2013 Author Share Posted September 24, 2013 ok I got ya.. I was thinking something was wrong on the gui part of because it launches all my functions without my clicking on any of the buttons. I cleaned it up and went down this route... but sometimes when the program launches without drive r: being present, (I assume) all the functions launch... [snippet] #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 539, 309, 192, 124) $Group1 = GUICtrlCreateGroup("Group1", 96, 48, 337, 185) $Button1 = GUICtrlCreateButton("Button1", 136, 80, 105, 33) $Button2 = GUICtrlCreateButton("Button2", 136, 128, 105, 33) $Button3 = GUICtrlCreateButton("Button3", 136, 176, 105, 33) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) Dim $vbut1 = "C:Program Files (x86)AdobeAcrobat 9.0Acrobatacrobat.exe" Dim $vbut2 = "C:\Program Files\Internet Explorer\iexplore.exe espn.com" Dim $vbut3 = "explorer.exe /e, w:, C:\Windows\System32\" #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button1 but1() case $button2 but2() Case $button3 but3() EndSwitch WEnd func but1() run ($vbut1) EndFunc func but2() RunWait($vbut2) EndFunc func but3() if FileExists("r:") Then run ("explorer.exe /e, w:", "C:\Windows\System32\") Else MsgBox(0, "Error","Directory not found.") endif EndFunc [end snippet] I guess maybe there is a rule of thumb I am missing. Link to comment Share on other sites More sharing options...
kylomas Posted September 24, 2013 Share Posted September 24, 2013 turbochugz, Please use code tags when posting code. As Geir1983 pointed out your gui code is fine (see below). If you are having a problem it is likely within one of your functions. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 539, 309, 192, 124) $Group1 = GUICtrlCreateGroup("Group1", 96, 48, 337, 185) $Button1 = GUICtrlCreateButton("Button1", 136, 80, 105, 33) $Button2 = GUICtrlCreateButton("Button2", 136, 128, 105, 33) $Button3 = GUICtrlCreateButton("Button3", 136, 176, 105, 33) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) Dim $vbut1 = "C:\Program Files (x86)\Adobe\Acrobat 9.0\Acrobat\acrobat.exe" Dim $vbut2 = "c:\Program Files\Internet Explorer\iexplore.exe espn.com" Dim $vbut3 = "explorer.exe /e, w:, c:\windows\system32" #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 but1() Case $Button2 but2() Case $Button3 but3() EndSwitch WEnd Func but1() ConsoleWrite('Button 1 actioned' & @LF) ;Run($vbut1) EndFunc ;==>but1 Func but2() ConsoleWrite('Button 2 actioned' & @LF) ;RunWait($vbut2) EndFunc ;==>but2 Func but3() ConsoleWrite('Button 3 actioned' & @LF) ;~ If FileExists("r:") Then ;~ Run("explorer.exe /e, w:", "c:\windows\system32") ;~ Else ;~ MsgBox(0, "Error", "Directory not found.") ;~ EndIf EndFunc ;==>but3 but sometimes when the program launches without drive r: being present, (I assume) all the functions launch... The functions cannot launch themselves. If you are having a problem then we need more data (console log, reproducer, etc.) kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
turbochugz Posted September 24, 2013 Author Share Posted September 24, 2013 Thanks for the reply and your patience. I am new at this and kinda sadly wingin' it. I hope to get better with trial and error Link to comment Share on other sites More sharing options...
kylomas Posted September 24, 2013 Share Posted September 24, 2013 Thanks for the reply and your patience. I am new at this and kinda sadly wingin' it. I hope to get better with trial and error No Problem, we are here to help. Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill 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