Zacam Posted January 11, 2010 Share Posted January 11, 2010 (edited) K. I have the Primary form, which launches (via a button control) a secondary Form GUI (hiding the first) to show a device status. The problem is, the button that I have (on Form2) that is supposed to launch the external EXE for re-installing (or Installing depending on the case) does not actually launch the exe. If I directly copy the button and case data to the Form1 window though, it does launch it. ???? Edited January 11, 2010 by Zacam Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 11, 2010 Moderators Share Posted January 11, 2010 Zacam, Please post some code - my crystal ball is frosted over! 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...
Fire Posted January 11, 2010 Share Posted January 11, 2010 (edited) Zacam, May be you want somethink like this? expandcollapse popup#include <GUIConstants.au3> $Form1_1 = GUICreate("Form2", 597, 332, 278, 155) $Button1 = GUICtrlCreateButton("Execute", 72, 248, 129, 41, 0) $Button2 = GUICtrlCreateButton("CALL SECOND GUI.", 368, 248, 145, 41, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUIDelete($Form1_1) ;deleting first GUI Run("cmd.exe /c notepad.exe",@ScriptDir,@SW_HIDE) ;execute notepad.exe second() ;calling second gui Case $Button2 GUIDelete($Form1_1) ;deleting first GUI second() EndSwitch WEnd func second() #include <GUIConstants.au3> $Form1 = GUICreate("Form2", 597, 189, 293, 153) $Button2 = GUICtrlCreateButton("Exit", 208, 96, 145, 41, 0) $Label1 = GUICtrlCreateLabel("SECOND GUI!", 240, 16, 74, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 Exit EndSwitch WEnd EndFunc; ==>second() Edited January 11, 2010 by Sh3llC043r [size="5"] [/size] Link to comment Share on other sites More sharing options...
Zacam Posted January 11, 2010 Author Share Posted January 11, 2010 (edited) .... Right, I forget that conceptual understanding is for the fail. expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <DateTimeConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <RestrictControlRegExp.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $FORM1 = GUICreate("Test Window", 140, 100, 300, 230) GUISetBkColor(16776176) $CLOSE = GUICtrlCreateButton("Close", 50, 75, 75, 25, BitOR($BS_PUSHLIKE, $WS_GROUP)) GUICtrlSetCursor(-1, 0) $DEVSTAT = GuiCtrlCreateButton("Device Status", 10, 5, 120, 25, BitOR($BS_CENTER, $WS_GROUP)) GUICtrlSetCursor($DEVSTAT, 0) $INSTDEV = GuiCtrlCreateButton("Install Device", 10, 35, 120, 25, BitOR($BS_CENTER, $WS_GROUP)) GUICtrlSetCursor($INSTDEV, 0) GUISetState(@SW_SHOW, $FORM1) $FORM2 = GUICreate("Device Status", 140, 100, 300, 230) GUISetBkColor(16776176) $Return1 = GUICtrlCreateButton("Return", 5, 40, 75, 25, BitOR($BS_PUSHLIKE, $WS_GROUP)) GUICtrlSetCursor($Return1, 0) $INSTDEV = GuiCtrlCreateButton("Install Device", 5, 10, 120, 25, BitOR($BS_CENTER, $WS_GROUP)) GUICtrlSetCursor($INSTDEV, 0) GUISetState(@SW_HIDE, $FORM2) While 1 $NMSG = GUIGetMsg() Switch $NMSG Case $GUI_EVENT_CLOSE Exit Case $INSTDEV Local $EXEPATH = "C:\Drivers\D1\DRIVER.EXE" ShellExecute($EXEPATH,"","") Case $DEVSTAT _Form2() Case $CLOSE Exit EndSwitch WEnd Func _Form2() GUISetState(@SW_HIDE, $Form1) GUISetState(@SW_SHOW, $Form2) While 1 $NMSG = GUIGetMsg() Switch $NMSG Case $INSTDEV Local $EXEPATH = "C:\Drivers\D1\DRIVER.EXE" ShellExecute($EXEPATH,"","") Case $GUI_EVENT_CLOSE GUISetState(@SW_HIDE, $Form2) GUISetState(@SW_SHOW, $Form1) Return Case $Return1 GUISetState(@SW_HIDE, $Form2) GUISetState(@SW_SHOW, $Form1) Return EndSwitch WEnd EndFunc When drafting this example, the reverse happened, the button in Form1 for Install does not work, but the one in Form2 does. The _only_ reason why I put the button on Form1 was to make sure I wasn't screwing something up on the commands for the button, it's meant to launch from Form2. Unfortunately, I cannot post the actual application code that I'm working on, only a conceptual example. Edited January 11, 2010 by Zacam Link to comment Share on other sites More sharing options...
Fire Posted January 11, 2010 Share Posted January 11, 2010 expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.2.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <DateTimeConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $FORM1 = GUICreate("Test Window", 140, 100, 300, 230) GUISetBkColor(16776176) $CLOSE = GUICtrlCreateButton("Close", 50, 75, 75, 25, BitOR($BS_PUSHLIKE, $WS_GROUP)) GUICtrlSetCursor(-1, 0) $DEVSTAT = GuiCtrlCreateButton("Device Status", 10, 5, 120, 25, BitOR($BS_CENTER, $WS_GROUP)) GUICtrlSetCursor($DEVSTAT, 0) $INSTDEV = GuiCtrlCreateButton("Install Device", 10, 35, 120, 25, BitOR($BS_CENTER, $WS_GROUP)) GUICtrlSetCursor($INSTDEV, 0) GUISetState(@SW_SHOW, $FORM1) $FORM2 = GUICreate("Device Status", 140, 100, 300, 230) GUISetBkColor(16776176) $Return1 = GUICtrlCreateButton("Return", 5, 40, 75, 25, BitOR($BS_PUSHLIKE, $WS_GROUP)) GUICtrlSetCursor($Return1, 0) $nope = GuiCtrlCreateButton("Install Device", 5, 10, 120, 25, BitOR($BS_CENTER, $WS_GROUP)) GUICtrlSetCursor($INSTDEV, 0) GUISetState(@SW_HIDE, $FORM2) While 1 $NMSG = GUIGetMsg() Switch $NMSG Case $GUI_EVENT_CLOSE Exit Case $INSTDEV Run("cmd.exe /c " & @WindowsDir&"\system32\calc.exe","",@SW_HIDE) Case $DEVSTAT _Form2() Case $CLOSE Exit EndSwitch WEnd Func _Form2() GUISetState(@SW_HIDE, $Form1) GUISetState(@SW_SHOW, $Form2) While 1 $NMSG = GUIGetMsg() Switch $NMSG Case $nope Run("cmd.exe /c " & @WindowsDir&"\system32\calc.exe","",@SW_HIDE) Case $GUI_EVENT_CLOSE GUISetState(@SW_HIDE, $Form2) GUISetState(@SW_SHOW, $Form1) Return Case $Return1 GUISetState(@SW_HIDE, $Form2) GUISetState(@SW_SHOW, $Form1) Return EndSwitch WEnd EndFunc [size="5"] [/size] Link to comment Share on other sites More sharing options...
Zacam Posted January 11, 2010 Author Share Posted January 11, 2010 Okay, the actual stupid issue was a Refresh() function that was misplaced. Still rather interesting that the test example though has to have a change in the Button case function name (and btw, you missed changing the GUICtrlSetCursor to $nope). Anyway, stupidity resolved. 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