ending Posted January 31, 2008 Share Posted January 31, 2008 (edited) I'm trying to get a main window, and then a second window that works independently of the other. You open the secondary window by choosing Add menuItem from the Schedule menu. I cannot set it up correctly though. expandcollapse popup#region Includes #include <GUIConstants.au3> #endregion #region FormMain Creation Opt("TrayMenuMode", 1) $FormMain = GUICreate("first", 332, 157, 436, 190) $LabelSettings = GUICtrlCreateLabel("Settings: ", 40, 40, 58, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $LabelSchedule = GUICtrlCreateLabel("xCell: ", 40, 65, 39, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $LabelExcel = GUICtrlCreateLabel("Microsoft Excel: ", 40, 90, 100, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $MenuFile = GUICtrlCreateMenu("&File") $MenuItemOpen = GUICtrlCreateMenuItem("Open", $MenuFile) $MenuItemSave = GUICtrlCreateMenuItem("Save", $MenuFile) $MenuItemSaveAs = GUICtrlCreateMenuItem("Save As...", $MenuFile) $MenuItemSeperator1 = GUICtrlCreateMenuItem("", $MenuFile) $MenuItemExit = GUICtrlCreateMenuItem("Exit", $MenuFile) $MenuEdit = GUICtrlCreateMenu("&Edit") $MenuItemRunonstartu = GUICtrlCreateMenuItem("Run On Startup", $MenuEdit) GUICtrlSetState(-1, $GUI_CHECKED) $MenuSchedule = GUICtrlCreateMenu("&Schedule") $MenuItemAdd = GUICtrlCreateMenuItem("Add", $MenuSchedule) $MenuItemRemove = GUICtrlCreateMenuItem("Remove", $MenuSchedule) $MenuItemSeperator2 = GUICtrlCreateMenuItem("", $MenuSchedule) $MenuRun = GUICtrlCreateMenu("&Run") $MenuItemRunSingle = GUICtrlCreateMenuItem("Run Single", $MenuRun) $MenuItemRunChecked = GUICtrlCreateMenuItem("Run Checked", $MenuRun) TraySetClick("9") $TrayMenuItemShow = TrayCreateItem("Show") $TrayMenuItemSeperator1 = TrayCreateItem("") $TrayMenuItemExit = TrayCreateItem("Exit") GUISetState(@SW_SHOW) #endregion #region FormScheduleManager Creation $FormScheduleManager = GUICreate("second", 370, 397, 433, 158, -1, -1, $FormMain) $GroupFile = GUICtrlCreateGroup("File Location", 16, 49, 337, 65) $ButtonOpen = GUICtrlCreateButton("Open", 32, 73, 67, 25, 0) $InputFile = GUICtrlCreateInput("$FileName", 112, 77, 225, 21) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup("", -99, -99, 1, 1) $ButtonSave = GUICtrlCreateButton("Save", 280, 13, 75, 25, 0) $GroupSource = GUICtrlCreateGroup("Source Range", 16, 183, 337, 81) $Label1 = GUICtrlCreateLabel("Start Column:", 27, 207, 67, 17) $Label2 = GUICtrlCreateLabel("End Column:", 147, 207, 64, 17) $Label3 = GUICtrlCreateLabel("Start Row:", 39, 239, 54, 17) $Label4 = GUICtrlCreateLabel("End Row:", 160, 239, 51, 17) $InputSourceSC = GUICtrlCreateInput("", 94, 203, 40, 21) GUICtrlSetTip(-1, "Input must be a letter sequence.") $InputSourceSR = GUICtrlCreateInput("", 94, 235, 40, 21) GUICtrlSetTip(-1, "Input must be a numerical value.") $InputSourceEC = GUICtrlCreateInput("", 211, 203, 40, 21) GUICtrlSetTip(-1, "Input must be a letter sequence.") $InputSourceER = GUICtrlCreateInput("", 211, 235, 40, 21) GUICtrlSetTip(-1, "Input must be a numerical value.") $Label7 = GUICtrlCreateLabel("Sheet:", 265, 207, 35, 17) $InputSourceSheet = GUICtrlCreateInput("", 300, 203, 40, 21) GUICtrlSetTip(-1, "Input must be a numerical value.") GUICtrlCreateGroup("", -99, -99, 1, 1) $GroupDestination = GUICtrlCreateGroup("Destination", 16, 274, 337, 49) $Label5 = GUICtrlCreateLabel("Start Row:", 156, 295, 54, 17) $Label6 = GUICtrlCreateLabel("Start Column:", 26, 295, 67, 17) $InputDestinationSC = GUICtrlCreateInput("", 94, 293, 40, 21) GUICtrlSetTip(-1, "Input must be a letter sequence.") $InputDestinationSR = GUICtrlCreateInput("", 211, 293, 40, 21) GUICtrlSetTip(-1, "Input must be a numerical value.") $Label10 = GUICtrlCreateLabel("Sheet:", 264, 295, 35, 17) $InputDestinationSheet = GUICtrlCreateInput("", 300, 293, 40, 21) GUICtrlSetTip(-1, "Input must be a numerical value.") GUICtrlCreateGroup("", -99, -99, 1, 1) $InputGroup = GUICtrlCreateInput("", 56, 16, 193, 21) $LabelName = GUICtrlCreateLabel("Name:", 16, 17, 35, 17) $GroupTime = GUICtrlCreateGroup("Start Time", 16, 124, 337, 49) $ScheduleCheckbox = GUICtrlCreateCheckbox("Run Schedule", 235, 143, 89, 17) GUICtrlSetState(-1, $GUI_CHECKED) $Label8 = GUICtrlCreateLabel("Hour:", 34, 145, 30, 17) $InputHour = GUICtrlCreateInput("", 65, 141, 30, 21) GUICtrlSetTip(-1, "Based on a 24-hour clock. Valid range is 0 to 23.") $Label9 = GUICtrlCreateLabel("Minute:", 116, 145, 39, 17) $InputMinute = GUICtrlCreateInput("", 158, 141, 30, 21) GUICtrlSetTip(-1, "Valid values range from 0 to 59.") GUICtrlCreateGroup("", -99, -99, 1, 1) $GroupOPT = GUICtrlCreateGroup("Schedule Completion Options", 16, 333, 337, 49) $RadioOPT0 = GUICtrlCreateRadio("Do Nothing", 31, 354, 73, 17) $RadioOPT1 = GUICtrlCreateRadio("Logout", 123, 354, 57, 17) $RadioOPT3 = GUICtrlCreateRadio("Shutdown", 272, 354, 65, 17) $RadioOPT2 = GUICtrlCreateRadio("Sleep", 200, 354, 65, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_HIDE) GUISetState(@SW_DISABLE) #endregion GUISwitch($FormMain) While 1 $Msg = GUIGetMsg(1) $CTRLMsg = $Msg[0] $Win = $Msg[1] $PosX = $Msg[3] $PosY = $Msg[4] Switch $msg Case $CTRLMsg = $GUI_EVENT_CLOSE AND $Win = $FormMain WinSetState("first","",@SW_HIDE) Case $CTRLMsg = $GUI_EVENT_CLOSE AND $Win = $FormScheduleManager GUISetState($FormScheduleManager,@SW_DISABLE) WinSetState("second","",@SW_HIDE) WinActivate("first") Case $CTRLMsg = $MenuItemOpen Case $CTRLMsg = $MenuItemSave Case $CTRLMsg = $MenuItemSaveAs Case $CTRLMsg = $MenuItemExit Case $CTRLMsg = $MenuItemRunonstartu Case $CTRLMsg = $MenuItemAdd MsgBox(0,"","add hit") GUISetState($FormScheduleManager,@SW_ENABLE) WinSetState("second","",@SW_SHOW) WinActivate("second") Case $CTRLMsg = $MenuItemRemove Case $CTRLMsg = $MenuItemRunSingle Case $CTRLMsg = $MenuItemRunChecked Case $CTRLMsg = $TrayMenuItemShow WinSetState("first","",@SW_SHOW) Case $CTRLMsg = $TrayMenuItemExit ExitLoop Case $CTRLMsg = $ButtonOpen AND $Win = $FormScheduleManager Case $CTRLMsg = $ButtonSave AND $Win = $FormScheduleManager EndSwitch WEnd MsgBox(0,"","Byebye") GUIDelete() Exit Edited January 31, 2008 by ending Link to comment Share on other sites More sharing options...
Valuater Posted January 31, 2008 Share Posted January 31, 2008 Maybe... expandcollapse popup#region Includes #include <GUIConstants.au3> #endregion #region FormMain Creation Opt("TrayMenuMode", 1) $FormMain = GUICreate("xCell Pusher", 332, 157, 436, 190) $LabelSettings = GUICtrlCreateLabel("Settings: ", 40, 40, 58, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $LabelSchedule = GUICtrlCreateLabel("xCell: ", 40, 65, 39, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $LabelExcel = GUICtrlCreateLabel("Microsoft Excel: ", 40, 90, 100, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $MenuFile = GUICtrlCreateMenu("&File") $MenuItemOpen = GUICtrlCreateMenuItem("Open", $MenuFile) $MenuItemSave = GUICtrlCreateMenuItem("Save", $MenuFile) $MenuItemSaveAs = GUICtrlCreateMenuItem("Save As...", $MenuFile) $MenuItemSeperator1 = GUICtrlCreateMenuItem("", $MenuFile) $MenuItemExit = GUICtrlCreateMenuItem("Exit", $MenuFile) $MenuEdit = GUICtrlCreateMenu("&Edit") $MenuItemRunonstartu = GUICtrlCreateMenuItem("Run On Startup", $MenuEdit) GUICtrlSetState(-1, $GUI_CHECKED) $MenuSchedule = GUICtrlCreateMenu("&Schedule") $MenuItemAdd = GUICtrlCreateMenuItem("Add", $MenuSchedule) $MenuItemRemove = GUICtrlCreateMenuItem("Remove", $MenuSchedule) $MenuItemSeperator2 = GUICtrlCreateMenuItem("", $MenuSchedule) $MenuRun = GUICtrlCreateMenu("&Run") $MenuItemRunSingle = GUICtrlCreateMenuItem("Run Single", $MenuRun) $MenuItemRunChecked = GUICtrlCreateMenuItem("Run Checked", $MenuRun) TraySetClick("9") $TrayMenuItemShow = TrayCreateItem("Show") $TrayMenuItemSeperator1 = TrayCreateItem("") $TrayMenuItemExit = TrayCreateItem("Exit") GUISetState(@SW_SHOW) #endregion #region FormScheduleManager Creation $FormScheduleManager = GUICreate("xCell Pusher - Schedule Manager", 370, 397, 433, 158, -1, -1, $FormMain) $GroupFile = GUICtrlCreateGroup("File Location", 16, 49, 337, 65) $ButtonOpen = GUICtrlCreateButton("Open", 32, 73, 67, 25, 0) $InputFile = GUICtrlCreateInput("$FileName", 112, 77, 225, 21) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup("", -99, -99, 1, 1) $ButtonSave = GUICtrlCreateButton("Save", 280, 13, 75, 25, 0) $GroupSource = GUICtrlCreateGroup("Source Range", 16, 183, 337, 81) $Label1 = GUICtrlCreateLabel("Start Column:", 27, 207, 67, 17) $Label2 = GUICtrlCreateLabel("End Column:", 147, 207, 64, 17) $Label3 = GUICtrlCreateLabel("Start Row:", 39, 239, 54, 17) $Label4 = GUICtrlCreateLabel("End Row:", 160, 239, 51, 17) $InputSourceSC = GUICtrlCreateInput("", 94, 203, 40, 21) GUICtrlSetTip(-1, "Input must be a letter sequence.") $InputSourceSR = GUICtrlCreateInput("", 94, 235, 40, 21) GUICtrlSetTip(-1, "Input must be a numerical value.") $InputSourceEC = GUICtrlCreateInput("", 211, 203, 40, 21) GUICtrlSetTip(-1, "Input must be a letter sequence.") $InputSourceER = GUICtrlCreateInput("", 211, 235, 40, 21) GUICtrlSetTip(-1, "Input must be a numerical value.") $Label7 = GUICtrlCreateLabel("Sheet:", 265, 207, 35, 17) $InputSourceSheet = GUICtrlCreateInput("", 300, 203, 40, 21) GUICtrlSetTip(-1, "Input must be a numerical value.") GUICtrlCreateGroup("", -99, -99, 1, 1) $GroupDestination = GUICtrlCreateGroup("Destination", 16, 274, 337, 49) $Label5 = GUICtrlCreateLabel("Start Row:", 156, 295, 54, 17) $Label6 = GUICtrlCreateLabel("Start Column:", 26, 295, 67, 17) $InputDestinationSC = GUICtrlCreateInput("", 94, 293, 40, 21) GUICtrlSetTip(-1, "Input must be a letter sequence.") $InputDestinationSR = GUICtrlCreateInput("", 211, 293, 40, 21) GUICtrlSetTip(-1, "Input must be a numerical value.") $Label10 = GUICtrlCreateLabel("Sheet:", 264, 295, 35, 17) $InputDestinationSheet = GUICtrlCreateInput("", 300, 293, 40, 21) GUICtrlSetTip(-1, "Input must be a numerical value.") GUICtrlCreateGroup("", -99, -99, 1, 1) $InputGroup = GUICtrlCreateInput("", 56, 16, 193, 21) $LabelName = GUICtrlCreateLabel("Name:", 16, 17, 35, 17) $GroupTime = GUICtrlCreateGroup("Start Time", 16, 124, 337, 49) $ScheduleCheckbox = GUICtrlCreateCheckbox("Run Schedule", 235, 143, 89, 17) GUICtrlSetState(-1, $GUI_CHECKED) $Label8 = GUICtrlCreateLabel("Hour:", 34, 145, 30, 17) $InputHour = GUICtrlCreateInput("", 65, 141, 30, 21) GUICtrlSetTip(-1, "Based on a 24-hour clock. Valid range is 0 to 23.") $Label9 = GUICtrlCreateLabel("Minute:", 116, 145, 39, 17) $InputMinute = GUICtrlCreateInput("", 158, 141, 30, 21) GUICtrlSetTip(-1, "Valid values range from 0 to 59.") GUICtrlCreateGroup("", -99, -99, 1, 1) $GroupOPT = GUICtrlCreateGroup("Schedule Completion Options", 16, 333, 337, 49) $RadioOPT0 = GUICtrlCreateRadio("Do Nothing", 31, 354, 73, 17) $RadioOPT1 = GUICtrlCreateRadio("Logout", 123, 354, 57, 17) $RadioOPT3 = GUICtrlCreateRadio("Shutdown", 272, 354, 65, 17) $RadioOPT2 = GUICtrlCreateRadio("Sleep", 200, 354, 65, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_HIDE) ;GUISetState(@SW_DISABLE) #endregion ;GUISwitch($FormMain) While 1 $Msg = GUIGetMsg(1) $TrayMsg = TrayGetMsg() $CTRLMsg = $Msg[0] $Win = $Msg[1] $PosX = $Msg[3] $PosY = $Msg[4] Select Case $CTRLMsg = $GUI_EVENT_CLOSE AND $Win = $FormMain Exit ;WinSetState("xCell Pusher","",@SW_HIDE) Case $CTRLMsg = $GUI_EVENT_CLOSE AND $Win = $FormScheduleManager ;GUISetState($FormScheduleManager,@SW_DISABLE) WinSetState("xCell Pusher - Schedule Manager","",@SW_HIDE) ;WinActivate("xCell Pusher") Case $CTRLMsg = $MenuItemOpen Case $CTRLMsg = $MenuItemSave Case $CTRLMsg = $MenuItemSaveAs Case $CTRLMsg = $MenuItemExit Exit Case $CTRLMsg = $MenuItemRunonstartu Case $CTRLMsg = $MenuItemAdd MsgBox(0,"","add hit") ;GUISetState($FormScheduleManager,@SW_ENABLE) WinSetState("xCell Pusher - Schedule Manager","",@SW_SHOW) WinActivate("xCell Pusher - Schedule Manager") Case $CTRLMsg = $MenuItemRemove Case $CTRLMsg = $MenuItemRunSingle Case $CTRLMsg = $MenuItemRunChecked Case $CTRLMsg = $TrayMenuItemShow WinSetState("xCell Pusher","",@SW_SHOW) Case $TrayMsg = $TrayMenuItemExit Exit ; see tray message Case $CTRLMsg = $ButtonOpen AND $Win = $FormScheduleManager Case $CTRLMsg = $ButtonSave AND $Win = $FormScheduleManager EndSelect WEnd MsgBox(0,"","Byebye") GUIDelete() Exit 8) Link to comment Share on other sites More sharing options...
ending Posted January 31, 2008 Author Share Posted January 31, 2008 Thats awesome. Thanks for the help! One more question though, are you not able to hide the main GUI when the [X] is hit instead of Exiting? Since it runs schedules I want to be able to hide the window and pull it back up from the tray. Thanks! Link to comment Share on other sites More sharing options...
Valuater Posted January 31, 2008 Share Posted January 31, 2008 Welcome! sure, just replace the "Exit" with WinSetState("WINDOW NAME","",@SW_HIDE) 8) Link to comment Share on other sites More sharing options...
ending Posted January 31, 2008 Author Share Posted January 31, 2008 (edited) I thought so.... I figured it out. Sometimes it would hide/show the Schedule Manager window since AutoIt starts at the beginning of the name on title matching. I changed it to "Schedule Manager - xCell Pusher" and that fixed everything. Thanks again! Edited January 31, 2008 by ending Link to comment Share on other sites More sharing options...
ending Posted February 1, 2008 Author Share Posted February 1, 2008 The main window responds correctly but the secondary one does not for some reason. I tried adding GUISwitch in the Cases where the two windows swap, but that didn't help. 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