Jump to content

More than 1 GUI


Skrip
 Share

Recommended Posts

I need to have 2 GUI open in 1 script, but it won't work, look in "Simple Keypad" script in Script section, after the code is entered I need another GUI to open, but it won't work. Please help

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

  • Moderators

I need to have 2 GUI open in 1 script, but it won't work, look in "Simple Keypad" script in Script section, after the code is entered I need another GUI to open, but it won't work. Please help

Want to supply the code?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

i saw the post... i did a similar thing

Like this

#include <GuiConstants.au3>
#include <IE.au3>

Opt("GUIOnEventMode", 1)

Dim $BTN_[40]
Dim $x
Dim $ver = "1.0.1"

Dim $left = 0
Dim $top = 0
$key = StringSplit("1,2,3,4,5,6,7,8,9,0,Q,W,E,R,T,Y,U,I,O,P,A,S,D,F,G,H,J,K,L,Z,X,C,V,B,N,M", ",")

$gui = GUICreate("QTasc Inc   v" & $ver, @DesktopWidth, @DesktopHeight - 60, -1, -1)

$keybd = GUICtrlCreateButton("SHOW KEYBOARD", 100, @DesktopHeight - 150, 150, 40)
GUICtrlCreateLabel("Presented by, QTasc ", @DesktopWidth - 170, @DesktopHeight - 120, 120, 15, $SS_SUNKEN)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUISetState()

$mainwindow = GUICreate("Keyboard - Enter Your PIN Number", 400, 200, 20, @DesktopHeight - 300, -1, "", $gui)

; BUTTONS
For $i = 1 To 36
    $BTN_[$i] = GUICtrlCreateButton($key[$i], $left, $top, 40, 40)
    GUICtrlSetOnEvent($BTN_[$i], "ButtonPressed")
    $left = $left + 40
    If $i = 10 Or $i = 20 Or $i = 29 Then $top = $top + 40
    If $i = 10 Then $left = 0
    If $i = 20 Then $left = 20
    If $i = 29 Then $left = 40
Next

$BackSpace = GUICtrlCreateButton("<-", 320, 120, 40, 40)
GUICtrlSetFont(-1, 10, 500)
$Input = GUICtrlCreateInput("", 40, 170, 150, 20)
GUICtrlSetFont(-1, 10)
$Send = GUICtrlCreateButton("&ENTER", 205, 165, 150, 30)

GUICtrlSetOnEvent($keybd, "Show_keys")
GUICtrlSetOnEvent($BackSpace, "Back_Space")
GUICtrlSetOnEvent($Send, "Send_it")
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUISetState(@SW_SHOW)

WinSetOnTop("Keyboard", "", 1)

While (1)
    Sleep(20)
WEnd

Func Show_keys()
    GUISetState(@SW_SHOW, $mainwindow)
EndFunc  ;==>Show_keys

Func ButtonPressed()
    $i = @GUI_CtrlId - $BTN_[1] + 1; array starts at item 1, so add 1
    $info1 = GUICtrlRead($Input)
    GUICtrlSetData($Input, $info1 & $key[$i])
EndFunc  ;==>ButtonPressed

Func Back_Space()
    $info1 = GUICtrlRead($Input)
    $info1 = StringTrimRight($info1, 1)
    GUICtrlSetData($Input, $info1)
EndFunc  ;==>Back_Space

Func CLOSEClicked()
    If @GUI_WinHandle = $mainwindow Then
        GUISetState(@SW_HIDE, $mainwindow)
    EndIf
    If @GUI_WinHandle = $gui Then
        Exit
    EndIf
EndFunc  ;==>CLOSEClicked

Func Send_it()
    MsgBox(0,"", GUICtrlRead($Input))
EndFunc  ;==>Send_it

8)

NEWHeader1.png

Link to comment
Share on other sites

Want to supply the code?

http://www.autoitscript.com/forum/index.php?showtopic=21557

Hmm Val, I see how you did that, I'll test it on my script

EDIT: Turns out it didn't work, but I figured it out, Valuater i'll PM you or post if I need mor help

Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("Password", 142, 400,(@DesktopWidth-142)/2, (@DesktopHeight-206)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$button_reset = GUICtrlCreateButton("Reset", 0, 0, 40, 20)
$Button_1 = GuiCtrlCreateButton("1", 10, 20, 40, 40)
$Button_2 = GuiCtrlCreateButton("2", 50, 20, 40, 40)
$Button_3 = GuiCtrlCreateButton("3", 90, 20, 40, 40)
$Button_4 = GuiCtrlCreateButton("4", 10, 60, 40, 40)
$Button_5 = GuiCtrlCreateButton("5", 50, 60, 40, 40)
$Button_6 = GuiCtrlCreateButton("6", 90, 60, 40, 40)
$Button_7 = GuiCtrlCreateButton("7", 10, 100, 40, 40)
$Button_8 = GuiCtrlCreateButton("8", 50, 100, 40, 40)
$Button_9 = GuiCtrlCreateButton("9", 90, 100, 40, 40)
$Button_10 = GuiCtrlCreateButton("Enter", 10, 140, 120, 30)
$Label_11 = GuiCtrlCreateLabel("Please Enter Password", 10, 170, 110, 20)
$pass = 0
Dim $b_test
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        If $pass = 0 Then
            $pass = 1
        EndIf
    Case $msg = $Button_2
        $pass = 0
    Case $msg = $Button_3
        If $pass = 1 Then
            $pass = 2
        EndIf
    Case $msg = $Button_4
        $pass = 0
    Case $msg = $Button_5
        If $pass = 2 Then
            $pass = 3
        EndIf
    Case $msg = $Button_6
        $pass = 0
    Case $msg = $Button_7
        $pass = 0
    Case $msg = $Button_8
        $pass = 0
    Case $msg = $Button_9
        If $pass = 3 Then
            $pass = 4
        EndIf
    Case $msg = $button_reset
        $pass = 0
    Case $msg = $Button_10
        If $pass = 4 Then
            MsgBox(0, "Unlocked", "It worked")
            $b_test = GUICtrlCreateButton("Test", 10, 190, 40, 20)
            While 1
                $msg2 = GuiGetMsg()
                Select
                    Case $msg2 = $GUI_EVENT_CLOSE
                        ExitLoop
                Case $msg2 = $b_test
                    MsgBox(0, "ttgth", "tfgfdg")
                EndSelect
            WEnd
            Exit
        EndIf
        $pass = 0
    EndSelect
WEnd
Exit

I just expaneded it, and had it add buttons as needed

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

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...