- 精华
- 0
- 在线时间
- 83 小时
- UID
- 5903
- 积分
- 748
- 帖子
- 95
- 阅读权限
- 60
- 注册时间
- 2009-11-14
- 最后登录
- 2010-11-25
- 精华
- 0
- UID
- 5903
- 积分
- 748
- 帖子
- 95
- 主题
- 11
- 阅读权限
- 60
- 注册时间
- 2009-11-14
- 最后登录
- 2010-11-25
|
开盘时间和锁定系统,关闭TB功能注释掉了
-
- #Include <date.au3>
- Dim $result,$list[5][5],$pid1,$tmp1,$path,$TBloginname,$TBloginpassword,$WorkNum,$WorkTabID,$ParamsCount
- ;参数传递
- $paramscount = $CmdLine[0] ;取参数个数
- If $ParamsCount>1 Then
- $TBloginname=$CmdLine[1]
- $TBloginpassword=$CmdLine[2]
- Else
- MsgBox(1,"提醒","请附加参数")
- Exit
- EndIf
- If $ParamsCount>2 Then
- $path=$CmdLine[3]
- Else
- $path="d:\Program Files\TradeBlazer\"
- EndIf
- If $ParamsCount>3 Then
- $WorkTabID=$CmdLine[4]
- EndIf
- If $ParamsCount>4 Then
- $WorkNum=$CmdLine[5]
- Else
- $WorkNum=5
- EndIf
-
- ;循环开始
- While 1
- If ProcessExists("TradeBlazer.exe") And WinExists("交易开拓者(超强版") = 0 Then
- Sleep(3000)
- EndIf
- If WinExists("交易开拓者(超强版") = 0 Then; And ((@HOUR=8 And @MIN>=56) Or @HOUR>=9) And @HOUR <=22 Then
- ;TB自动登陆设置*****开始*****,这部分实行TB自动登陆功能,如果TB有自动登陆功能的话,就简单多了(目前TB不能自动登陆)
- ;关闭系统中不正常的tb进程----START---
- $list=ProcessList("TradeBlazer.exe")
- If $list[0][0]<>0 Then
- $pid1=$list[1][1]
- If ProcessExists("TradeBlazer.exe") And WinExists("交易开拓者(超强版") = 0 Then
- If $list[0][0]>1 Then
- for $i = 2 to $list[0][0]
- If $pid1<>$list[$i][1] Then
- ProcessClose($list[$i][1])
- EndIf
- Sleep(1000)
- next
- EndIf
- EndIf
- EndIf
- ;关闭系统中不正常的tb进程----END----
-
- ;第一次运行TB,先关闭再重新运行,解决有些电脑第一次登录不能聚焦到登陆控件导致无法自动登录的问题--START---
- Run($path&"TradeBlazer.exe",$path)
- WinWaitActive("欢迎登录交易开拓者(超强版)","",10)
- $list=ProcessList("TradeBlazer.exe")
- If $list[0][0]>1 Then
- for $i = 1 to $list[0][0]
- If $pid1<>$list[$i][1] Then
- ProcessClose($list[$i][1])
- EndIf
- Sleep(1000)
- next
- ElseIf $list[0][0]=1 Then
- ProcessClose($list[1][1])
- Sleep(1000)
- EndIf
- ;第一次运行TB,先关闭再重新运行,解决有些电脑第一次登录不能聚焦到登陆控件导致无法自动登录的问题--END----
-
- Run($path&"TradeBlazer.exe",$path)
- WinWaitActive("欢迎登录交易开拓者(超强版)","",10)
- While WinExists("TradeBlazer","初始化失败")
- WinActivate("TradeBlazer","初始化失败")
- WinClose("TradeBlazer","初始化失败")
- Sleep(1000)
- $list=ProcessList("TradeBlazer.exe")
- If $list[0][0]=1 Then
- ProcessClose($list[1][1])
- Sleep(1000)
- ElseIf $list[0][0]>1 Then
- for $i = 1 to $list[0][0]
- If $pid1<>$list[$i][1] Then
- ProcessClose($list[$i][1])
- EndIf
- Sleep(1000)
- next
- EndIf
- Run($path&"TradeBlazer.exe",$path)
- WinWaitActive("欢迎登录交易开拓者(超强版)","",10)
- WEnd
- WinActivate("欢迎登录交易开拓者(超强版)")
- ControlFocus("欢迎登录交易开拓者(超强版)","","Edit1")
- ControlSetText("欢迎登录交易开拓者(超强版)","","Edit1",$TBloginname)
- ControlFocus("欢迎登录交易开拓者(超强版)","","Edit2")
- ControlSetText("欢迎登录交易开拓者(超强版)","","Edit2",$TBloginpassword)
- ControlFocus("欢迎登录交易开拓者(超强版)","","Button2")
- ControlClick("欢迎登录交易开拓者(超强版)","","Button2")
- WinWaitActive("交易开拓者(超强版) - ","",10)
- Sleep(5000)
- WinActivate("交易开拓者(超强版) - ")
- If WinExists("系统消息") Then
- WinActivate("系统消息")
- WinClose("系统消息")
- Sleep(1000)
- EndIf
- ;TB自动登陆设置*****结束*****
-
- For $i=1 To $WorkNum
- $tmp1 = 15 + 60 * ($i - 1)
- WinActivate("交易开拓者(超强版) - ")
- ControlClick("交易开拓者(超强版) - ","",$WorkTabID,"left",1,$tmp1,6)
- Sleep(3000)
- WinMenuSelectItem("交易开拓者(超强版) - ","","文件(&F)", "启动所有自动交易");启动工作区内所有自动交易
- Sleep(1000)
- Next
- Sleep(5000)
- ; $result=DllCall("user32.dll","int","LockWorkStation");开启TB自动交易后,锁定电脑系统
- ;ElseIf $result<1 Then
- ; $result=DllCall("user32.dll","int","LockWorkStation");非交易时间启动电脑后,立即锁定电脑系统
- EndIf
- ;If WinExists("交易开拓者") And @HOUR>22 Then ;非交易时间关闭TB
- ; WinActivate("交易开拓者")
- ; Sleep(1000)
- ; WinClose("交易开拓者")
- ;EndIf
- Sleep(1000*30)
- WEnd
- ;循环结束
复制代码
[ 本帖最后由 女儿是期神 于 2009-11-20 08:56 编辑 ] |
|