找回密码
 加入
搜索
查看: 1967|回复: 3

[系统综合] 从TXT循环读取信息并输入到指定窗口

[复制链接]
发表于 2011-10-24 16:47:34 | 显示全部楼层 |阅读模式
谁帮我改好,我给他100元钱,直接用网银打过来
这个软件功能,按ESC键退出,按END键发送数据到窗口输入框里,按F4隐藏,这些我都写好了,但是现在有个问题我一直解决不了,
      
现在我做测试的是这样的

我想把发送测试字符那里改为从文本文件 身份信息.txt

里读取的数据写入到输入框里
  
1.读取这个文本文档 身份信息.txt 里的数据要从第一行开始,一行一行读下去读到最后一行就返回第一行重头开始读,循环的,
2.文本文档里每一行数据,(文字和数字中都有一个空格),空格前的文字读取并发送到第一个框里,空格后的数字读取并发送到第二个框里)


这是源码:
#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=3.ico
#AutoIt3Wrapper_outfile=dhgk.exe
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=d:\autoit3\scite\koda\forms\鼎恒高科.kxf
$Form1 = GUICreate("鼎恒高科", 368, 128, 647, 515)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore")
$Input1 = GUICtrlCreateInput("", 40, 26, 289, 21)
GUICtrlSetOnEvent($Input1, "Input1Change")
$Input2 = GUICtrlCreateInput("", 40, 78, 289, 21)
GUICtrlSetOnEvent($Input2, "Input2Change")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Opt("TrayMenuMode",1)   ; 默认菜单项目
        TraySetState(2) ; 隐藏托盘图标
Global $Paused
HotKeySet("{ESC}", "Terminate");按ESC退出脚本
HotKeySet("{f4}", "TogglePause");按F4隐藏运行中脚本
HotKeySet("{End}", "captureEsc") ;按END传输数据到$Input1,$Input2
;;;; 这里是程序主体 ;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
    GUISetState(@SW_HIDE,@GUI_WinHandle);  隐藏产生事件的窗口
        WinWaitActive("鼎恒高科")
        
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func captureEsc()
        $hWnd=WinGetHandle( "鼎恒高科")
        WinActivate ("鼎恒高科","")
        ControlFocus ("鼎恒高科","","Edit1");设置输入焦点到指定窗口
        sleep(100)
                        Send("@@0009206055") ;发送字符串(测试)
                Sleep (300)
                Send("{TAB}")        
                                Send("@@0009206055") ;发送字符串(测试)
                Sleep (300)
                                Send("{TAB}")
                                BlockInput(0) ;释放
WinActivate ("迷你模式 - 快速通道","");这是传输到另一个软件窗口不用管
        ControlFocus ("迷你模式 - 快速通道","","TEdit1");设置输入焦点到指定窗口
        sleep(100)
                        Send("@@0009206055") ;发送字符串
                Sleep (300)
                Send("{TAB}")        
                                Send("@@0009206055") ;发送字符串
                                Sleep (1000)
                                Send("{Enter}")
EndFunc   ;==>_caozuo
Func _Exit() ;退出
        Exit 0
        EndFunc   ;==>_Exit

While 1
Sleep(100)
WEnd

Func Button1Click()

EndFunc
Func Button2Click()

EndFunc
Func Button3Click()

EndFunc
Func Button4Click()

EndFunc
Func Form1Close()

EndFunc
Func Form1Maximize()

EndFunc
Func Form1Minimize()

EndFunc
Func Form1Restore()

EndFunc
Func Input1Change()
dim $Input1
        
EndFunc
Func Input2Change()
        

EndFunc
发表于 2011-10-24 20:11:49 | 显示全部楼层
请楼主留下联系方式,我帮你搞定……
 楼主| 发表于 2011-10-24 20:21:22 | 显示全部楼层
电话:13035545858     QQ:350925419

评分

参与人数 1金钱 +1 收起 理由
lynfr8 + 1 如果问题解决了请及时屏蔽个人敏感信息

查看全部评分

发表于 2011-10-24 21:06:40 | 显示全部楼层
楼主图挂了,重新上图看看!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-20 22:45 , Processed in 0.082223 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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