本帖最后由 lynfr8 于 2009-6-7 13:06 编辑
思路:
1.正则获取所需字段,再进行数值大小判断筛选有效数据
2.返回有效数据到combo
3.读取combo所选数据,赋值到run运行程序
效果图:
#include <Array.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiComboBoxEx.au3>
$Form1 = GUICreate("正则判断", 321, 228, 192, 124)
$Edit1 = GUICtrlCreateEdit("", 16, 8, 289, 113)
GUICtrlSetData($Edit1, 'abc:2214556 (1234g)abc:15466 (11246)abc:1214646 (122135456)abc:214646 (212354)')
$Combo1 = GUICtrlCreateCombo("获取参数", 176, 168, 97, 25)
$Button1 = GUICtrlCreateButton("运行正则", 192, 136, 65, 25, 0)
$Button2 = GUICtrlCreateButton("运行参数", 191, 197, 65, 25, 0)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$a=GUICtrlRead($Edit1)
$b = stringRegExp($a,'.{3}:(\d{0,7})',3)
for $i = 0 to UBound($b) - 1
If $b[$i] <2000000 Then
GUICtrlSetData ($Combo1,$b[$i])
EndIf
Next
Case $Button2
$c=GUICtrlRead($Combo1)
run('a.exe abc:'&$c&' -q')
MsgBox('','','已经运行a.exe abc:'&$c&' -q')
EndSwitch
WEnd
|