Jump to content
Sign in to follow this  

Character limit in an input box

Recommended Posts

Hey guys. This question has already been asked before but as it was like a year ago I wondered if there still was no better way of doing it other than


What I'm aiming to do is create a GUI that takes down credit card details from our customer that call up on the phone.

I want to have 4 boxes for the long number on the card.

I want each box to have a limit of 4 characters and I want it to automatically move the attention to the next input box. Is there a way of doing this better then how the link solves it?

Thanks in advance

Share this post

Link to post
Share on other sites

yes that answers my limiting question thank you, but i need something that will send out a signal when it hits the limit so i can change the focus to the next input box. any ideas?

Share this post

Link to post
Share on other sites

I tried this, but i'ts not working as is supposed to.

#include <GUIConstants.au3>

Global $LimiReached = False

$GUI = GUICreate("", 500, 500)
$Input1 = GUICtrlCreateInput("", 10, 10, 150, 20)
$Input2 = GUICtrlCreateInput("", 10, 35, 150, 20)

GUICtrlSetLimit($Input1, 10, 0)

While Sleep(10)
    Switch GUIGetMsg()
        Case -3

    If (StringLen(GUICtrlRead($Input1)) = 10 & $LimiReached = False) Then
        GUICtrlSetState($Input2, $GUI_FOCUS)
        $LimiReached = True

    ConsoleWrite("Length input1: " & StringLen(GUICtrlRead($Input1)) & @CRLF & "Limit reached: " & $LimiReached & @CRLF) ; Weird enough, $LimiReached is set to True without input1 having 10 characters... Weird.

Read my comment btw... :blink:


A minesweeper game created in autoit, source available.


An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...