rharwood Posted February 7, 2010 Share Posted February 7, 2010 Anyone know why if when I right click in the gui it closes the script. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <DateTimeConstants.au3> #include <EditConstants.au3> #include <GuiIPAddress.au3> #include <StaticConstants.au3> FORM1() Func FORM1() ;MAIN FORM $Form1 = GUICreate("Winnipeg Fireutils Menu", 625, 443, 192, 124) $helpmenu = GUICtrlCreateMenu("Help") $aboutitem = GUICtrlCreateMenuItem("About", $helpmenu) $aboutitem1 = GUICtrlCreateMenuItem("Help", $helpmenu) $aboutitem2 = GUICtrlCreateMenuItem(" ", $helpmenu) $form1_button1 = GUICtrlCreateButton("Run EST3 convert", 350, 50, 150, 50, $WS_GROUP) $form1_button2 = GUICtrlCreateButton("Run EST2 convert", 350, 100, 150, 50, $WS_GROUP) $form1_button3 = GUICtrlCreateButton("Run QS convert", 350, 150, 150, 50, $WS_GROUP) $form1_button4 = GUICtrlCreateButton("Start 3SDU", 136, 50, 150, 50, $WS_GROUP) $form1_button5 = GUICtrlCreateButton("Start database reader", 136, 100, 150, 50, $WS_GROUP) $form1_button6 = GUICtrlCreateButton("Run VirtualPrint", 136, 200, 150, 50, $WS_GROUP) $form1_button7 = GUICtrlCreateButton("Run IO convert", 350, 200, 150, 50, $WS_GROUP) $form1_button8 = GUICtrlCreateButton("Open fireutils dir", 136, 150, 150, 50, $WS_GROUP) $form1_button9 = GUICtrlCreateButton("Battery calcs", 136, 250, 150, 50, $WS_GROUP) GuiCtrlCreateLabel("Button only functions if 3SDU program is installed --->" & @CRLF , 10, 50, 100, 50) ;GuiCtrlCreatePic("c:\fireutil.bmp",250,300, 200,100) GUISetState() $excellocation=_Find("excel.exe") While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $form1_button1 if FileExists("C:\fireutils\est3labelfile.csv") Then ;looks for previous conversion and deletes it FileDelete("C:\fireutils\est3labelfile.csv") MsgBox(4096, "C:\fireutils\est3labelfile.csv File", "Previous Label file deleted") EndIf RunWait ( "cmd.exe /c C:\fireutils\est32csv.exe object.brc" , "c:\fireutils" , @SW_MAXIMIZE );uses awk exe to convert the file if FileExists("C:\fireutils\est3labelfile.csv") Then MsgBox(4096, "C:\fireutils\est3labelfile.csv File", "Est3labelfile Created") Else MsgBox(4096,"C:\fireutils\est3labelfile.csv File", "est3labelfile.csv does NOT exist") EndIf Case $nMsg = $form1_button2 if FileExists("C:\fireutils\est2labelfile.csv") Then FileDelete("C:\fireutils\est2labelfile.csv") MsgBox(4096, "C:\fireutils\est2labelfile.csv File", "Previous label file deleted") EndIf RunWait ( "C:\fireutils\est22csv.exe object.txt" , "c:\fireutils" , @SW_MAXIMIZE ) if FileExists("C:\fireutils\est2labelfile.csv") Then MsgBox(4096, "C:\fireutils\est2labelfile.csv File", "est2labelfile created") Else MsgBox(4096,"C:\fireutils\est2labelfile.csv File", "est2labelfile.csv does NOT exist") EndIf Case $nMsg = $form1_button3 if FileExists("C:\fireutils\qslabelfile.csv") Then FileDelete("C:\fireutils\qslabelfile.csv") MsgBox(4096, "C:\fireutils\qslabelfile.csv File", "Previous label file deleted") EndIf RunWait ( "C:\fireutils\qs2csv.exe object.txt" , "c:\fireutils" , @SW_MAXIMIZE ) if FileExists("C:\fireutils\qslabelfile.csv") Then MsgBox(4096, "C:\fireutils\qslabelfile.csv File", "qslabelfile Created") Else MsgBox(4096,"C:\fireutils\qslabelfile.csv File", "qslabelfile.csv does NOT exist") EndIf Case $nMsg = $form1_button4 Run ( "C:\FAST\3-SDU\Bin\Sdu.exe" , "" , @SW_MAXIMIZE ) Case $nMsg = $form1_button5 Run ( "C:\Program Files\paradox-dbase-reader\paradox-dbase-reader.exe" , "" , @SW_MAXIMIZE ) Case $nMsg = $form1_button6 RunWait ( "C:\fireutils\VirtualPrint.exe", "c:\fireutils",@SW_MAXIMIZE ) Case $nMsg = $form1_button7 ;if there is a previous label file clear it out if FileExists("C:\fireutils\iolabelfile.csv") Then FileDelete("C:\fireutils\iolabelfile.csv") MsgBox(4096, "C:\fireutils\IOlabelfile.csv File", "Previous label file deleted") EndIf ;do the xml dump from the io program RunWait ( "C:\fireutils\xml2csv.exe object.xml ioinputfile.csv MessageLine1,Messageline2,CardAddr,Address,Model,DeviceType" , "c:\fireutils" , @SW_MAXIMIZE ) ;convert it to a label file format ;if FileExists("C:\fireutils\iolabelfile.csv") Then ;user confermation that file conversion worked/failed ; MsgBox(4096, "C:\fireutils\IOlabelfile.csv File", "IOlabelfile Created") ; Else ; MsgBox(4096,"C:\fireutils\IOlabelfile.csv File", "IOlabelfile does NOT exist") ; EndIf Case $nMsg = $form1_button8 ;this just opens a window to the working directory ShellExecute("explorer.exe", "c:\fireutils") Case $nMsg = $form1_button9 ;this just opens a window to the working directory ShellExecute($excellocation, "c:\fireutils\Battery_test.xls") ;if FileExists("C:\fireutils\irclabelfile.csv") Then ; FileDelete("C:\fireutils\irclabelfile.csv") ; MsgBox(4096, "C:\fireutils\irclabelfile.csv File", "Previous label file deleted") ; EndIf ; RunWait ( "C:\fireutils\irc2csv.exe object.txt" , "c:\fireutils" , @SW_MAXIMIZE ) ; if FileExists("C:\fireutils\irclabelfile.csv") Then ; MsgBox(4096, "C:\fireutils\irclabelfile.csv File", "irclabelfile Created") ; Else ; MsgBox(4096,"C:\fireutils\irclabelfile.csv File", "irclabelfile.csv does NOT exist") Case $nMsg = $aboutitem MsgBox(0, "About", "Version 1.7 Written by Robert Harwood using Thompson awk and AutoIt Gui Creator (C) 2010") Case $nMsg = $aboutitem1 MsgBox(64, "Help", "Input file names should follow the syntax of object.???" & @CRLF & "Where ??? is brc for Est3" & @CRLF &"Where ??? is txt for Est2"& @CRLF & "Where ??? is txt for QS files"& @CRLF & "Where ??? is xml for IO files.") Case $nMsg = $aboutitem2 MsgBox(0, "Andy", "Surprise !!!!!") Case $nMsg = $GUI_EVENT_CLOSE ExitLoop Case $nMsg = -10 Exit EndSelect WEnd EndFunc Func _Find ($s, $d = @HomeDrive) If StringRight ($d, 1) <> "\" Then $d &= "\" Local $h = FileFindFirstFile ($d & "*") If $h = -1 Then Return 0 while 1 $t = FileFindNextFile ($h) If $t = $s Then Return $d & $t $t = $d & $t If @Error Then Return 0 * FileClose ($h) If StringInStr (FileGetAttrib ($t), "D") Then $tmp = _Find ($s, $t) If $tmp <> "0" Then Return $tmp ContinueLoop EndIf WEnd FileClose ($h) Return 0 EndFunc ; ==> _Find Func _FindAll ($s, $d = @HomeDrive) If Not IsDeclared ("sRet") Then Static $sRet = "" EndIf If StringRight ($d, 1) <> "\" Then $d &= "\" Local $h = FileFindFirstFile ($d & "*") If $h = -1 Then Return "" while 1 $t = FileFindNextFile ($h) If @Error Then ExitLoop If $t = $s Then $sRet &= @CRLF & $d & $t $t = $d & $t If StringInStr (FileGetAttrib ($t), "D") Then $tmp = _FindAll ($s, $t) WEnd FileClose ($h) Return $sRet EndFunc ; ==> _FindAll Link to comment Share on other sites More sharing options...
Malkey Posted February 7, 2010 Share Posted February 7, 2010 From GUIConstantsEx.au3 in the include directory there is this:- Global Const $GUI_EVENT_SECONDARYUP = -10 This shows the value of the Event ID received by the GUIGetMsg() function. So, in your script, Case $nMsg = -10 Exit closes the script when the right mouse button goes up. Link to comment Share on other sites More sharing options...
rharwood Posted February 8, 2010 Author Share Posted February 8, 2010 Thanks that was it that line was in the script i used to figure out how to build the menu from I thought it had something to do with the number of buttons that were in the form. I removed the line and it works fine now. 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