yaojie8858 发表于 2011-10-24 16:47:34

从TXT循环读取信息并输入到指定窗口

谁帮我改好,我给他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

kood481748 发表于 2011-10-24 20:11:49

请楼主留下联系方式,我帮你搞定……

yaojie8858 发表于 2011-10-24 20:21:22

电话:13035545858   QQ:350925419

xms77 发表于 2011-10-24 21:06:40

楼主图挂了,重新上图看看!
页: [1]
查看完整版本: 从TXT循环读取信息并输入到指定窗口