TuMiM Posted September 8, 2009 Share Posted September 8, 2009 I have this script that has two guis and use the guictrlcreatedate command to get teh date and format in a specific format. The problem is that when i change the date on one gui, it doesn't transfer to the second gui. Can i do this with this command and if so how? expandcollapse popup#include <Date.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <DateTimeConstants.au3> Dim $whichbutton, $ButtonC1, $ButtonC2, $ButtonC3, $ButtonC4, $ButtonC5, $ButtonC6, $INIMDI1, $INIMDI2, $INIMDI3, $INIMDI4, $INIMDI5, $INIMDI6, $CALDATE, $input2 global $input,$room,$log,$input1 $NOWDATE=(@YEAR & @MON & @MDAY) $PATH = IniRead(@ScriptDir & "\LogLaunch.ini", "Global", "Path", "") main() Func main() ;$Form1_1 = GUICreate("Log Launch", 1001, 649, 3, 20) $Form1_1 = GUICreate("Log Launch",@DesktopWidth,@DesktopHeight,0,0 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $iniBut1 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button1","") $iniBut2 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button2","") $iniBut3 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button3","") $iniBut4 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button4","") $iniBut5 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button5","") $iniBut6 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button6","") $Button1 = GUICtrlCreateButton($iniBut1, 80, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Button2 = GUICtrlCreateButton($iniBut2, 326, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Button3 = GUICtrlCreateButton($iniBut3, 574, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Button4 = GUICtrlCreateButton($iniBut4, 77, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Button5 = GUICtrlCreateButton($iniBut5, 325, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Button6 = GUICtrlCreateButton($iniBut6, 573, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label1 = GUICtrlCreateLabel("Log Launcher", 280, 16, 236, 33) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label3 = GUICtrlCreateLabel("For Date", 280, 66, 100, 33) $input = GUICtrlCreateDate("", 350, 60, 220, 20) DateSplit() ;$CalBut = GUICtrlCreateButton($CALDATE, 420, 60, 25, 20) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $Msg = $Button1 $Room = $iniBut1 MDIOPEN() $Whichbutton = "Button1" GUISetState(@SW_HIDE, $form1_1) ;GUISetState(@SW_SHOW, $form1_2) Form2() Case $Msg = $Button2 $Room = $iniBut2 MDIOPEN() $Whichbutton = "Button2" GUISetState(@SW_HIDE, $form1_1) ;GUISetState(@SW_SHOW, $form1_2) Form2() Case $Msg = $Button3 $Room = $iniBut3 MDIOPEN() $Whichbutton = "Button3" GUISetState(@SW_HIDE, $form1_1) ;GUISetState(@SW_SHOW, $form1_2) Form2() Case $Msg = $Button4 $Room = $iniBut4 MDIOPEN() $Whichbutton = "Button4" GUISetState(@SW_HIDE, $form1_1) ;GUISetState(@SW_SHOW, $form1_2) Form2() Case $Msg = $Button5 $Room = $iniBut5 MDIOPEN() $Whichbutton = "Button5" GUISetState(@SW_HIDE, $form1_1) ;GUISetState(@SW_SHOW, $form1_2) Form2() Case $Msg = $Button6 $Room = $iniBut6 MDIOPEN() $Whichbutton = "Button6" GUISetState(@SW_HIDE, $form1_1) ;GUISetState(@SW_SHOW, $form1_2) Form2() Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit EndFunc ;Functions Func Form2() ;$Form1_2 = GUICreate("Channel Launch", 1001, 649, 3, 20) $Form1_2 = GUICreate("Channel Launch", @DesktopWidth, @DesktopHeight, 0, 0, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS ) ;GUISetState(@SW_HIDE) $iniButC1 = IniRead(@ScriptDir & "\LogLaunch.ini", $WhichButton, "Button1", "") $iniButC2 = IniRead(@ScriptDir & "\LogLaunch.ini", $WhichButton, "Button2", "") $iniButC3 = IniRead(@ScriptDir & "\LogLaunch.ini", $WhichButton, "Button3", "") $iniButC4 = IniRead(@ScriptDir & "\LogLaunch.ini", $WhichButton, "Button4", "") $iniButC5 = IniRead(@ScriptDir & "\LogLaunch.ini", $WhichButton, "Button5", "") $iniButC6 = IniRead(@ScriptDir & "\LogLaunch.ini", $WhichButton, "Button6", "") $RoomButton = GUICtrlCreateButton($Room, 80, 16, 50, 50, $WS_GROUP) $ButtonC1 = GUICtrlCreateButton($iniButC1, 80, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC2 = GUICtrlCreateButton($iniButC2, 326, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC3 = GUICtrlCreateButton($iniButC3, 574, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC4 = GUICtrlCreateButton($iniButC4, 77, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC5 = GUICtrlCreateButton($iniButC5, 325, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC6 = GUICtrlCreateButton($iniButC6, 573, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Channel Launcher",280, 16, 236, 33) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label5 = GUICtrlCreateLabel("For Date", 280, 66, 100, 33) $input2 = GUICtrlCreateDate("", 350, 60, 220, 20) DateSplit1() MsgBox(0, "Time", GUICtrlRead($input)) While 1 $msg = GUIGetMsg() Select Case $Msg = $ButtonC1 ;DateSplit1() $Input3 = GUICtrlRead($Input2) If WinExists($INIMDI1 & $INPUT3 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI1 & $INPUT3 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI1 & '\' & $INIMDI1 & $INPUT3 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI1 & '\' & $INIMDI1 & $INPUT3 & ".MDI" & '"', "", @SW_Maximize) EndIf Case $Msg = $ButtonC2 $Input1 = GUICtrlRead($Input) If WinExists($INIMDI2 & $INPUT1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI2 & $INPUT1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI2 & '\' & $INIMDI2 & $INPUT1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI2 & '\' & $INIMDI2 & $INPUT1 & ".MDI" & '"', "", @SW_Maximize) EndIf Case $Msg = $ButtonC3 $Input1 = GUICtrlRead($Input) If WinExists($INIMDI3 & $INPUT1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI3 & $INPUT1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI3 & '\' & $INIMDI3 & $INPUT1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI3 & '\' & $INIMDI3 & $INPUT1 & ".MDI" & '"', "", @SW_Maximize) EndIf Case $Msg = $ButtonC4 $Input1 = GUICtrlRead($Input) If WinExists($INIMDI4 & $INPUT1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI4 & $INPUT1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI4 & '\' & $INIMDI4 & $INPUT1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI4 & '\' & $INIMDI4 & $INPUT1 & ".MDI" & '"', "", @SW_Maximize) EndIf Case $Msg = $ButtonC5 $Input1 = GUICtrlRead($Input) If WinExists($INIMDI5 & $INPUT1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI5 & $INPUT1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI5 & '\' & $INIMDI5 & $INPUT1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI5 & '\' & $INIMDI5 & $INPUT1 & ".MDI" & '"', "", @SW_Maximize) EndIf Case $Msg = $ButtonC6 $Input1 = GUICtrlRead($Input) If WinExists($INIMDI6 & $INPUT1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI6 & $INPUT1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI6 & '\' & $INIMDI6 & $INPUT1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI6 & '\' & $INIMDI6 & $INPUT1 & ".MDI" & '"', "", @SW_Maximize) EndIf Case $Msg = $RoomButton GUISetState(@SW_HIDE, $form1_2) main() Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit EndFunc Func MDIOPEN() $Input1 = GUICtrlRead($input) $INIMDI1 = IniRead(@ScriptDir & "\LogLaunch.ini", $Room, "Log1","") $INIMDI2 = IniRead(@ScriptDir & "\LogLaunch.ini", $Room, "Log2","") $INIMDI3 = IniRead(@ScriptDir & "\LogLaunch.ini", $Room, "Log3", "") $INIMDI4 = IniRead(@ScriptDir & "\LogLaunch.ini", $Room, "Log4", "") $INIMDI5 = IniRead(@ScriptDir & "\LogLaunch.ini", $Room, "Log5", "") $INIMDI6 = IniRead(@ScriptDir & "\LogLaunch.ini", $Room, "Log6", "") ;$LogFile=$INIMDI1 & $INPUT1 & ".MDI" If FileExists($PATH & $INIMDI1 & '\' & $INIMDI1 & $INPUT1 & ".MDI") Then ;MsgBox( 4096, "Exists",'"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI1 & '\' & $INIMDI1 & $INPUT1 & ".MDI" & '"' ) Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI1 & '\' & $INIMDI1 & $INPUT1 & ".MDI" & '"', "",@SW_Minimize) Sleep(1000) WinSetState($INIMDI1 & $INPUT1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf If FileExists($PATH & $INIMDI2 & '\' & $INIMDI2 & $INPUT1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI2 & '\' & $INIMDI2 & $INPUT1 & ".MDI" & '"', "", @SW_Minimize) Sleep(1000) WinSetState($INIMDI2 & $INPUT1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf If FileExists($PATH & $INIMDI3 & '\' & $INIMDI3 & $INPUT1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI3 & '\' & $INIMDI3 & $INPUT1 & ".MDI" & '"', "", @SW_Minimize) Sleep(1000) WinSetState($INIMDI3 & $INPUT1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf If FileExists($PATH & $INIMDI4 & '\' & $INIMDI4 & $INPUT1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI4 & '\' & $INIMDI4 & $INPUT1 & ".MDI" & '"', "", @SW_Minimize) Sleep(1000) WinSetState($INIMDI4 & $INPUT1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf If FileExists($PATH & $INIMDI5 & '\' & $INIMDI5 & $INPUT1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI5 & '\' & $INIMDI5 & $INPUT1 & ".MDI" & '"', "", @SW_Minimize) Sleep(1000) WinSetState($INIMDI5 & $INPUT1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf If FileExists($PATH & $INIMDI6 & '\' & $INIMDI6 & $INPUT1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI6 & '\' & $INIMDI6 & $INPUT1 & ".MDI" & '"', "", @SW_Minimize) Sleep(1000) WinSetState($INIMDI6 & $INPUT1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf EndFunc Func DateSplit() Local $style = "yyyyMMdd" GUICtrlSendMsg($input, 0x1032, 0, $style) EndFunc Func DateSplit1() Local $style = "yyyyMMdd" GUICtrlSendMsg($input2, 0x1032, 0, $style) EndFunc Link to comment Share on other sites More sharing options...
martin Posted September 8, 2009 Share Posted September 8, 2009 Why can't you have one function instead of two, and send the same message to both date controls? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
TuMiM Posted September 8, 2009 Author Share Posted September 8, 2009 Why can't you have one function instead of two, and send the same message to both date controls?The datesplit functions? Link to comment Share on other sites More sharing options...
martin Posted September 8, 2009 Share Posted September 8, 2009 (edited) The datesplit functions? Yes, but you need the controls to have Global variables Global $input = -1, $input1 = -1 Func DateSplit() Local $style = "yyyyMMdd" if $inpu <> -1 then GUICtrlSendMsg($input, 0x1032, 0, $style) if $input1 <> -1 then GUICtrlSendMsg($input1, 0x1032, 0, $style); EndFunc EDIT: I think you need to rethink your script a bit before you can do that. You call Main, then in Main you can call Form2 but in Form2 you can call Main. You will loose control with duplicate guis and controls created all over the place and it will all end in tears I think you need to create both guis in the same function, and use one message loop for both guis using GuiGetMsg(1), and switch the guis between hidden and visible as you do already, but don't rercreate everything each time. Edited September 8, 2009 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
TuMiM Posted September 8, 2009 Author Share Posted September 8, 2009 Yes. Func DateSplit() Local $style = "yyyyMMdd" GUICtrlSendMsg($input, 0x1032, 0, $style) GUICtrlSendMsg($input1, 0x1032, 0, $style) EndFunc If i do that the format on the second gui goes back to the default format and todays date. Either that or i missing something? Link to comment Share on other sites More sharing options...
TuMiM Posted September 9, 2009 Author Share Posted September 9, 2009 Yes, but you need the controls to have Global variables Global $input = -1, $input1 = -1 Func DateSplit() Local $style = "yyyyMMdd" if $inpu <> -1 then GUICtrlSendMsg($input, 0x1032, 0, $style) if $input1 <> -1 then GUICtrlSendMsg($input1, 0x1032, 0, $style); EndFunc EDIT: I think you need to rethink your script a bit before you can do that. You call Main, then in Main you can call Form2 but in Form2 you can call Main. You will loose control with duplicate guis and controls created all over the place and it will all end in tears I think you need to create both guis in the same function, and use one message loop for both guis using GuiGetMsg(1), and switch the guis between hidden and visible as you do already, but don't rercreate everything each time. Martin, Thanks but the problem is that my buttons are dynamic based on which button is chosen in the first gui. If i put it in one function will it be able to change the buttons as it switches between hidden and visible? Link to comment Share on other sites More sharing options...
martin Posted September 9, 2009 Share Posted September 9, 2009 If i do that the format on the second gui goes back to the default format and todays date. Either that or i missing something?I think you are missing something. I mentioned in my post that you need to rethink your script. If you haven't changed the design then this is what happensYou create the main window Form1 and the controls, including the date control in Main.From main you choose Form2 which creates another gui. Now you have 2 guis and 2 sets of controls. Say you set the date format while Form1 is shown. Unless you have made $input1 Global then you can't change $input1 from Form1.Now you leave Form1 thinking you are going back to the Form1 but you are not. You create another form1 and another set of controls. The first form1 and its controls are now inaccessible because they are local variables in the Main function and you have no way to get back into that function. Now you have 3 windows and 3 sets of controls. If you try to switch to Form2 you will have 4 windows and 4 sets of controls.If that doesn't make sense to you then so say so and I will make a modified version of your script which will work. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
TuMiM Posted September 9, 2009 Author Share Posted September 9, 2009 I think you are missing something. I mentioned in my post that you need to rethink your script. If you haven't changed the design then this is what happensYou create the main window Form1 and the controls, including the date control in Main.From main you choose Form2 which creates another gui. Now you have 2 guis and 2 sets of controls. Say you set the date format while Form1 is shown. Unless you have made $input1 Global then you can't change $input1 from Form1.Now you leave Form1 thinking you are going back to the Form1 but you are not. You create another form1 and another set of controls. The first form1 and its controls are now inaccessible because they are local variables in the Main function and you have no way to get back into that function. Now you have 3 windows and 3 sets of controls. If you try to switch to Form2 you will have 4 windows and 4 sets of controls.If that doesn't make sense to you then so say so and I will make a modified version of your script which will work.Martin,Thanks. I am rereading it and i think it is making more sense but I am not sure how i would use it as a global for both guis. Link to comment Share on other sites More sharing options...
martin Posted September 9, 2009 Share Posted September 9, 2009 Martin, Thanks. I am rereading it and i think it is making more sense but I am not sure how i would use it as a global for both guis. Something like this maybe, though I haven't tested it. expandcollapse popup#include <Date.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <DateTimeConstants.au3> Dim $whichbutton, $ButtonC1, $ButtonC2, $ButtonC3, $ButtonC4, $ButtonC5, $ButtonC6, $INIMDI1, $INIMDI2, $INIMDI3, $INIMDI4, $INIMDI5, $INIMDI6, $CALDATE, $input2 Global $input, $room, $log, $input1 $NOWDATE = (@YEAR & @MON & @MDAY) $PATH = IniRead(@ScriptDir & "\LogLaunch.ini", "Global", "Path", "") main() Func main() #Region create Form1_1 $Form1_1 = GUICreate("Log Launch", @DesktopWidth, @DesktopHeight, 0, 0, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $iniBut1 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button1", "") $iniBut2 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button2", "") $iniBut3 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button3", "") $iniBut4 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button4", "") $iniBut5 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button5", "") $iniBut6 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button6", "") $Button1 = GUICtrlCreateButton($iniBut1, 80, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Button2 = GUICtrlCreateButton($iniBut2, 326, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Button3 = GUICtrlCreateButton($iniBut3, 574, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Button4 = GUICtrlCreateButton($iniBut4, 77, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Button5 = GUICtrlCreateButton($iniBut5, 325, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Button6 = GUICtrlCreateButton($iniBut6, 573, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label1 = GUICtrlCreateLabel("Log Launcher", 280, 16, 236, 33) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label3 = GUICtrlCreateLabel("For Date", 280, 66, 100, 33) $input = GUICtrlCreateDate("", 350, 60, 220, 20) DateSplit() ;$CalBut = GUICtrlCreateButton($CALDATE, 420, 60, 25, 20) GUISetState(@SW_SHOW) #EndRegion create Form1_1 #Region create Form1_2 $Form1_2 = GUICreate("Channel Launch", @DesktopWidth, @DesktopHeight, 0, 0, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $iniButC1 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button1", "") $iniButC2 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button2", "") $iniButC3 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button3", "") $iniButC4 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button4", "") $iniButC5 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button5", "") $iniButC6 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button6", "") $RoomButton = GUICtrlCreateButton($room, 80, 16, 50, 50, $WS_GROUP) $ButtonC1 = GUICtrlCreateButton($iniButC1, 80, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC2 = GUICtrlCreateButton($iniButC2, 326, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC3 = GUICtrlCreateButton($iniButC3, 574, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC4 = GUICtrlCreateButton($iniButC4, 77, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC5 = GUICtrlCreateButton($iniButC5, 325, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC6 = GUICtrlCreateButton($iniButC6, 573, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Channel Launcher", 280, 16, 236, 33) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label5 = GUICtrlCreateLabel("For Date", 280, 66, 100, 33) $input2 = GUICtrlCreateDate("", 350, 60, 220, 20) GUISetState(@SW_HIDE) #EndRegion create Form1_2 DateSplit() While 1 $msgA = GUIGetMsg(1) $Msg = $msgA[0] If $msgA[1] = $Form1_1 Then Select Case $Msg = $Button1 $room = $iniBut1 MDIOPEN() $whichbutton = "Button1" GUISetState(@SW_HIDE, $Form1_1) GUISetState(@SW_SHOW, $form1_2) ;Form2() Case $Msg = $Button2 $room = $iniBut2 MDIOPEN() $whichbutton = "Button2" GUISetState(@SW_HIDE, $Form1_1) GUISetState(@SW_SHOW, $form1_2) ;Form2() Case $Msg = $Button3 $room = $iniBut3 MDIOPEN() $whichbutton = "Button3" GUISetState(@SW_HIDE, $Form1_1) GUISetState(@SW_SHOW, $form1_2) ;Form2() Case $Msg = $Button4 $room = $iniBut4 MDIOPEN() $whichbutton = "Button4" GUISetState(@SW_HIDE, $Form1_1) GUISetState(@SW_SHOW, $form1_2) ;Form2() Case $Msg = $Button5 $room = $iniBut5 MDIOPEN() $whichbutton = "Button5" GUISetState(@SW_HIDE, $Form1_1) GUISetState(@SW_SHOW, $form1_2) ;Form2() Case $Msg = $Button6 $room = $iniBut6 MDIOPEN() $whichbutton = "Button6" GUISetState(@SW_HIDE, $Form1_1) GUISetState(@SW_SHOW, $form1_2) ;Form2() Case $Msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect ElseIf $msgA[1] = $Form1_2 Then Select Case $Msg = $ButtonC1 ;DateSplit1() $Input3 = GUICtrlRead($input2) If WinExists($INIMDI1 & $Input3 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI1 & $Input3 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI1 & '\' & $INIMDI1 & $Input3 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI1 & '\' & $INIMDI1 & $Input3 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC2 $input1 = GUICtrlRead($input) If WinExists($INIMDI2 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI2 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI2 & '\' & $INIMDI2 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI2 & '\' & $INIMDI2 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC3 $input1 = GUICtrlRead($input) If WinExists($INIMDI3 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI3 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI3 & '\' & $INIMDI3 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI3 & '\' & $INIMDI3 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC4 $input1 = GUICtrlRead($input) If WinExists($INIMDI4 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI4 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI4 & '\' & $INIMDI4 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI4 & '\' & $INIMDI4 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC5 $input1 = GUICtrlRead($input) If WinExists($INIMDI5 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI5 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI5 & '\' & $INIMDI5 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI5 & '\' & $INIMDI5 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC6 $input1 = GUICtrlRead($input) If WinExists($INIMDI6 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI6 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI6 & '\' & $INIMDI6 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI6 & '\' & $INIMDI6 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $RoomButton GUISetState(@SW_HIDE, $Form1_2) GUISetState(@SW_SHOW, $Form1_1) ;main() Case $Msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect EndIf WEnd Exit EndFunc ;==>main #cs ;Functions Func Form2() ;$Form1_2 = GUICreate("Channel Launch", 1001, 649, 3, 20) $Form1_2 = GUICreate("Channel Launch", @DesktopWidth, @DesktopHeight, 0, 0, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) ;GUISetState(@SW_HIDE) $iniButC1 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button1", "") $iniButC2 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button2", "") $iniButC3 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button3", "") $iniButC4 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button4", "") $iniButC5 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button5", "") $iniButC6 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button6", "") $RoomButton = GUICtrlCreateButton($room, 80, 16, 50, 50, $WS_GROUP) $ButtonC1 = GUICtrlCreateButton($iniButC1, 80, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC2 = GUICtrlCreateButton($iniButC2, 326, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC3 = GUICtrlCreateButton($iniButC3, 574, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC4 = GUICtrlCreateButton($iniButC4, 77, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC5 = GUICtrlCreateButton($iniButC5, 325, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC6 = GUICtrlCreateButton($iniButC6, 573, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Channel Launcher", 280, 16, 236, 33) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label5 = GUICtrlCreateLabel("For Date", 280, 66, 100, 33) $input2 = GUICtrlCreateDate("", 350, 60, 220, 20) DateSplit1() MsgBox(0, "Time", GUICtrlRead($input)) While 1 $Msg = GUIGetMsg() Select Case $Msg = $ButtonC1 ;DateSplit1() $Input3 = GUICtrlRead($input2) If WinExists($INIMDI1 & $Input3 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI1 & $Input3 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI1 & '\' & $INIMDI1 & $Input3 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI1 & '\' & $INIMDI1 & $Input3 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC2 $input1 = GUICtrlRead($input) If WinExists($INIMDI2 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI2 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI2 & '\' & $INIMDI2 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI2 & '\' & $INIMDI2 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC3 $input1 = GUICtrlRead($input) If WinExists($INIMDI3 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI3 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI3 & '\' & $INIMDI3 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI3 & '\' & $INIMDI3 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC4 $input1 = GUICtrlRead($input) If WinExists($INIMDI4 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI4 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI4 & '\' & $INIMDI4 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI4 & '\' & $INIMDI4 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC5 $input1 = GUICtrlRead($input) If WinExists($INIMDI5 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI5 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI5 & '\' & $INIMDI5 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI5 & '\' & $INIMDI5 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC6 $input1 = GUICtrlRead($input) If WinExists($INIMDI6 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI6 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI6 & '\' & $INIMDI6 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI6 & '\' & $INIMDI6 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $RoomButton GUISetState(@SW_HIDE, $Form1_2) main() Case $Msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit EndFunc ;==>Form2 #ce Func MDIOPEN() $input1 = GUICtrlRead($input) $INIMDI1 = IniRead(@ScriptDir & "\LogLaunch.ini", $room, "Log1", "") $INIMDI2 = IniRead(@ScriptDir & "\LogLaunch.ini", $room, "Log2", "") $INIMDI3 = IniRead(@ScriptDir & "\LogLaunch.ini", $room, "Log3", "") $INIMDI4 = IniRead(@ScriptDir & "\LogLaunch.ini", $room, "Log4", "") $INIMDI5 = IniRead(@ScriptDir & "\LogLaunch.ini", $room, "Log5", "") $INIMDI6 = IniRead(@ScriptDir & "\LogLaunch.ini", $room, "Log6", "") ;$LogFile=$INIMDI1 & $INPUT1 & ".MDI" If FileExists($PATH & $INIMDI1 & '\' & $INIMDI1 & $input1 & ".MDI") Then ;MsgBox( 4096, "Exists",'"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI1 & '\' & $INIMDI1 & $INPUT1 & ".MDI" & '"' ) Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI1 & '\' & $INIMDI1 & $input1 & ".MDI" & '"', "", @SW_MINIMIZE) Sleep(1000) WinSetState($INIMDI1 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf If FileExists($PATH & $INIMDI2 & '\' & $INIMDI2 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI2 & '\' & $INIMDI2 & $input1 & ".MDI" & '"', "", @SW_MINIMIZE) Sleep(1000) WinSetState($INIMDI2 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf If FileExists($PATH & $INIMDI3 & '\' & $INIMDI3 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI3 & '\' & $INIMDI3 & $input1 & ".MDI" & '"', "", @SW_MINIMIZE) Sleep(1000) WinSetState($INIMDI3 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf If FileExists($PATH & $INIMDI4 & '\' & $INIMDI4 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI4 & '\' & $INIMDI4 & $input1 & ".MDI" & '"', "", @SW_MINIMIZE) Sleep(1000) WinSetState($INIMDI4 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf If FileExists($PATH & $INIMDI5 & '\' & $INIMDI5 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI5 & '\' & $INIMDI5 & $input1 & ".MDI" & '"', "", @SW_MINIMIZE) Sleep(1000) WinSetState($INIMDI5 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf If FileExists($PATH & $INIMDI6 & '\' & $INIMDI6 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI6 & '\' & $INIMDI6 & $input1 & ".MDI" & '"', "", @SW_MINIMIZE) Sleep(1000) WinSetState($INIMDI6 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf EndFunc ;==>MDIOPEN Func DateSplit() Local $style = "yyyyMMdd" GUICtrlSendMsg($input, 0x1032, 0, $style) GUICtrlSendMsg($input2, 0x1032, 0, $style) EndFunc ;==>DateSplit1 Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
TuMiM Posted September 9, 2009 Author Share Posted September 9, 2009 Something like this maybe, though I haven't tested it. expandcollapse popup#include <Date.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <DateTimeConstants.au3> Dim $whichbutton, $ButtonC1, $ButtonC2, $ButtonC3, $ButtonC4, $ButtonC5, $ButtonC6, $INIMDI1, $INIMDI2, $INIMDI3, $INIMDI4, $INIMDI5, $INIMDI6, $CALDATE, $input2 Global $input, $room, $log, $input1 $NOWDATE = (@YEAR & @MON & @MDAY) $PATH = IniRead(@ScriptDir & "\LogLaunch.ini", "Global", "Path", "") main() Func main() #Region create Form1_1 $Form1_1 = GUICreate("Log Launch", @DesktopWidth, @DesktopHeight, 0, 0, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $iniBut1 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button1", "") $iniBut2 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button2", "") $iniBut3 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button3", "") $iniBut4 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button4", "") $iniBut5 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button5", "") $iniBut6 = IniRead(@ScriptDir & "\LogLaunch.ini", "Main", "Button6", "") $Button1 = GUICtrlCreateButton($iniBut1, 80, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Button2 = GUICtrlCreateButton($iniBut2, 326, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Button3 = GUICtrlCreateButton($iniBut3, 574, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Button4 = GUICtrlCreateButton($iniBut4, 77, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Button5 = GUICtrlCreateButton($iniBut5, 325, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Button6 = GUICtrlCreateButton($iniBut6, 573, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label1 = GUICtrlCreateLabel("Log Launcher", 280, 16, 236, 33) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label3 = GUICtrlCreateLabel("For Date", 280, 66, 100, 33) $input = GUICtrlCreateDate("", 350, 60, 220, 20) DateSplit() ;$CalBut = GUICtrlCreateButton($CALDATE, 420, 60, 25, 20) GUISetState(@SW_SHOW) #EndRegion create Form1_1 #Region create Form1_2 $Form1_2 = GUICreate("Channel Launch", @DesktopWidth, @DesktopHeight, 0, 0, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $iniButC1 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button1", "") $iniButC2 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button2", "") $iniButC3 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button3", "") $iniButC4 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button4", "") $iniButC5 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button5", "") $iniButC6 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button6", "") $RoomButton = GUICtrlCreateButton($room, 80, 16, 50, 50, $WS_GROUP) $ButtonC1 = GUICtrlCreateButton($iniButC1, 80, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC2 = GUICtrlCreateButton($iniButC2, 326, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC3 = GUICtrlCreateButton($iniButC3, 574, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC4 = GUICtrlCreateButton($iniButC4, 77, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC5 = GUICtrlCreateButton($iniButC5, 325, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC6 = GUICtrlCreateButton($iniButC6, 573, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Channel Launcher", 280, 16, 236, 33) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label5 = GUICtrlCreateLabel("For Date", 280, 66, 100, 33) $input2 = GUICtrlCreateDate("", 350, 60, 220, 20) GUISetState(@SW_HIDE) #EndRegion create Form1_2 DateSplit() While 1 $msgA = GUIGetMsg(1) $Msg = $msgA[0] If $msgA[1] = $Form1_1 Then Select Case $Msg = $Button1 $room = $iniBut1 MDIOPEN() $whichbutton = "Button1" GUISetState(@SW_HIDE, $Form1_1) GUISetState(@SW_SHOW, $form1_2) ;Form2() Case $Msg = $Button2 $room = $iniBut2 MDIOPEN() $whichbutton = "Button2" GUISetState(@SW_HIDE, $Form1_1) GUISetState(@SW_SHOW, $form1_2) ;Form2() Case $Msg = $Button3 $room = $iniBut3 MDIOPEN() $whichbutton = "Button3" GUISetState(@SW_HIDE, $Form1_1) GUISetState(@SW_SHOW, $form1_2) ;Form2() Case $Msg = $Button4 $room = $iniBut4 MDIOPEN() $whichbutton = "Button4" GUISetState(@SW_HIDE, $Form1_1) GUISetState(@SW_SHOW, $form1_2) ;Form2() Case $Msg = $Button5 $room = $iniBut5 MDIOPEN() $whichbutton = "Button5" GUISetState(@SW_HIDE, $Form1_1) GUISetState(@SW_SHOW, $form1_2) ;Form2() Case $Msg = $Button6 $room = $iniBut6 MDIOPEN() $whichbutton = "Button6" GUISetState(@SW_HIDE, $Form1_1) GUISetState(@SW_SHOW, $form1_2) ;Form2() Case $Msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect ElseIf $msgA[1] = $Form1_2 Then Select Case $Msg = $ButtonC1 ;DateSplit1() $Input3 = GUICtrlRead($input2) If WinExists($INIMDI1 & $Input3 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI1 & $Input3 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI1 & '\' & $INIMDI1 & $Input3 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI1 & '\' & $INIMDI1 & $Input3 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC2 $input1 = GUICtrlRead($input) If WinExists($INIMDI2 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI2 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI2 & '\' & $INIMDI2 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI2 & '\' & $INIMDI2 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC3 $input1 = GUICtrlRead($input) If WinExists($INIMDI3 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI3 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI3 & '\' & $INIMDI3 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI3 & '\' & $INIMDI3 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC4 $input1 = GUICtrlRead($input) If WinExists($INIMDI4 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI4 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI4 & '\' & $INIMDI4 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI4 & '\' & $INIMDI4 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC5 $input1 = GUICtrlRead($input) If WinExists($INIMDI5 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI5 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI5 & '\' & $INIMDI5 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI5 & '\' & $INIMDI5 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC6 $input1 = GUICtrlRead($input) If WinExists($INIMDI6 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI6 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI6 & '\' & $INIMDI6 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI6 & '\' & $INIMDI6 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $RoomButton GUISetState(@SW_HIDE, $Form1_2) GUISetState(@SW_SHOW, $Form1_1) ;main() Case $Msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect EndIf WEnd Exit EndFunc ;==>main #cs ;Functions Func Form2() ;$Form1_2 = GUICreate("Channel Launch", 1001, 649, 3, 20) $Form1_2 = GUICreate("Channel Launch", @DesktopWidth, @DesktopHeight, 0, 0, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) ;GUISetState(@SW_HIDE) $iniButC1 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button1", "") $iniButC2 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button2", "") $iniButC3 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button3", "") $iniButC4 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button4", "") $iniButC5 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button5", "") $iniButC6 = IniRead(@ScriptDir & "\LogLaunch.ini", $whichbutton, "Button6", "") $RoomButton = GUICtrlCreateButton($room, 80, 16, 50, 50, $WS_GROUP) $ButtonC1 = GUICtrlCreateButton($iniButC1, 80, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC2 = GUICtrlCreateButton($iniButC2, 326, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC3 = GUICtrlCreateButton($iniButC3, 574, 116, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC4 = GUICtrlCreateButton($iniButC4, 77, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC5 = GUICtrlCreateButton($iniButC5, 325, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $ButtonC6 = GUICtrlCreateButton($iniButC6, 573, 320, 145, 121, $WS_GROUP) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Channel Launcher", 280, 16, 236, 33) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label5 = GUICtrlCreateLabel("For Date", 280, 66, 100, 33) $input2 = GUICtrlCreateDate("", 350, 60, 220, 20) DateSplit1() MsgBox(0, "Time", GUICtrlRead($input)) While 1 $Msg = GUIGetMsg() Select Case $Msg = $ButtonC1 ;DateSplit1() $Input3 = GUICtrlRead($input2) If WinExists($INIMDI1 & $Input3 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI1 & $Input3 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI1 & '\' & $INIMDI1 & $Input3 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI1 & '\' & $INIMDI1 & $Input3 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC2 $input1 = GUICtrlRead($input) If WinExists($INIMDI2 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI2 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI2 & '\' & $INIMDI2 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI2 & '\' & $INIMDI2 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC3 $input1 = GUICtrlRead($input) If WinExists($INIMDI3 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI3 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI3 & '\' & $INIMDI3 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI3 & '\' & $INIMDI3 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC4 $input1 = GUICtrlRead($input) If WinExists($INIMDI4 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI4 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI4 & '\' & $INIMDI4 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI4 & '\' & $INIMDI4 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC5 $input1 = GUICtrlRead($input) If WinExists($INIMDI5 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI5 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI5 & '\' & $INIMDI5 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI5 & '\' & $INIMDI5 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $ButtonC6 $input1 = GUICtrlRead($input) If WinExists($INIMDI6 & $input1 & ".MDI - Microsoft Office Document Imaging") Then WinSetState($INIMDI6 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE) ElseIf FileExists($PATH & $INIMDI6 & '\' & $INIMDI6 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI6 & '\' & $INIMDI6 & $input1 & ".MDI" & '"', "", @SW_MAXIMIZE) EndIf Case $Msg = $RoomButton GUISetState(@SW_HIDE, $Form1_2) main() Case $Msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit EndFunc ;==>Form2 #ce Func MDIOPEN() $input1 = GUICtrlRead($input) $INIMDI1 = IniRead(@ScriptDir & "\LogLaunch.ini", $room, "Log1", "") $INIMDI2 = IniRead(@ScriptDir & "\LogLaunch.ini", $room, "Log2", "") $INIMDI3 = IniRead(@ScriptDir & "\LogLaunch.ini", $room, "Log3", "") $INIMDI4 = IniRead(@ScriptDir & "\LogLaunch.ini", $room, "Log4", "") $INIMDI5 = IniRead(@ScriptDir & "\LogLaunch.ini", $room, "Log5", "") $INIMDI6 = IniRead(@ScriptDir & "\LogLaunch.ini", $room, "Log6", "") ;$LogFile=$INIMDI1 & $INPUT1 & ".MDI" If FileExists($PATH & $INIMDI1 & '\' & $INIMDI1 & $input1 & ".MDI") Then ;MsgBox( 4096, "Exists",'"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI1 & '\' & $INIMDI1 & $INPUT1 & ".MDI" & '"' ) Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI1 & '\' & $INIMDI1 & $input1 & ".MDI" & '"', "", @SW_MINIMIZE) Sleep(1000) WinSetState($INIMDI1 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf If FileExists($PATH & $INIMDI2 & '\' & $INIMDI2 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI2 & '\' & $INIMDI2 & $input1 & ".MDI" & '"', "", @SW_MINIMIZE) Sleep(1000) WinSetState($INIMDI2 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf If FileExists($PATH & $INIMDI3 & '\' & $INIMDI3 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI3 & '\' & $INIMDI3 & $input1 & ".MDI" & '"', "", @SW_MINIMIZE) Sleep(1000) WinSetState($INIMDI3 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf If FileExists($PATH & $INIMDI4 & '\' & $INIMDI4 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI4 & '\' & $INIMDI4 & $input1 & ".MDI" & '"', "", @SW_MINIMIZE) Sleep(1000) WinSetState($INIMDI4 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf If FileExists($PATH & $INIMDI5 & '\' & $INIMDI5 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI5 & '\' & $INIMDI5 & $input1 & ".MDI" & '"', "", @SW_MINIMIZE) Sleep(1000) WinSetState($INIMDI5 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf If FileExists($PATH & $INIMDI6 & '\' & $INIMDI6 & $input1 & ".MDI") Then Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI6 & '\' & $INIMDI6 & $input1 & ".MDI" & '"', "", @SW_MINIMIZE) Sleep(1000) WinSetState($INIMDI6 & $input1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MINIMIZE) EndIf EndFunc ;==>MDIOPEN Func DateSplit() Local $style = "yyyyMMdd" GUICtrlSendMsg($input, 0x1032, 0, $style) GUICtrlSendMsg($input2, 0x1032, 0, $style) EndFunc ;==>DateSplit1 Martin, Thanks. That code has the same problem as mine. The second GUI changes to todays date and not the date selected in the previous gui. Link to comment Share on other sites More sharing options...
martin Posted September 9, 2009 Share Posted September 9, 2009 Martin, Thanks. That code has the same problem as mine. The second GUI changes to todays date and not the date selected in the previous gui.I don't see where in your script you have set the date, I can only see that you have set the style. You need to use _GUICtrlDTP_SetSystemTimeEx maybe.If you want both DTPs to show the same date then you need to register a notification that the date has changed and when that is detected update the other DTP. If that doesn't make sense then I can explain more but not now. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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