找回密码
 加入
搜索
查看: 1465|回复: 5

[AU3基础] 虚拟屏幕键盘的问题[已解决]

[复制链接]
发表于 2020-7-1 21:52:43 | 显示全部楼层 |阅读模式
本帖最后由 rhci 于 2020-7-1 23:30 编辑

如题,开头一张图
简明扼要;
主要功能,点击左边区域的数字,出现在右边输入框中,点击配置文件生成写入指定路径中的文件。
可惜,思路正确,但是菜鸟一个,不会写关联代码,只能画个GUI了,哪位大神能帮忙完善下。

本帖子中包含更多资源

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

×
发表于 2020-7-1 23:05:24 | 显示全部楼层
本帖最后由 floor6ggg 于 2020-7-1 23:07 编辑

纯体力活……………………
49行 更改为:$Input=GUICtrlCreateInput("", 384, 112, 225, 83)

初步的部分代码如下,还需要自己调整和完善
While 1
        $nMsg = GUIGetMsg()
        $Data=GUICtrlRead($Input)
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

                Case $NUM9
                        GUICtrlSetData($Input,$Data &'9')
                Case $NUM8
                        GUICtrlSetData($Input,$Data &'8')
                ;类似的体力活..............
                Case $Button2;退格
                        GUICtrlSetData($Input,StringTrimRight($Data,1))
                Case $Button3;去除
                        GUICtrlSetData($Input,'')
                Case $Button1;
                        $INI = @ScriptDir & "\posid.ini"
                        IniWrite($INI, "字段", "关键字", $Data)

                Case $ook


        EndSwitch
WEnd

 楼主| 发表于 2020-7-1 23:30:20 | 显示全部楼层
嗯嗯,感谢,抱得大腿,已编译投入使用中,源码稍后公开。
发表于 2020-7-2 01:48:11 | 显示全部楼层
rhci 发表于 2020-7-1 23:34
源码来了。收费是对大神的尊重。
#NoTrayIcon
#PRE_UseX64=n
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=POSID.kxf
$POSID = GUICreate("POSID", 615, 437, 192, 124)
GUISetBkColor(0xABABAB)
Global $BtnNum[0xC], $Caption = ''
For $i = 1 To 0xC
        $Caption = 10 - $i
        If $i = 0xA Then $Caption = 'C'
        If $i = 0xB Then $Caption = 0
        If $i = 0xC Then $Caption = 'Back'
        $BtnNum[0xC - $i] = GUICtrlCreateButton($Caption, (48 + Mod($i - 1, 3) * 112), (48 + Floor(($i - 1) / 3) * 88), 81, 49)
        GUICtrlSetFont(-1, 16, 800, 0, "微软雅黑")
        GUICtrlSetColor(-1, 0x00FF00)
        GUICtrlSetCursor(-1, 0)
Next
$input = GUICtrlCreateInput("", 384, 96, 225, 83)
GUICtrlSetFont(-1, 42, 400, 0, "微软雅黑")
$ook = GUICtrlCreateLabel("请确认收银工号", 392, 64, 212, 20)
GUICtrlSetFont(-1, 12, 400, 0, "黑体")
$Button1 = GUICtrlCreateButton("配置文件生成", 408, 256, 169, 81)
GUICtrlSetFont(-1, 16, 800, 0, "微软雅黑")
GUICtrlSetColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $BtnNum[0xB] To $BtnNum[0]
                        GUICtrlSetData($input, StringIsDigit(GUICtrlRead($nMsg)) ? GUICtrlRead($input) & GUICtrlRead($nMsg) : ($nMsg  = $BtnNum[2] ? "" : StringTrimRight(GUICtrlRead($input), 1)))
                Case $Button1
                        IniWrite("路径", "项目", "关键字", GUICtrlRead($input))
                        MsgBox("64", "提醒", "配置文件已生成", 3)
        EndSwitch
WEnd

评分

参与人数 1金钱 +40 收起 理由
floor6ggg + 40 很给力! 大神出手!

查看全部评分

发表于 2020-7-2 07:51:44 | 显示全部楼层
本帖最后由 floor6ggg 于 2020-7-2 07:59 编辑

haijie1223大神,厉害!

想到了0-9写入button的数组可以简化代码,没有想到另外的按键可以通过0xA-0xc的方式写入……………………
34行的代码,绝!
真没有想到一个简单的体力活可以玩出那么多的花样,膜拜!佩服!
 楼主| 发表于 2020-7-2 16:16:06 | 显示全部楼层
牛P,我就删除源码了,采用大神的吧
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-25 18:23 , Processed in 0.087766 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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