Jump to content

InputBox Password *s


 Share

Recommended Posts

I remember doing this once, but I forgot, but how can I replace all characters in a gui inputbox with a *?

ALSO, how can I make sure that an inputbox only contains numbers?

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

how can I make sure that an inputbox only contains numbers?

Check my custom _InputBox from my signature.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Hi...

do

$passwd = InputBox("Security Check", "Enter your password.", "", "*")

Until StringIsDigit($passwd)

That is ok, but resizable, how to make like that but no resizable?

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

Exactly what you're looking for:

$hWnd = WinGetHandle(WinGetTitle(""))

$Ret = _InputBox("InputBox demo", "Type password... " & @LF & "[Only Numbers are allowed]" & @LF & "[Maximum 8 Numbers]", _
    "", $hWnd, 1, 1, 8, -1, 220, -1, -1, 0, 0x00000008, 40)

If Not @error And $Ret <> "" Then MsgBox(262144+64, "Returned value", "You type <" & $Ret & ">", 20)
If @error = 2 And $Ret <> "" Then MsgBox(262144+64, "Returned value", "Time is out, here is what are you typed <" & $Ret & ">", 20)

Func _InputBox($Title,$Promt,$Default="",$hWnd=0,$IsPassword=0,$IsDigits=0,$Limit=-1,$Width=-1,$Height=-1,$Left=-1,$Top=-1,$Style=0,$exStyle=0,$Timeout=0)
    Local $OldOpt = Opt("GuiOnEventMode", 0)
    WinSetState($hWnd, "", @SW_DISABLE)
    If $Width < 200 Then $Width = 200
    If $Height < 150 Then $Height = 150
    
    Local $InputGui, $OKButton, $CancelButton, $InputBoxID, $Msg, $GuiCoords, $RetValue, $RetErr=0, $InputMsg, $TimerStart
    
    $InputGui = GUICreate($Title, $Width, $Height, $Left, $Top, $Style, $exStyle, $hWnd)
    
    GUICtrlCreateLabel($Promt, 15, 5, $Width, -1)
    GUICtrlSetResizing(-1, 256+512)
    GUIRegisterMsg(0x24, "MY_WM_GETMINMAXINFO")
    
    $OKButton = GUICtrlCreateButton("OK", ($Width/2)-70, $Height-95, 60, 25)
    GUICtrlSetResizing(-1, 0x0240)
    GUICtrlSetState(-1, 2048)
    GUICtrlSetState(-1, 512)
    $CancelButton = GUICtrlCreateButton("Cancel", ($Width/2)+10, $Height-95, 60, 25)
    GUICtrlSetResizing(-1, 0x0240)
    GUICtrlSetState(-1, 2048)
    
    If $IsPassword <> 0 Then $IsPassword = 32
    If $IsDigits <> 0 Then $IsDigits = 8192
    $InputBoxID = GUICtrlCreateInput($Default, 20, $Height-60, $Width-40, 20, $IsPassword+$IsDigits+128, 0x00000001)
    GUICtrlSetResizing(-1, 0x0240)
    GUICtrlSetState(-1, 256)
    If $Limit <> -1 Then GUICtrlSetLimit(-1, $Limit)
    
    GUISetState(@SW_SHOW, $InputGui)
    If $Timeout > 0 Then $TimerStart = TimerInit()
    
    While 1
        $InputMsg = GUIGetMsg()
        Switch $InputMsg
            Case -12
                ControlFocus($InputGui, "", $OKButton)
                ControlFocus($InputGui, "", $CancelButton)
            Case -3, $CancelButton
                $RetValue = ""
                $RetErr = 1
                ExitLoop
            Case $OKButton
                $RetValue = GUICtrlRead($InputBoxID)
                $RetErr = 0
                ExitLoop
        EndSwitch
        
        If $Timeout > 0 And Round(TimerDiff($TimerStart)/1000) = $Timeout Then
            $RetValue = GUICtrlRead($InputBoxID)
            $RetErr = 2
            ExitLoop
        EndIf
    WEnd
    WinSetState($hWnd, "", @SW_ENABLE)
    GUIDelete($InputGui)
    GUISwitch($hWnd)
    Opt("GuiOnEventMode", $OldOpt)
    Return SetError($RetErr, 0, $RetValue)
EndFunc

Func MY_WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
    Local $MinMaxInfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int",$lParam)
    Local $MINGuiX = 200, $MINGuiY = 150, $MAXGuiX = 400, $MAXGuiY = 300
    DllStructSetData($MinMaxInfo, 7, $MINGuiX) ; Min X
    DllStructSetData($MinMaxInfo, 8, $MINGuiY) ; Min Y
    DllStructSetData($MinMaxInfo, 9, $MAXGuiX) ; Max X
    DllStructSetData($MinMaxInfo, 10, $MAXGuiY) ; Max Y
    Return 0
EndFunc
Edited by magician13134
Link to comment
Share on other sites

  • 2 weeks later...

Ooohh...sorry, I forgot to mention a GUI Inputbox... Not a popup one...

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

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