Jump to content

Can we have Mutable Gui's in one script?


Recommended Posts

My head is bouncing on my desk at work board trying to figure out if it's passable to write a script, that has one master GUI with 1 pagecontroltab with 3 tab Item's (with one tab item not seen) with a button on the pagecontoltab that makes the 2nd GUI visible (2nd GUI is password box) and when the right "passwd" entered in the 2nd GUI, it makes the tab item on master GUI seen and usable. I thought I've seen a couple of examples a week or two ago, that would salve my 2 main issues but I can't find them today.

Any help or better Idea's how to go about doing the above is greatly appreciated if you can understand me.... :) .

Here is a quick Example of what I trying to do :

#include <GUIConstants.au3>
;~MainGUI
#Region ### START Koda GUI section ### Form=c:\program files\autoit3\test\templates\masgui.kxf
$dlgTabbed = GUICreate("Tabbed Notebook Dialog", 416, 314, 203, 132)
GUISetIcon("D:05.ico")
$PageControl1 = GUICtrlCreateTab(8, 8, 396, 256)
$TabSheet1 = GUICtrlCreateTabItem("Work")
GUICtrlSetState(-1,$GUI_SHOW)
$TabSheet2 = GUICtrlCreateTabItem("  QL")
$TabSheet3 = GUICtrlCreateTabItem("Home")

$Group3 = GUICtrlCreateGroup("Secure Logins", 208, 104, 185, 153)
$ACAR1B = GUICtrlCreateButton("CAR L", 216, 192, 43, 25, 0)
$ACAR2B = GUICtrlCreateButton("CAR I", 216, 224, 43, 25, 0)
$AL1B = GUICtrlCreateButton("SL 1", 264, 192, 43, 25, 0)
$AL2B = GUICtrlCreateButton("SL 2", 264, 224, 43, 25, 0)
$AC1B = GUICtrlCreateButton("CAP 1", 344, 192, 43, 25, 0)
$AWMB = GUICtrlCreateButton("WM", 344, 224, 43, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateTabItem("")
GUICtrlSetState(-1, $GUI_DISABLE)
$OKB = GUICtrlCreateButton("&OK", 166, 272, 75, 25, 0)
$EXIT = GUICtrlCreateButton("E&XIT", 246, 272, 75, 25, 0)
$MasExit = GUICtrlCreateButton("END &ALL", 328, 272, 75, 25, 0)
$PWB = GUICtrlCreateButton("(Not allowed)", 8, 272, 36, 36, $BS_ICON)
GUICtrlSetImage($PWB, "C:\Documents and Settings\user\Desktop\a3 test\R2.ico")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###



;~Second Gui
$Password = password
$state = @sw_hide
#Region ### START Koda GUI section ### Form=c:\program files\autoit3\test\templates\password dialog.kxf
$dlgPassword = GUICreate("Password Dialog", 251, 100, -1, -1)
GUISetIcon("D:08.ico")
$PasswordEdit = GUICtrlCreateInput("password", 8, 32, 97, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$ButtonOk = GUICtrlCreateButton("&OK", 14, 64, 75, 25, 0)
$ButtonCancel = GUICtrlCreateButton("&Cancel", 103, 64, 75, 25, 0)
$EnterPassLabel = GUICtrlCreateLabel("Enter password", 8, 36, 77, 17)
GUISetState($state)
#EndRegion ### END Koda GUI section ###



While 1
    $Msg = GUIGetMsg()
    If $Msg = $OKB Then
        While 1
            $state = @SW_SHOW
            Sleep(300)
            If $msg = $ButtonCancel Then
                $state = @SW_HIDE
                ExitLoop
            EndIf
            if $msg = $ButtonOk Then
                If $PasswordEdit = $Password
                    $state = @SW_HIDE
                    ;Unhide tab 3 and made useable
                ExitLoop
            Else
                $state = @SW_HIDE
                ExitLoop
            EndIf
        WEnd
    EndIf
    If $msg = $EXIT Then ExitLoop
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

copied and past wrong script befor sorry.

Mr B.

Edited by mrbloody369

Favorite Quotes"If you apply your mind you can create any thing you can dream of" "Any thing can get done by simply click of a button"

Link to comment
Share on other sites

My head is bouncing on my desk at work board trying to figure out if it's passable to write a script, that has one master GUI with 1 pagecontroltab with 3 tab Item's (with one tab item not seen) with a button on the pagecontoltab that makes the 2nd GUI visible (2nd GUI is password box) and when the right "passwd" entered in the 2nd GUI, it makes the tab item on master GUI seen and usable. I thought I've seen a couple of examples a week or two ago, that would salve my 2 main issues but I can't find them today.

Any help or better Idea's how to go about doing the above is greatly appreciated if you can understand me.... :) .

Here is a quick Example of what I trying to do :

#include <GUIConstants.au3>
;~MainGUI
#Region ### START Koda GUI section ### Form=c:\program files\autoit3\test\templates\masgui.kxf
$dlgTabbed = GUICreate("Tabbed Notebook Dialog", 416, 314, 203, 132)
GUISetIcon("D:05.ico")
$PageControl1 = GUICtrlCreateTab(8, 8, 396, 256)
$TabSheet1 = GUICtrlCreateTabItem("Work")
GUICtrlSetState(-1,$GUI_SHOW)
$TabSheet2 = GUICtrlCreateTabItem("  QL")
$TabSheet3 = GUICtrlCreateTabItem("Home")

$Group3 = GUICtrlCreateGroup("Secure Logins", 208, 104, 185, 153)
$ACAR1B = GUICtrlCreateButton("CAR L", 216, 192, 43, 25, 0)
$ACAR2B = GUICtrlCreateButton("CAR I", 216, 224, 43, 25, 0)
$AL1B = GUICtrlCreateButton("SL 1", 264, 192, 43, 25, 0)
$AL2B = GUICtrlCreateButton("SL 2", 264, 224, 43, 25, 0)
$AC1B = GUICtrlCreateButton("CAP 1", 344, 192, 43, 25, 0)
$AWMB = GUICtrlCreateButton("WM", 344, 224, 43, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateTabItem("")
GUICtrlSetState(-1, $GUI_DISABLE)
$OKB = GUICtrlCreateButton("&OK", 166, 272, 75, 25, 0)
$EXIT = GUICtrlCreateButton("E&XIT", 246, 272, 75, 25, 0)
$MasExit = GUICtrlCreateButton("END &ALL", 328, 272, 75, 25, 0)
$PWB = GUICtrlCreateButton("(Not allowed)", 8, 272, 36, 36, $BS_ICON)
GUICtrlSetImage($PWB, "C:\Documents and Settings\user\Desktop\a3 test\R2.ico")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;~Second Gui
$Password = password
$state = @sw_hide
#Region ### START Koda GUI section ### Form=c:\program files\autoit3\test\templates\password dialog.kxf
$dlgPassword = GUICreate("Password Dialog", 251, 100, -1, -1)
GUISetIcon("D:08.ico")
$PasswordEdit = GUICtrlCreateInput("password", 8, 32, 97, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$ButtonOk = GUICtrlCreateButton("&OK", 14, 64, 75, 25, 0)
$ButtonCancel = GUICtrlCreateButton("&Cancel", 103, 64, 75, 25, 0)
$EnterPassLabel = GUICtrlCreateLabel("Enter password", 8, 36, 77, 17)
GUISetState($state)
#EndRegion ### END Koda GUI section ###
While 1
    $Msg = GUIGetMsg()
    If $Msg = $OKB Then
        While 1
            $state = @SW_SHOW
            Sleep(300)
            If $msg = $ButtonCancel Then
                $state = @SW_HIDE
                ExitLoop
            EndIf
            if $msg = $ButtonOk Then
                If $PasswordEdit = $Password
                    $state = @SW_HIDE
                    ;Unhide tab 3 and made useable
                ExitLoop
            Else
                $state = @SW_HIDE
                ExitLoop
            EndIf
        WEnd
    EndIf
    If $msg = $EXIT Then ExitLoop
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

copied and past wrong script befor sorry.

Mr B.

This is a quick go at producing something near what I think you want.

#include <GUIConstants.au3>
;~MainGUI
#Region ### START Koda GUI section ### Form=c:\program files\autoit3\test\templates\masgui.kxf
$dlgTabbed = GUICreate("Tabbed Notebook Dialog", 416, 314, 203, 132)
GUISetIcon("D:05.ico")
$PageControl1 = GUICtrlCreateTab(8, 8, 396, 256)
$TabSheet1 = GUICtrlCreateTabItem("Work")
GUICtrlSetState(-1,$GUI_SHOW)
$TabSheet2 = GUICtrlCreateTabItem("  QL")
GUICtrlCreateTabItem("")
$OKB = GUICtrlCreateButton("&OK", 166, 272, 75, 25, 0)
$EXIT = GUICtrlCreateButton("E&XIT", 246, 272, 75, 25, 0)
$MasExit = GUICtrlCreateButton("END &ALL", 328, 272, 75, 25, 0)
$PWB = GUICtrlCreateButton("(Not allowed)", 8, 272, 36, 36, $BS_ICON)
GUICtrlSetImage($PWB, "C:\Documents and Settings\user\Desktop\a3 test\R2.ico")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###





While 1
    $Msg = GUIGetMsg()
    If $Msg = $OKB Then
        GetPW()
    EndIf
    If $msg = $EXIT Then MakeTab3();ExitLoop
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd


;~Second Gui
Func GetPW()
    ConsoleWrite("pw1" & @CRLF)
    $Password = 'password'
;$state = @sw_hide
    #Region ### START Koda GUI section ### Form=c:\program files\autoit3\test\templates\password dialog.kxf
    $dlgPassword = GUICreate("Password Dialog", 251, 100, -1, -1)
    GUISetIcon("D:08.ico")
    $PasswordEdit = GUICtrlCreateInput("password", 8, 32, 97, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
    $ButtonOk = GUICtrlCreateButton("&OK", 14, 64, 75, 25, 0)
    $ButtonCancel = GUICtrlCreateButton("&Cancel", 103, 64, 75, 25, 0)
    $EnterPassLabel = GUICtrlCreateLabel("Enter password", 8, 20, 77, 17)
    GUISetState(@SW_SHOW,$dlgPassword)
    #EndRegion ### END Koda GUI section ###
    While 1
        $Msg = GUIGetMsg()
        
        If $msg = $ButtonCancel Then
            
            ExitLoop
        EndIf
        
        
        if $msg = $ButtonOk Then
            If GUICtrlRead($PasswordEdit) = $Password Then
                MakeTab3()
                
                ExitLoop
                
            EndIf
        EndIf
        
    WEnd
    GUIDelete($dlgPassword)
EndFunc


Func MakeTab3()
    GUISwitch($dlgTabbed)
    $TabSheet3 = GUICtrlCreateTabItem("Home")

    $Group3 = GUICtrlCreateGroup("Secure Logins", 208, 104, 185, 153)
    $ACAR1B = GUICtrlCreateButton("CAR L", 216, 192, 43, 25, 0)
    $ACAR2B = GUICtrlCreateButton("CAR I", 216, 224, 43, 25, 0)
    $AL1B = GUICtrlCreateButton("SL 1", 264, 192, 43, 25, 0)
    $AL2B = GUICtrlCreateButton("SL 2", 264, 224, 43, 25, 0)
    $AC1B = GUICtrlCreateButton("CAP 1", 344, 192, 43, 25, 0)
    $AWMB = GUICtrlCreateButton("WM", 344, 224, 43, 25, 0)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    
    GUICtrlSetState(-1, $GUI_DISABLE)
    
EndFunc
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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...