Sign in to follow this  
Followers 0
craigholohan

Move to new input

5 posts in this topic

Hi All,

Please see below script.

I am trying to get the curser to automatically move to the next input box once the 2 characters have been entered instead of having to use the Tab button to move the curser.

Any ideas?

Thanks in advance.

#include <GuiConstants.au3>

AutoItSetOption('RunErrorsFatal', 0)
Opt ("GUIOnEventMode", 1)

Global Const $s_Title = 'Input Box'
local $input, $btnExit

$Main_Form = GUICreate($s_Title ,400,100,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$btnTest = GUICtrlCreateButton("Not Standard", 70, 50, 125, 40)
GUICtrlSetOnEvent($btnTest, "_Notstandard")
$btnExit = GUICtrlCreateButton("Exit", 210, 50, 125, 40)
GUICtrlSetOnEvent($btnExit, "_exit")

$input1 = GuiCtrlCreateInput("", 70, 10, 40, 30)
GUICtrlSetLimit(-1,2) 
GuiCtrlSetFont($input1,15,900)
GuiCtrlSetColor($input1,0x008866)

$input2 = GuiCtrlCreateInput("", 115, 10, 40, 30)
GUICtrlSetLimit(-1,2) 
GuiCtrlSetFont($input2,15,900)
GuiCtrlSetColor($input2,0x008866)

$input3 = GuiCtrlCreateInput("", 160, 10, 40, 30)
GUICtrlSetLimit(-1,2) 
GuiCtrlSetFont($input3,15,900)
GuiCtrlSetColor($input3,0x008866)

$input4 = GuiCtrlCreateInput("", 205, 10, 40, 30)
GUICtrlSetLimit(-1,2) 
GuiCtrlSetFont($input4,15,900)
GuiCtrlSetColor($input4,0x008866)

$input5 = GuiCtrlCreateInput("", 250, 10, 40,30)
GUICtrlSetLimit(-1,2) 
GuiCtrlSetFont($input5,15,900)
GuiCtrlSetColor($input5,0x008866)

$input6 = GuiCtrlCreateInput("", 295, 10, 40, 30)
GUICtrlSetLimit(-1,2) 
GuiCtrlSetFont($input6,15,900)
GuiCtrlSetColor($input6,0x008866)

GUISetState()
$msg = 0

While 1
    sleep(1000)
    $read_input1 = GUICtrlRead($input1)
    $read_input2 = GUICtrlRead($input2)
    $read_input3 = GUICtrlRead($input3)
    $read_input4 = GUICtrlRead($input4)
    $read_input5 = GUICtrlRead($input5)
    $read_input6 = GUICtrlRead($input6)
    $read_All = ($read_input1&$read_input2&$read_input3&$read_input4&$read_input5&$read_input6)
WEnd

Func _exit()
    Exit
EndFunc

Func _Notstandard()
    MsgBox (0,"Read",$read_All)
EndFunc

Share this post


Link to post
Share on other sites



maybe...

#include <GuiConstants.au3>

AutoItSetOption('RunErrorsFatal', 0)
Opt("GUIOnEventMode", 1)

Global Const $s_Title = 'Input Box'
Global $input[8], $read_All
Local $input, $btnExit

$Main_Form = GUICreate($s_Title, 400, 100, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$btnTest = GUICtrlCreateButton("Not Standard", 70, 50, 125, 40)
GUICtrlSetOnEvent($btnTest, "_Notstandard")
$btnExit = GUICtrlCreateButton("Exit", 210, 50, 125, 40)
GUICtrlSetOnEvent($btnExit, "_exit")

Local $left = 70
For $x = 1 To 7
    $input[$x] = GUICtrlCreateInput("", $left, 10, 40, 30)
    GUICtrlSetLimit(-1, 2)
    GUICtrlSetFont(-1, 15, 900)
    GUICtrlSetColor(-1, 0x008866)
    $left += 45
Next


GUISetState()

GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")

$box = 1
While 1
    For $x = $box To 7
        If StringLen(GUICtrlRead($input[$x])) = 2 Then
            Send("{TAB}")
            $box += 1
        EndIf
        Sleep(200)
        
    Next

    Sleep(100)
WEnd

Func _exit()
    Exit
EndFunc   ;==>_exit

Func _Notstandard()
    ; $read_All = ($read_input1&$read_input2&$read_input3&$read_input4&$read_input5&$read_input6)
    MsgBox(0, "Read", $read_All)
EndFunc   ;==>_Notstandard

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I am trying to get the curser to automatically move to the next input box once the 2 characters have been entered instead

of having to use the Tab button to move the curser.

Curser should've been cursor...also, here's a little read from WikiPedia :

"The term caret is also sometimes used in graphical user interface terminology where it means a text insertion point indicator,

frequently represented by a blinking vertical bar. In this context, it may be used interchangeably with the word cursor, although

the latter term is often reserved for a mouse pointer."

Sorry, I just had to :shocked:

Btw, here's how LazyCat solved the same problem way back in 2005... works quite nicely !

http://www.autoitscript.com/forum/index.ph...ost&p=82447

Edited by Helge

Share this post


Link to post
Share on other sites

maybe...

#include <GuiConstants.au3>

AutoItSetOption('RunErrorsFatal', 0)
Opt("GUIOnEventMode", 1)

Global Const $s_Title = 'Input Box'
Global $input[8], $read_All
Local $input, $btnExit

$Main_Form = GUICreate($s_Title, 400, 100, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$btnTest = GUICtrlCreateButton("Not Standard", 70, 50, 125, 40)
GUICtrlSetOnEvent($btnTest, "_Notstandard")
$btnExit = GUICtrlCreateButton("Exit", 210, 50, 125, 40)
GUICtrlSetOnEvent($btnExit, "_exit")

Local $left = 70
For $x = 1 To 7
    $input[$x] = GUICtrlCreateInput("", $left, 10, 40, 30)
    GUICtrlSetLimit(-1, 2)
    GUICtrlSetFont(-1, 15, 900)
    GUICtrlSetColor(-1, 0x008866)
    $left += 45
Next
GUISetState()

GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")

$box = 1
While 1
    For $x = $box To 7
        If StringLen(GUICtrlRead($input[$x])) = 2 Then
            Send("{TAB}")
            $box += 1
        EndIf
        Sleep(200)
        
    Next

    Sleep(100)
WEnd

Func _exit()
    Exit
EndFunc   ;==>_exit

Func _Notstandard()
    ; $read_All = ($read_input1&$read_input2&$read_input3&$read_input4&$read_input5&$read_input6)
    MsgBox(0, "Read", $read_All)
EndFunc   ;==>_Notstandard

8)

Thanks Valuater,

This is exactly what I am looking for however how do I get it to read now?

Cheers,

Craig

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>

AutoItSetOption('RunErrorsFatal', 0)
Opt("GUIOnEventMode", 1)

Global Const $s_Title = 'Input Box'
Global $input[8], $read_All
Local $input, $btnExit

$Main_Form = GUICreate($s_Title, 400, 100, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$btnTest = GUICtrlCreateButton("Not Standard", 70, 50, 125, 40)
GUICtrlSetOnEvent($btnTest, "_Notstandard")
$btnExit = GUICtrlCreateButton("Exit", 210, 50, 125, 40)
GUICtrlSetOnEvent($btnExit, "_exit")

Local $left = 70
For $x = 1 To 7
    $input[$x] = GUICtrlCreateInput("", $left, 10, 40, 30)
    GUICtrlSetLimit(-1, 2)
    GUICtrlSetFont(-1, 15, 900)
    GUICtrlSetColor(-1, 0x008866)
    $left += 45
Next
GUISetState()

GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")

$box = 1
While 1
    For $x = $box To 7
        If StringLen(GUICtrlRead($input[$x])) = 2 Then
            Send("{TAB}")
            $box += 1
        EndIf
        Sleep(200)

    Next

    Sleep(100)
WEnd

Func _exit()
    Exit
EndFunc   ;==>_exit

Func _Notstandard()
    $read_All = ""
    For $x = 1 To 7
        $read_All &= GUICtrlRead($input[$x]) & @CRLF
    Next
    MsgBox(0, "Read", $read_All)
EndFunc   ;==>_Notstandard

8)


NEWHeader1.png

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  
Followers 0