Jump to content

Toolbar Help


Recommended Posts

im having trouble setting buttons to do commands... i have them organized they way i want them, but im having problems finding a way to set the button to erase the inputs, or do anything... does any one have an idea on what to do?

;*******************************
;******(c) copywrite 2008*******
;*******************************

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <GuiConstants.au3>

$Debug_TB = False

    TraySetIcon         ("Shell32.dll", 14 )
    TraySetToolTip      ("Auto Login For Pitt")
    Opt                 ("TrayMenuMode",1)
    Global Enum $idNew = 1000
    Local $hGUI, $aSize

    ; Create GUI
    
;----------GUI-------------------------------------------------------------------


        $Form1      =   GUICreate                   ("Auto Sign-In", 203, 116, 601, 247)
        $hToolbar   =   _GUICtrlToolbar_Create      ($Form1)
        $aSize      =   _GUICtrlToolbar_GetMaxSize  ($hToolbar)
        ; Add standard system bitmaps
                        _GUICtrlToolbar_AddBitmap   ($hToolbar, 1, -1, $IDB_STD_Small_COLOR)

        ; Add buttons
                        _GUICtrlToolbar_AddButton       ($hToolbar, $idNew, $STD_DELETE )
                        _GUICtrlToolbar_SetButtonText   ($hToolbar, $idNew, "&Cut")

        $Input1     =   GUICtrlCreateInput      ("",72, 25, 113, 17)
                        GUICtrlSetFont          (-1, 8 , "" , "" , "Lucida console" )
                        GUICtrlSetTip           (-1,"Insert your username here","",1,1)
        $Input2     =   GUICtrlCreateInput      ("", 72, 52, 113, 19,$ES_PASSWORD)
                        GUICtrlSetCursor        (-1, 3)
                        GUICtrlSetFont          (-1, 10 , "" , "" ,"Lucida console" )
                        GUICtrlSetTip           (-1,"Insert your password here","",1,1)
        $Label1     =   GUICtrlCreateLabel      ("User Name:",9, 29, 60, 17)
                        GUICtrlSetFont          (-1, 8 , "" , "" , "Lucida console" )
        $Label2     =   GUICtrlCreateLabel      ("Password:", 16, 57, 53, 17)
                        GUICtrlSetFont          (-1, 8 , "" , "" , "Lucida console" )
        $Button1    =   GUICtrlCreateButton     ("Accept", 203/2-71/2, 72, 73, 21, 0)
                        GUICtrlSetImage         (-1, "shell32.dll",18,0)
                        GUICtrlSetCursor        (-1, 0)
                        GUICtrlSetFont          (-1, 8 , "" , "" , "Lucida console" )
                        GUICtrlSetTip           (-1,"Accept changes and minimize to tray","",1,3)
                        GUICtrlSetState         (-1,$GUI_FOCUS)
                        GUISetState             (@SW_SHOW)
;--------------------------------------------------------------------------------
$set = TrayCreateItem("Settings")
$res = TrayCreateItem("Terminate")
while 1
    $msg = GUIGetMsg()
    $msg1 = TrayGetMsg()
            If $msg = $Button1  Then
                $user = GUICtrlRead($Input1)
                $pass = GUICtrlRead($Input2)
                        GUISetState(@SW_HIDE,$Form1)
                    EndIf
            ; help is needed here-----------------
            
            If $msg = $idNew Then
                GUICtrlSetData($Input1,"")
                GUICtrlSetData($Input2,"")
            EndIf
            
            
            ;--------------------------------------
            If WinActivate("Enter Credentials") Then
                sleep(1000)
                send ($user&"{tab}"&$pass)
                sleep(200)
                send ("{enter}")
            EndIf
        If $msg1 = $set Then
        GUISetState(@SW_SHOW,$Form1)
        EndIf
        If $msg1 = $res or $msg = $GUI_EVENT_CLOSE Then
        ExitLoop
    EndIf
     
WEnd

[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

Link to comment
Share on other sites

Is this what you were looking to do? When you click the toolbar button, it'll clear both input boxes.

;*******************************
;******© copywrite 2008*******
;*******************************

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <GuiConstants.au3>

$Debug_TB = False

    TraySetIcon   ("Shell32.dll", 14 )
    TraySetToolTip    ("Auto Login For Pitt")
    Opt     ("TrayMenuMode",1)
    Global Enum $idNew = 1000
    Local $hGUI, $aSize

    ; Create GUI
    
;----------GUI-------------------------------------------------------------------


        $Form1   =    GUICreate          ("Auto Sign-In", 203, 116, 601, 247)
        $hToolbar   =     _GUICtrlToolbar_Create   ($Form1)
        $aSize   =    _GUICtrlToolbar_GetMaxSize     ($hToolbar)
        ; Add standard system bitmaps
                        _GUICtrlToolbar_AddBitmap   ($hToolbar, 1, -1, $IDB_STD_Small_COLOR)

        ; Add buttons
                        _GUICtrlToolbar_AddButton     ($hToolbar, $idNew, $STD_DELETE )
                        _GUICtrlToolbar_SetButtonText   ($hToolbar, $idNew, "&Cut")

        $Input1     =   GUICtrlCreateInput        ("",72, 25, 113, 17)
                        GUICtrlSetFont    (-1, 8 , "" , "" , "Lucida console" )
                        GUICtrlSetTip         (-1,"Insert your username here","",1,1)
        $Input2  =    GUICtrlCreateInput  ("", 72, 52, 113, 19,$ES_PASSWORD)
                        GUICtrlSetCursor        (-1, 3)
                        GUICtrlSetFont    (-1, 10 , "" , "" ,"Lucida console" )
                        GUICtrlSetTip         (-1,"Insert your password here","",1,1)
        $Label1  =    GUICtrlCreateLabel  ("User Name:",9, 29, 60, 17)
                        GUICtrlSetFont    (-1, 8 , "" , "" , "Lucida console" )
        $Label2     =   GUICtrlCreateLabel        ("Password:", 16, 57, 53, 17)
                        GUICtrlSetFont    (-1, 8 , "" , "" , "Lucida console" )
        $Button1    =   GUICtrlCreateButton      ("Accept", 203/2-71/2, 72, 73, 21, 0)
                        GUICtrlSetImage         (-1, "shell32.dll",18,0)
                        GUICtrlSetCursor        (-1, 0)
                        GUICtrlSetFont    (-1, 8 , "" , "" , "Lucida console" )
                        GUICtrlSetTip         (-1,"Accept changes and minimize to tray","",1,3)
                        GUICtrlSetState   (-1,$GUI_FOCUS)
                        GUISetState    (@SW_SHOW)

;--------------------------------------------------------------------------------
$set = TrayCreateItem("Settings")
$res = TrayCreateItem("Terminate")
while 1
    $msg = GUIGetMsg()
    $msg1 = TrayGetMsg()
            If $msg = $Button1  Then
                $user = GUICtrlRead($Input1)
                $pass = GUICtrlRead($Input2)
                        GUISetState(@SW_HIDE,$Form1)
            EndIf
                    
            If _GUICtrlToolbar_IsButtonPressed($hToolbar, $idNew) Then
                GUICtrlSetData($Input1,"")
                GUICtrlSetData($Input2,"")
            EndIf
            
            If WinActivate("Enter Credentials") Then
                sleep(1000)
                send ($user&"{tab}"&$pass)
                sleep(200)
                send ("{enter}")
            EndIf
        If $msg1 = $set Then
        GUISetState(@SW_SHOW,$Form1)
        EndIf
        If $msg1 = $res or $msg = $GUI_EVENT_CLOSE Then
        ExitLoop
    EndIf
     
 WEnd
Edited by covaks
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...