找回密码
 加入
搜索
查看: 5472|回复: 16

如何自动跳到下一个输入框

[复制链接]
发表于 2008-11-18 00:56:53 | 显示全部楼层 |阅读模式
怎么让我再输入完第一个坐标以后自动跳到下一个输入框呢

[ 本帖最后由 121044246 于 2008-11-19 11:41 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2008-11-18 12:29:38 | 显示全部楼层
if Stringlenth(Guigetdata($input1)) =3 then
  Guisetfocus($input2)
endif
 楼主| 发表于 2008-11-18 13:35:27 | 显示全部楼层
原帖由 netegg 于 2008-11-18 12:29 发表
if Stringlenth(Guigetdata($input1)) =3 then
  Guisetfocus($input2)
endif

我按照你的代码但是 Stringlenth,Guisetfocus,Guigetdata都不能识别

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2008-11-18 14:02:34 | 显示全部楼层
原码放上来,我帮你测一下了。
 楼主| 发表于 2008-11-18 14:54:23 | 显示全部楼层
#NoTrayIcon
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
...............................................................................代码长了使用附件
发表于 2008-11-18 14:58:00 | 显示全部楼层
If StringLen(GUICtrlRead($Input1)) = 3 Then
                                GUICtrlSetState($Input2, $GUI_FOCUS)
                        ElseIf StringLen(GUICtrlRead($Input2)) = 3 Then
                                GUICtrlSetState($input3, $GUI_FOCUS)
                        ElseIf StringLen(GUICtrlRead($input3)) = 3 Then
                                GUICtrlSetState($Input1, $GUI_FOCUS)
                        EndIf
发表于 2008-11-18 15:11:30 | 显示全部楼层
不好意思, 函数名记错了
 楼主| 发表于 2008-11-18 17:19:11 | 显示全部楼层
原帖由 jhwl 于 2008-11-18 14:58 发表
If StringLen(GUICtrlRead($Input1)) = 3 Then
                                GUICtrlSetState($Input2, $GUI_FOCUS)
                        ElseIf StringLen(GUICtrlRead($Input2)) = 3 Then
                                GUICtrlSetState($input3, $GUI_FOCUS)
                        ElseIf StringLen ...


这个在第一个窗口是可以了,但是跳到第二个输入框就只能输入一个字符
发表于 2008-11-18 18:11:31 | 显示全部楼层
做个自定义函数每次都调用就行了
发表于 2008-11-18 18:13:32 | 显示全部楼层
而且,这么做麻烦了点,你可以直接给定guisetdata($concorlID,"***")
发表于 2008-11-18 18:16:37 | 显示全部楼层
或者在前面那段判断里面改一下
select
  case $stringlen=3
  Case $stringlen<3
endselect
发表于 2008-11-18 18:33:00 | 显示全部楼层
switch "3"
   case Stringlen(GuiGetData($input1))
        GUIGetFocus($input2)
     case Stringlen(GuiGetData($input1)) And Stringlen(GuiGetData($input2))
        GUIGetFocus($input3)
endswitch
发表于 2008-11-19 09:25:36 | 显示全部楼层

#NoTrayIcon
#EndRegion;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


#Region ### START Koda GUI section ### Form=d:\backup\my documents\脚本\梦幻工具\mibao.kxf
$Form1_1 = GUICreate("密保卡", 180, 106, 285, 175)
$Input1 = GUICtrlCreateInput("", 20, 20, 40, 21)
$Input2 = GUICtrlCreateInput("", 70, 20, 40, 21)
$Input3 = GUICtrlCreateInput("", 120, 20, 40, 21)
$ok = GUICtrlCreateButton("获取", 58, 50, 57, 20, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
HotKeySet("{F9}", "yincang")

Func yincang();隐藏人物和摊位
        Send("!h")
EndFunc   ;==>yincang


While 1
        Select
                Case StringLen(GUICtrlRead($Input1)) = 2 And GUICtrlRead($Input2) = ''
                        GUICtrlSetState($Input2, $GUI_FOCUS)
                Case StringLen(GUICtrlRead($Input2)) = 2 And GUICtrlRead($Input3) = ''
                        GUICtrlSetState($Input3, $GUI_FOCUS)
                Case StringLen(GUICtrlRead($Input3)) = 2
                        GUICtrlSetState($ok, $GUI_FOCUS)
        EndSelect
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Input1
                        $read1 = GUICtrlRead($Input1)
                        Select
                                ;========================Input1=================================
                                Case $read1 = "a1"
                                        $xy1 = ("166")
                                Case $read1 = "a2"
                                        $xy1 = ("40")
                                Case $read1 = "a3"
                                        $xy1 = ("75")
                                Case $read1 = "a4"
                                        $xy1 = ("799")
                                Case $read1 = "a5"
                                        $xy1 = ("64")
                                Case $read1 = "a6"
                                        $xy1 = ("897")
                                Case $read1 = "b1"
                                        $xy1 = ("2")
                                Case $read1 = "b2"
                                        $xy1 = ("726")
                                Case $read1 = "b3"
                                        $xy1 = ("6")
                                Case $read1 = "b4"
                                        $xy1 = ("45")
                                Case $read1 = "b5"
                                        $xy1 = ("76")
                                Case $read1 = "b6"
                                        $xy1 = ("871")
                                Case $read1 = "c1"
                                        $xy1 = ("487")
                                Case $read1 = "c2"
                                        $xy1 = ("7")
                                Case $read1 = "c3"
                                        $xy1 = ("258")
                                Case $read1 = "c4"
                                        $xy1 = ("19")
                                Case $read1 = "c5"
                                        $xy1 = ("490")
                                Case $read1 = "c6"
                                        $xy1 = ("339")
                                Case $read1 = "d1"
                                        $xy1 = ("973")
                                Case $read1 = "d2"
                                        $xy1 = ("553")
                                Case $read1 = "d3"
                                        $xy1 = ("21")
                                Case $read1 = "d4"
                                        $xy1 = ("97")
                                Case $read1 = "d5"
                                        $xy1 = ("394")
                                Case $read1 = "d6"
                                        $xy1 = ("33")
                                Case $read1 = "e1"
                                        $xy1 = ("963")
                                Case $read1 = "e2"
                                        $xy1 = ("26")
                                Case $read1 = "e3"
                                        $xy1 = ("679")
                                Case $read1 = "e4"
                                        $xy1 = ("734")
                                Case $read1 = "e5"
                                        $xy1 = ("236")
                                Case $read1 = "e6"
                                        $xy1 = ("505")
                                Case Else
                                        MsgBox(0, "出错啦", "输入了错误的坐标")
                                        GUICtrlSetData($Input1, '', '')
                                        GUICtrlSetState($Input1, $GUI_FOCUS)
                        EndSelect
                        ;========================Input2=================================
                Case $Input2
                        $read2 = GUICtrlRead($Input2)
                        Select
                                Case $read2 = "a1"
                                        $xy2 = ("166")
                                Case $read2 = "a2"
                                        $xy2 = ("40")
                                Case $read2 = "a3"
                                        $xy2 = ("75")
                                Case $read2 = "a4"
                                        $xy2 = ("799")
                                Case $read2 = "a5"
                                        $xy2 = ("64")
                                Case $read2 = "a6"
                                        $xy2 = ("897")
                                Case $read2 = "b1"
                                        $xy2 = ("2")
                                Case $read2 = "b2"
                                        $xy2 = ("726")
                                Case $read2 = "b3"
                                        $xy2 = ("6")
                                Case $read2 = "b4"
                                        $xy2 = ("45")
                                Case $read2 = "b5"
                                        $xy2 = ("76")
                                Case $read2 = "b6"
                                        $xy2 = ("871")
                                Case $read2 = "c1"
                                        $xy2 = ("487")
                                Case $read2 = "c2"
                                        $xy2 = ("7")
                                Case $read2 = "c3"
                                        $xy2 = ("258")
                                Case $read2 = "c4"
                                        $xy2 = ("19")
                                Case $read2 = "c5"
                                        $xy2 = ("490")
                                Case $read2 = "c6"
                                        $xy2 = ("339")
                                Case $read2 = "d1"
                                        $xy2 = ("973")
                                Case $read2 = "d2"
                                        $xy2 = ("553")
                                Case $read2 = "d3"
                                        $xy2 = ("21")
                                Case $read2 = "d4"
                                        $xy2 = ("97")
                                Case $read2 = "d5"
                                        $xy2 = ("394")
                                Case $read2 = "d6"
                                        $xy2 = ("33")
                                Case $read2 = "e1"
                                        $xy2 = ("963")
                                Case $read2 = "e2"
                                        $xy2 = ("26")
                                Case $read2 = "e3"
                                        $xy2 = ("679")
                                Case $read2 = "e4"
                                        $xy2 = ("734")
                                Case $read2 = "e5"
                                        $xy2 = ("236")
                                Case $read2 = "e6"
                                        $xy2 = ("505")
                                Case Else
                                        MsgBox(0, "出错啦", "输入了错误的坐标")
                                        GUICtrlSetData($Input2, '', '')
                                        GUICtrlSetState($Input2, $GUI_FOCUS)
                        EndSelect
                        ;========================Input3=================================
                Case $Input3
                        $read3 = GUICtrlRead($Input3)
                        Select
                                Case $read3 = "a1"
                                        $xy3 = ("166")
                                Case $read3 = "a2"
                                        $xy3 = ("40")
                                Case $read3 = "a3"
                                        $xy3 = ("75")
                                Case $read3 = "a4"
                                        $xy3 = ("799")
                                Case $read3 = "a5"
                                        $xy3 = ("64")
                                Case $read3 = "a6"
                                        $xy3 = ("897")
                                Case $read3 = "b1"
                                        $xy3 = ("2")
                                Case $read3 = "b2"
                                        $xy3 = ("726")
                                Case $read3 = "b3"
                                        $xy3 = ("6")
                                Case $read3 = "b4"
                                        $xy3 = ("45")
                                Case $read3 = "b5"
                                        $xy3 = ("76")
                                Case $read3 = "b6"
                                        $xy3 = ("871")
                                Case $read3 = "c1"
                                        $xy3 = ("487")
                                Case $read3 = "c2"
                                        $xy3 = ("7")
                                Case $read3 = "c3"
                                        $xy3 = ("258")
                                Case $read3 = "c4"
                                        $xy3 = ("19")
                                Case $read3 = "c5"
                                        $xy3 = ("490")
                                Case $read3 = "c6"
                                        $xy3 = ("339")
                                Case $read3 = "d1"
                                        $xy3 = ("973")
                                Case $read3 = "d2"
                                        $xy3 = ("553")
                                Case $read3 = "d3"
                                        $xy3 = ("21")
                                Case $read3 = "d4"
                                        $xy3 = ("97")
                                Case $read3 = "d5"
                                        $xy3 = ("394")
                                Case $read3 = "d6"
                                        $xy3 = ("33")
                                Case $read3 = "e1"
                                        $xy3 = ("963")
                                Case $read3 = "e2"
                                        $xy3 = ("26")
                                Case $read3 = "e3"
                                        $xy3 = ("679")
                                Case $read3 = "e4"
                                        $xy3 = ("734")
                                Case $read3 = "e5"
                                        $xy3 = ("236")
                                Case $read3 = "e6"
                                        $xy3 = ("505")
                                Case Else
                                        MsgBox(0, "出错啦", "输入了错误的坐标")
                                        GUICtrlSetData($Input3, '', '')
                                        GUICtrlSetState($Input3, $GUI_FOCUS)
                        EndSelect
                Case $ok
                        GUICtrlCreateLabel("", 55, 75, 80, 40)
                        $mima = GUICtrlCreateLabel($xy1 & ' ' &$xy2 & ' ' & $xy3, 30, 75, 130, 40)
                        GUICtrlSetFont($mima, 14)
                        $zuobiao = GUICtrlRead($mima)
                        $flag = MsgBox(1, "特别提示", "按确定将自动输入密码" & @LF & "按取消把密码保存到剪切板中可以按CTRL+V查看")
                        If ProcessExists("my.exe") And $flag = 1 Then
                                WinActivate("梦幻西游ONLINE")
                                Sleep(1000)
                                Send($zuobiao)
                                Sleep(100)
                                Send("{ENTER}")
                        ElseIf $flag = 2 Then
                                ClipPut($zuobiao)
                        Else
                                MsgBox(0, "提示", "你没有运行梦幻西游", 3)
                        EndIf
        EndSwitch
WEnd


[ 本帖最后由 liongodmien 于 2008-11-19 10:28 编辑 ]

评分

参与人数 1金钱 +5 收起 理由
jhwl + 5 代码优化一下,太长了

查看全部评分

 楼主| 发表于 2008-11-19 11:45:01 | 显示全部楼层
上面的代码是OK了 。就是第一次获取密码以后,第二次要在获取就没办法了,因为他为自动移动到获取按钮,无法修改前面的坐标了 。。把最后那个判断的去掉 就OK了。
发表于 2008-11-19 11:50:07 | 显示全部楼层

#include <GuiConstants.au3>

Global Const $WM_COMMAND = 0x0111
Global Const $EN_CHANGE = 0x300

Global $Input

_Main()

Func _Main()
    Local $GUI, $ExitButton, $x = 20
    $GUI = GUICreate("输入框自动跳转演示", 300, 150)

    For $i = 0 To 4
        If IsArray($Input) Then
            ReDim $Input[UBound($Input) + 1]
        Else
            Dim $Input[1]
        EndIf
        $Input[UBound($Input) - 1] = GUICtrlCreateInput("", $x, 15, 50, 20)
       
        $x += 50
    Next

    $ExitButton = GUICtrlCreateButton("退出", 110, 105, 60, 20)
    GUICtrlSetState(-1, $GUI_DEFBUTTON)

    ControlFocus($GUI, "", $ExitButton)

    GUISetState()
    GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")

    While 1
        Switch GUIGetMsg()
            Case $ExitButton, $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
EndFunc   ;==>_Main

Func _AutoInput($hControl)
 
 If StringLen(GUICtrlRead($hControl))=3 Then GUICtrlSetState($hControl+1, $GUI_FOCUS)
   

EndFunc   ;==>_AutoInput




Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    Local $nNotifyCode = BitShift($wParam, 16) 
    Local $nID = BitAND($wParam, 0xFFFF) 
    Local $hCtrl = $lParam
    
    For $i = 0 To UBound($Input) - 1
        Switch $nID
            Case $Input[$i]
                Switch $nNotifyCode
                    Case $EN_CHANGE
                        _AutoInput($nID)
 EndSwitch
                ExitLoop
        EndSwitch
    Next
  
    Return $GUI_RUNDEFMSG
EndFunc   ;==>MY_WM_COMMAND




您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-28 11:17 , Processed in 0.080003 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表