n1maS Posted June 25, 2012 Share Posted June 25, 2012 Hi all I'm kinda new to AutoIt. I made a simple scipt for myself to Unname a file! very simple. but the problem is when I show and Close "ABOUT" from the menu, the main GUI freezes and you have to close it from Task Manager like I said I'm newbie to AutoIt. so any help would be greatly appreciated:) Here's my code: expandcollapse popup#NoTrayIcon #Region #AutoIt3Wrapper_icon=n1ma.ico #AutoIt3Wrapper_Res_Description=Unname A File #AutoIt3Wrapper_Res_Fileversion=1.5.0.0 #AutoIt3Wrapper_Res_LegalCopyright=n1ma 2012 #AutoIt3Wrapper_Run_Obfuscator=y #EndRegion #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiStatusBar.au3> #include <file.au3> #include <array.au3> #include <ButtonConstants.au3> Global $tSHFCS, $tIcon, $aIcon[2], $sPath, $aParts[2] = [288, -1],$szDrive, $szDir, $szFName, $szExt $CheckforRunningWindow = WinExists ("Created By n1maSSTO") If $CheckforRunningWindow = 1 Then WinActivate ("Created By n1maSSTO") Else Main() EndIf Func Main() $Form1 = GUICreate("Created By n1maSSTO", 288, 270) GUISetBkColor(0xFFFFFF) $MainMenu = GUICtrlCreateMenu("&Main Menu") $Exit = GUICtrlCreateMenuItem("E&xit", $MainMenu) $HelpMenu = GUICtrlCreateMenu("&Help") $About = GUICtrlCreateMenuItem("&About", $HelpMenu) $Label1 = GUICtrlCreateLabel("Unname A File", 76, 12, 155, 23) GUICtrlSetFont(-1, 13, 800, 0, "Segoe UI Symbol") $Label2 = GUICtrlCreateLabel("n1ma ©2012" ,182,208, 145, 17) GUICtrlSetFont(-1, 11, 400, 0, "Segoe Script") $LabelFile = GUICtrlCreateLabel("File", 8, 55, 56, 19) GUICtrlSetFont(-1, 11, 400, 0, "Leelawadee") $FileInput = GUICtrlCreateInput("", 8, 75, 225, 21, $ES_READONLY, $WS_EX_CLIENTEDGE) $InFileButton = GUICtrlCreateButton(". . .", 240, 72, 30, 25) $ProcessButton = GUICtrlCreateButton("Process", 35, 160, 100, 30) GUICtrlSetFont(-1, 10, 800, 0, "Leelawadee") $Close = GUICtrlCreateButton("Close", 155, 160, 100, 30) GUICtrlSetFont(-1, 10, 800, 0, "Leelawadee") $StatusBar = _GUICtrlStatusBar_Create($Form1, $aParts) _GUICtrlStatusBar_SetText($StatusBar, "Select a File") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Close GUIDelete() ExitLoop Case $Exit GUIDelete() ExitLoop Case $About About() Case $InFileButton $IPath = FileOpenDialog("Choose A File", @WindowsDir & "", "All Files (*.*)", 1) If $IPath <> "" Then GUICtrlSetData($FileInput, $IPath) Case $ProcessButton Global $IPath $FilePath = _PathSplit($IPath, $szDrive, $szDir, $szFName, $szExt) Select Case $IPath == "" _GUICtrlStatusBar_SetText($StatusBar, "Please Choose a File") Case $FilePath[3] == "" _GUICtrlStatusBar_SetText($StatusBar, "File is Already Unnamed") Case $FilePath[4] == "" _GUICtrlStatusBar_SetText($StatusBar, "File Doesn't Have an Extension") Case FileExists($FilePath[1] & $FilePath[2] & $FilePath[4]) = 1 _GUICtrlStatusBar_SetText($StatusBar, "An Unnamed File Exists in The Same Directory") Case Else FileMove($IPath,$FilePath[1] & $FilePath[2] & $FilePath[4]) _GUICtrlStatusBar_SetText($StatusBar, "File Was Unnamed Successfuly") $IPath = "" GUICtrlSetData($FileInput,"") EndSelect EndSwitch WEnd EndFunc Func About() $AGUI = GUICreate("About Developer", 302, 165) GUISetBkColor(0xFFFFFF) $Label2 = GUICtrlCreateLabel("n1ma File Unnamer!", 75, 8, 195, 23) GUICtrlSetFont(-1, 12, 800, 0, "Leelawadee") $Label3 = GUICtrlCreateLabel("n1maSSTO ©2012", 212, 144, 145, 18) GUICtrlSetFont(-1, 8, 400, 0, "Leelawadee") $Label1 = GUICtrlCreateLabel("Version 1.5", 121, 32, 69, 19) GUICtrlSetFont(-1, 10, 400, 0, "Leelawadee") $Label4 = GUICtrlCreateLabel("My Profile on P30ask.com", 76, 56, 179, 19) GUICtrlSetFont(-1, 10, 400, 0, "Leelawadee") $Label5 = GUICtrlCreateLabel("(Click here to visit)", 131, 72, 92, 18) GUICtrlSetFont(-1, 8, 400, 0, "Leelawadee") $Label6 = GUICtrlCreateLabel("Special thanks to AutoIt help file!!", 54, 106, 203, 18) GUICtrlSetFont(-1, 10, 400, 0, "Leelawadee") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($AGUI) WinActivate ("Created By n1maSSTO") Case $Label4 ShellExecute("http://forum.p30ask.com/members/n1ma-128301/") Case $Label5 ShellExecute("http://forum.p30ask.com/members/n1ma-128301/") EndSwitch WEnd EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 25, 2012 Moderators Share Posted June 25, 2012 n1maS, You need to escape from the loop where you look for the second GUI to be closed: Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($AGUI) WinActivate("Created By n1maSSTO") ExitLoop : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Other wise you stay in that loop forever and your main GUI idle loop is never re-entered. 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...
n1maS Posted June 25, 2012 Author Share Posted June 25, 2012 Oh! you are right! thank you so much BTW, is there something better than help file? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 25, 2012 Moderators Share Posted June 25, 2012 is there something better than help file?We think the Help file is pretty good! But you can find a couple of excellent tutorials here and here. There are also some more advanced tutorials in the Wiki (the link is at the top of the page). 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...
n1maS Posted June 25, 2012 Author Share Posted June 25, 2012 Nice I think I fell in love with AutoIt Thanks again bro 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