Masen Posted January 26, 2017 Posted January 26, 2017 when i press Home button on my program it just closes the window. not sure where im going wrong here. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> $Button1 = GUICtrlCreateButton("Home", 320, 72, 75, 25, $WS_GROUP) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Case $Button1 Exit Case $Form1_1 EndSwitch WEnd Func Home () ShellExecute ("Masen's Headquarter Interface.exe","", "C:\Users\masen\Desktop\HQ-General\Masen's Headquarter Interface.exe" ,"open","@SW_MAXIMIZE") EndFunc
Moderators Melba23 Posted January 26, 2017 Moderators Posted January 26, 2017 Masen, The third parameter is the working directory, not the full path and name of the executable. Try changing the line to read: ShellExecute ("Masen's Headquarter Interface.exe","", "C:\Users\masen\Desktop\HQ-General" ,"open","@SW_MAXIMIZE") M23 Masen 1 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
Starf0x Posted January 26, 2017 Posted January 26, 2017 Try this: While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Call("Run") EndSwitch WEnd Func Run() ShellExecute ("Masen's Headquarter Interface.exe","", "C:\Users\masen\Desktop\HQ-General" ,"open", @SW_MAXIMIZE) EndFunc You've added Exit after you clicked the "Home" Button. Cheers, Starf0x Masen 1
Masen Posted January 26, 2017 Author Posted January 26, 2017 (edited) Thx i didnt see that exit there and i added and changed the shell execute code and it worked While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Home() EndSwitch WEnd Func Home () ShellExecute ("Masen's Headquarter Interface.exe","", "C:\Users\masen\Desktop\HQ-General\" ,"open","@SW_MAXIMIZE") EndFunc Quote Masen, The third parameter is the working directory, not the full path and name of the executable. Try changing the line to read: ShellExecute ("Masen's Headquarter Interface.exe","", "C:\Users\masen\Desktop\HQ-General" ,"open","@SW_MAXIMIZE") 1 hour ago, Starf0x said: Try this: While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Call("Run") EndSwitch WEnd Func Run() ShellExecute ("Masen's Headquarter Interface.exe","", "C:\Users\masen\Desktop\HQ-General" ,"open", @SW_MAXIMIZE) EndFunc You've added Exit after you clicked the "Home" Button. Cheers, Starf0x Edited January 26, 2017 by Masen
Starf0x Posted January 26, 2017 Posted January 26, 2017 I don't know which editor you use, but if it is scite, press Ctrl+t in the code window. It cleans it a bit. Cheers, Starf0x
Skysnake Posted January 30, 2017 Posted January 30, 2017 Hi Tidy (the Ctrl+T (clean)) comment referred to above will make your code look nice by aligning tabs etc. Try it. I do not think naming a function "Run" - which is also an internal AutoIt function name, is a good idea, rather use something like _Run() or myRun() Skysnake Skysnake Why is the snake in the sky?
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