|
楼主 |
发表于 2012-5-4 15:46:36
|
显示全部楼层
本帖最后由 yufei8051 于 2012-5-4 15:59 编辑
基本问题解决了,实验代码如下:
控制交易软件的部分:
If StringCompare($mmbz,"买进") Then
Sleep(30)
Send("{F2}");先选择卖出以清除可能的乱码
Sleep(30)
Send("{F1}");等待30毫秒后选择买入
Sleep(50)
ControlSetText($BB, "", 1032, $gpdm);等待50毫秒后输入代码
Sleep(50)
ControlCommand($BB,"",1032,send("{Enter}"));输入代码后回车
Sleep(400)
ControlCommand($BB,"",1033,send("{Enter}"));默认买入价格回车
Sleep(400)
ControlCommand($BB,"",1006,send("{Enter}"));默认买入数量回车
Sleep(400)
ControlCommand($BB,"",6,send("{Enter}"));买入确认
Sleep(400)
ControlCommand($BB,"",2,send("{Enter}"));你的委托已发送确定
EndIf
If StringCompare($mmbz,"卖出") Then
Sleep(30)
Send("{F1}");先选择买进以清除可能的乱码
Sleep(30)
Send("{F2}");等待30毫秒后选择卖出
Sleep(50)
ControlSetText($BB, "", 1032, $gpdm);等待50毫秒后输入代码
Sleep(50)
ControlCommand($BB,"",1032,send("{Enter}"));输入代码后回车
Sleep(400)
ControlCommand($BB,"",1033,send("{Enter}"));默认买入价格回车
Sleep(400)
ControlCommand($BB,"",1006,send("{Enter}"));默认买入数量回车
Sleep(400)
ControlCommand($BB,"",6,send("{Enter}"));买入确认
Sleep(400)
ControlCommand($BB,"",2,send("{Enter}"));你的委托已发送确定
EndIf
判断有否预警及取得预警股票的代码和买卖标志部分:
$kk = ControlGetText("预警 - (运行)", "","")
$yjsl=ControlListView("预警 - (运行)", "",1702,"GetItemCount");是否预警
$gpdm = StringLeft(ControlListView("预警 - (运行)", "",1702,"GetText",0,0),6);取得股票代码
$mmbz = StringLeft(ControlListView("预警 - (运行)", "",1702,"GetText",0,1),2);取得买卖标志
010 If $yjsl>0 then
If StringCompare($mmbz,"买进")=0 Then
MsgBox(0, "测试", $gpdm&"买进")
EndIf
If StringCompare($mmbz,"卖出")=0 Then
MsgBox(0, "测试", $gpdm&"卖出")
EndIf
050 EndIf
MsgBox(0, "测试", "还没预警等着他")
新问题又来了,我想让程序开始后就判断第010行的 ($yjsl>0) 是否大于0,若大于0则执行下面的语句到050行,若不大于0就一直在那里等着,该怎么写? |
|