关于控件名问题
在窗体中有一个控件,就例如totalcommander中的显示路径的框,当框中的数据改变后则把新的数据填入一个记事本,请问应该怎么写呢,我写了以下脚本,但是无法实现,还请大家指教:#include <ACN_String.au3>
AutoItSetOption("WinTitleMatchMode", 4)
While 1
$text = ControlGetText("classname=TTOTAL_CMD", "","TMyPanel9")
sleep (100)
$text2 = ControlGetText("classname=TTOTAL_CMD", "","TMyPanel9")
if WinExists("classname=Notepad","") Then
WinActivate("classname=Notepad","")
Else
Run("Notepad.exe", "")
EndIf
WinWaitActive("classname=Notepad", "")
if $text<>$text2 Then
SendX($text2&@CRLF,0)
EndIf
WEnd
[ 本帖最后由 jchang 于 2008-11-18 22:22 编辑 ] 按你的改了下,没测试.
#include <ACN_String.au3>
AutoItSetOption("WinTitleMatchMode", 4)
While 1
$text = ControlGetText("classname=TTOTAL_CMD", "","TMyPanel9")
if stringinstr(fileread('log.txt'), $text) = 0 and $text <> '' Then filewriteline('log.txt', $text)
sleep (100)
WEnd
多谢你的脚本,你的脚本对于路径名字不同的可以实现。我希望对于路径名字相同的也记录下来,例如首先是:D:\autoit3\,然后变为:D:\autoit3\Examples\,最后又变为:D:\autoit3\,我希望最后写入记事本的是以下三行:
D:\autoit3\
D:\autoit3\Examples\
D:\autoit3\
应如何实现呢? 已解决,多谢提醒
#include <ACN_String.au3>
AutoItSetOption("WinTitleMatchMode", 4)
While 1
$text = ControlGetText("classname=TTOTAL_CMD", "","TMyPanel9")
sleep(100)
$text1 = ControlGetText("classname=TTOTAL_CMD", "","TMyPanel9")
$result = StringCompare($text, $text1)
if $result<>0 Then
filewriteline('log.txt', $text1)
sleep (100)
EndIf
WEnd
页:
[1]