Sign in to follow this  
Followers 0
TuMiM

Problem with gui

5 posts in this topic

I have a script that I created that has two forms. I created a button to switch back to the main form but when it goes back to the main form, none of the buttons work any longer. I know my scripting may not be conventional but i'm not expert yet.

#include <Date.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Dim $whichbutton, $ButtonC1, $ButtonC2, $ButtonC3, $ButtonC4, $ButtonC5, $ButtonC6, $INIMDI1, $INIMDI2, $INIMDI3, $INIMDI4, $INIMDI5, $INIMDI6

$NOWDATE=(@YEAR & @MON & @MDAY)
$PATH = IniRead(@ScriptDir & "\LogLaunch.ini", "Global", "Path", "")

;$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 = GUICtrlCreateInput($NOWDATE, 350, 60, 66, 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


;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)
$input = GUICtrlCreateInput($NOWDATE, 350, 60, 66, 20)
        
    While 1
    $msg = GUIGetMsg()
    Select  
            Case $Msg = $ButtonC1
                $Input1 = GUICtrlRead($Input)
    If WinExists($INIMDI1 & $INPUT1 & ".MDI - Microsoft Office Document Imaging") Then
        WinSetState($INIMDI1 & $INPUT1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE)
    ElseIf FileExists($PATH & $INIMDI1 & '\' & $INIMDI1 & $INPUT1 & ".MDI") Then
        Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI1 & '\' & $INIMDI1 & $INPUT1 & ".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)
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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

When you hide the one GUI and show the other on $RoomButton, you are still trapped in the same While/WEnd loop of the second GUI. Only $GUI_EVENT_CLOSE exits the loop and goes back to the first loop.

>_<

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

so is there a way around this by issuing the gui_event_close or will that close the entire gui?

Share this post


Link to post
Share on other sites

If i try to use a $GUI_EVENT_CLOSE it closes the entire program

Share this post


Link to post
Share on other sites

This will work for you...

#include <Date.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Dim $whichbutton, $ButtonC1, $ButtonC2, $ButtonC3, $ButtonC4, $ButtonC5, $ButtonC6, $INIMDI1, $INIMDI2, $INIMDI3, $INIMDI4, $INIMDI5, $INIMDI6
global $input,$room,$log
$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 = GUICtrlCreateInput($NOWDATE, 350, 60, 66, 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)
$input = GUICtrlCreateInput($NOWDATE, 350, 60, 66, 20)
        
    While 1
    $msg = GUIGetMsg()
    Select  
            Case $Msg = $ButtonC1
                $Input1 = GUICtrlRead($Input)
    If WinExists($INIMDI1 & $INPUT1 & ".MDI - Microsoft Office Document Imaging") Then
        WinSetState($INIMDI1 & $INPUT1 & ".MDI - Microsoft Office Document Imaging", "", @SW_MAXIMIZE)
    ElseIf FileExists($PATH & $INIMDI1 & '\' & $INIMDI1 & $INPUT1 & ".MDI") Then
        Run('"C:\Program Files\Common Files\Microsoft Shared\MODI\12.0\mspview.exe"' & " " & '"' & $PATH & $INIMDI1 & '\' & $INIMDI1 & $INPUT1 & ".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

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0