回复 10# WSZYJ
无聊写了下
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include'FILE.AU3'
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 253, 76, 192, 124,-1,$WS_EX_ACCEPTFILES)
$Label1 = GUICtrlCreateLabel("请输入股票名称:", 0, 24, 91, 17)
$Input1 = GUICtrlCreateInput("", 0, 0, 177, 21)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)
GUICtrlSetTip(-1,'输入路径或者拖放文件!')
$Input2 = GUICtrlCreateInput("", 88, 24, 89, 21)
GUICtrlSetTip(-1,'输入后直接回车查询!')
$Button1 = GUICtrlCreateButton("OK", 184, 0, 65, 73,1)
$Label2 = GUICtrlCreateLabel("对应股票代码:", 0, 48, 79, 17)
$Label3 = GUICtrlCreateLabel("", 88, 48, 92, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
If GUICtrlRead($Input1)='' Then
MsgBox(16,'错误!','未选择文件!!',3)
elseIf GUICtrlRead($Input2)='' Then
MsgBox(16,'错误!','查询内容不能为空!',3)
Else
GUICtrlSetData($Label3,_find())
EndIf
EndSwitch
WEnd
Func _find()
For $i=1 To _FileCountLines(GUICtrlRead($Input1))
$temp=StringSplit(FileReadLine(GUICtrlRead($Input1),$i),' ',1)
If GUICtrlRead($Input2)=$temp[2] Then
Return $temp[1]
EndIf
Next
Return('木有找到!')
EndFunc
代码很垃圾,将就看下吧,俺的水平也只能这样了~~ |