您现在的位置:好股网 >> 股票资讯 >> 股票知识
股票资讯分类导航
股票入门 股票知识 炒股经验 股市实战
精品股票资讯
更多>>
本文好评率100%

飞狐预警自动下单(原型,需要的自己改吧)

出处:本站整理时间:2011-06-09 08:15:00人气:
Tags:

放假三天,闲来无事,编一个热键启动飞狐交易师和交易软件的小程序。编完了,想再加上预警后自动下单功能,就改了改。程序源码粗糙,望见谅。
刚拿AUTOIT V3编软件,几乎每个问题、每个函数都要网上搜索很久。很感谢网友的帖子,学了不少。有需要的复制源码后自己改改,添加功能吧。

#include <Array.au3>
$g_szVersion = "monitoringfh"
If WinExists($g_szVersion) Then Exit ;防止程序重复运行
AutoItWinSetTitle($g_szVersion)
Opt("WinTitleMatchMode", 4)
HotKeySet("{ESC}", "Terminate") ;退出程序
HotKeySet("^{F1}", "ShowMessageCtrlF1") ;Ctrl+F1启动飞狐交易师,打开预警设置和预警弹窗,并重新启动预警
HotKeySet("^{F2}", "ShowMessageCtrlF2") ;Ctrl+F2启动股票交易软件并初始化
HotKeySet("^{F5}", "ShowMessageCtrlF5") ;Ctrl+F5开始自动监视预警并自动发出委托交易
HotKeySet("^{F6}", "ShowMessageCtrlF6") ;Ctrl+F6中止监控和下单功能

Global $monclip=""
Global $i=0
Global $jgxxh[9999]
Global $jgxxha[9999]
Global $jgxxhb[9999]
Global $jgxxhc1[9999]
Global $jgxxhc2[9999]
Global $jgxxhc3[9999]
Global $jgxxhc4[9999]
Global $jgxxhc5[9999]
Global $jgxxhc6[9999]
Global $jgxxhc7[9999]
Global $jgxxhc8[9999]
Global $jgxxhc9[9999]
Global $monalert[9999]
Global $jgxxhcnum=0
Global $monitoring=False
Global $CtrlF1test=False
Global $CtrlF2test=False
Global $foxtraderpath=""
Global $foxtradername="FoxTrader.exe"
Global $xiadanpath=""
Global $xiadanname="xiadan.exe"
Global $gpjcrjbcz=""
Global $hqjyrjbcz=""
Global $foxtradernametemp=""
Global $xiadannametemp=""
Global $wtzdzh=""
Global $wtmm=""
Global $wttxmm=""
Global $wtmm=""
Global $wtmmenc=""
Global $wttxmm=""
Global $wttxmmenc=""
Global $gZFs=1
Global $mahour=""
Global $mamin=""
Global $masec=""
Global $maday=""
Global $mamon=""
Global $yjzsfirst=""
Global $yjxzsfirst=""
Global $yjzssec=""
Global $yjxzssec=""
Global $monsleep=0
Global $yjzs=""
Global $yjzsa=""
Global $yjzsb=""
Global $yjzsc=""
Global $yjzsd=""
Global $yjzse=""
Global $yjzsf=""

$setfile=FileOpen("setfile.ini",0)
if $setfile=-1 Then
MsgBox(0,"错误","飞狐预警自动下单程序所在目录下没有配置文件:setfile.ini"&@CR&@LF&@CR&@LF&"按确定后,程序将询问相关信息后创建并保存此文件。")
Inputini()
;Run("notepad.exe setfile.ini")
Else
$foxtraderpath=FileReadLine("setfile.ini",1)
$foxtradername=FileReadLine("setfile.ini",2)
$xiadanpath=FileReadLine("setfile.ini",3)
$xiadanname=FileReadLine("setfile.ini",4)
$wtzdzh=FileReadLine("setfile.ini",5)
$wtmmenc=FileReadLine("setfile.ini",6)
$wtmm = _StringEncryptW(0,$wtmmenc,"CA3F454E85F63DDC2698344289FDEEDDAA294BB",1)
$wttxmmenc=FileReadLine("setfile.ini",7)
$wttxmm = _StringEncryptW(0,$wttxmmenc,"CA3F454E85F63DDC2698344289FDEEDDAA294BB",1)
checkini()
EndIf


Func Inputini()
while Not FileExists($foxtraderpath&"\stkblock")
$foxtraderpath=InputBox("请输入相关信息","飞狐交易师路径")
If StringRight($foxtraderpath,1)="\" Then
$foxtraderpath=StringMid($foxtraderpath,1,StringLen($foxtraderpath)-1)
EndIf
WEnd
while Not FileExists($foxtraderpath&"\"&$foxtradername)
$foxtradernametemp=""
while $foxtradernametemp=""
$foxtradernametemp=InputBox("请输入相关信息","飞狐交易师文件名")
WEnd
$foxtradername=$foxtradernametemp
if StringRight($foxtradername,4)=".exe" Then
Else
$foxtradername=$foxtradername&".exe"
EndIf
WEnd
While Not FileExists($xiadanpath&"\xiadan.ini")
$xiadanpath=InputBox("请输入相关信息","网上委托交易软件路径")
If StringRight($xiadanpath,1)="\" Then
$xiadanpath=StringMid($xiadanpath,1,StringLen($xiadanpath)-1)
EndIf
WEnd
While Not FileExists($xiadanpath&"\"&$xiadanname)
$xiadannametemp=""
while $xiadannametemp=""
$xiadannametemp=InputBox("请输入相关信息","网上委托交易软件名")
WEnd
$xiadanname=$xiadannametemp
if StringRight($xiadanname,4)=".exe" Then
Else
$xiadanname=$xiadanname&".exe"
EndIf
WEnd
$wtzdzh=InputBox("请输入相关信息","请输入交易软件缺省设置"&@CR&@LF&"账号类型对应的账号:","","",289,132)
while $wtzdzh=""
$wtzdzh=InputBox("请输入相关信息","请输入交易软件缺省设置"&@CR&@LF&"账号类型对应的账号:","","",289,132)
WEnd
$wtmm=InputBox("请输入相关信息","交易密码:"&@CR&@LF&"(此处使用MD5加密后存储)","","*",289,132)
while $wtmm=""
$wtmm=InputBox("请输入相关信息","交易密码:"&@CR&@LF&"(此处使用MD5加密后存储)","","*",289,132)
WEnd
$wtmmenc = _StringEncryptW(1,$wtmm,"CA3F454E85F63DDC2698344289FDEEDDAA294BB",1)
$wttxmm=InputBox("请输入相关信息","通信密码:"&@CR&@LF&"(此处使用MD5加密后存储)","","*",289,132)
while $wttxmm=""
$wttxmm=InputBox("请输入相关信息","通信密码:"&@CR&@LF&"(此处使用MD5加密后存储)","","*",289,132)
WEnd
$wttxmmenc = _StringEncryptW(1,$wttxmm,"CA3F454E85F63DDC2698344289FDEEDDAA294BB",1)
;如果账号和密码要更改,请将飞狐预警自动下单程序所在目录下的配置文件 setfile.ini 删除(或者将其中的飞狐软件名、网上委托软件名更改一下),让程序提示输入各种信息。这里就不做的太复杂了。

$setfile=FileOpen("setfile.ini",10)
$writetext=$foxtraderpath&@CR&@LF&$foxtradername&@CR&@LF&$xiadanpath&@CR&@LF&$xiadanname&@CR&@LF&$wtzdzh&@CR&@LF&$wtmmenc&@CR&@LF&$wttxmmenc&@CR&@LF
Sleep(500)
FileWrite("setfile.ini",$writetext)
sleep(1000)
FileClose($setfile)
Sleep(500)
EndFunc

Func checkini()
if $foxtradername="" Then
$foxtradername="FoxTrader.exe"
EndIf
If Not FileExists($foxtraderpath&"\"&$foxtradername) Then
$gpjcrjbcz="在指定目录中没有发现飞狐交易师软件"&@CR&@LF&$foxtraderpath&"\"&$foxtradername
EndIf
if $xiadanname="" Then
$xiadanname="xiadan.exe"
EndIf

If Not FileExists($xiadanpath&"\"&$xiadanname) Then
$hqjyrjbcz="在指定目录中没有发现网上委托交易软件"&@CR&@LF&$xiadanpath&"\"&$xiadanname
EndIf
If $gpjcrjbcz&$hqjyrjbcz="" Then
ElseIf $gpjcrjbcz="" Then
ToolTip($hqjyrjbcz,0,0,"警告!",3,1)
sleep(5000)
Tooltip("")
Inputini()
Else
ToolTip($gpjcrjbcz&@CR&@LF&$hqjyrjbcz,0,0,"警告!",3,1)
sleep(5000)
Tooltip("")
Inputini()
EndIf

EndFunc


;;;; 这里是程序主体 ;;;;
While 1
if $monitoring=True Then
Monitoringfunc()
Else
Sleep(200)
EndIf
WEnd

Func Terminate()
Exit 0
EndFunc

Func ShowMessageCtrlF5()
if $CtrlF1test=False Then
ShowMessageCtrlF1()
EndIf
If $CtrlF2test=False Then
ShowMessageCtrlF2()
EndIf
$monitoring=True
tooltip("Ctrl+F5开始自动监视预警并自动发出委托交易",0,0,"",1)
sleep(3000)
tooltip("")
EndFunc;Ctrl+F5开始自动监视预警并自动发出委托交易

Func ShowMessageCtrlF6()
$monitoring=False
SplashOff()
tooltip("Ctrl+F6中止监控和下单功能",0,0,"",1)
sleep(3000)
tooltip("")
EndFunc ;Ctrl+F6中止监控和下单功能

Func ShowMessageCtrlF1()
$CtrlF1test=False
tooltip("Ctrl+F1启动飞狐交易师,打开预警设置和预警弹窗,并重新启动预警",0,0,"",1)
sleep(1000)
tooltip("")
if not ProcessExists($foxtradername) Then
RUN ($foxtraderpath&"\"&$foxtradername)
SLEEP(5000)
send("{SPACE}")
SLEEP(800)
WinActivate("飞狐交易师 -")
send("{SPACE}")
SLEEP(800)
EndIf
if ProcessExists($foxtradername) Then
SLEEP(3000)
WinActivate("飞狐交易师 -")
SLEEP(800)
send("{SPACE}")
SLEEP(800)
send("!y")
SLEEP(10000)
send("{SPACE}")
SLEEP(800)

WinActivate("飞狐交易师 -")
send("{SPACE}")
SLEEP(800)
SLEEP(500)
send("!y")
SLEEP(800)
send("{SPACE}")
SLEEP(800)
Winmove("飞狐交易师 -","",0,0,960,518)
SLEEP(200)

;重启预警
WinActivate("飞狐交易师 -")
SLEEP(200)
send("{SPACE}")
SLEEP(800)
SEND("^a")
SLEEP(200)
WinActivate("预警 - ")
SLEEP(200)
Winmove("预警 - ","",0,0,504,354)
SLEEP(200)
WinActivate("预警 - ")
SLEEP(200)
$yjqt=CONTROLGETTEXT("预警 -","","Button4")
if $yjqt="停止预警" then
MouseMove(387,40)
sleep(500)
MouseDown("left")
sleep(800)
MouseUp("left")
sleep(500)
MouseDown("left")
sleep(800)
MouseUp("left")
sleep(500)
EndIf
If $yjqt="启动预警" Then
MouseMove(387,40)
sleep(500)
MouseDown("left")
sleep(800)
MouseUp("left")
sleep(500)
EndIf

;打开预警窗口
WinActivate("飞狐交易师 -")
SLEEP(200)
MouseClick("left",806,502,3)
SLEEP(200)
WinActivate("行情笔数:")
WinActivate("预警总数:")
WinActivate("查找结果:(")
WinActivate("日志记录:")
Winmove("行情笔数:","",0,0,375,255)
Winmove("预警总数:","",0,0,375,255)
Winmove("查找结果:(","",0,0,375,255)
Winmove("日志记录:","",0,0,375,255)
SLEEP(200)
MouseMove(76,239)
SLEEP(200)
MouseClick("left")
SLEEP(200)

tooltip("Ctrl+F1启动飞狐交易师,打开预警设置和预警弹窗,并重新启动预警____ 已完成",0,0,"",1)
sleep(3000)
tooltip("")
$CtrlF1test=True
Else
tooltip("Ctrl+F1启动飞狐交易师失败,请手动启动飞狐交易师程序,看是否正常,尽量退出驻留的其他软件",0,0,"",2)
sleep(10000)
tooltip("")
$CtrlF1test=False
checkini()
EndIf
EndFunc ;Ctrl+F1启动飞狐交易师,打开预警设置和预警弹窗,并重新启动预警


Func ShowMessageCtrlF2()
$CtrlF2test=False
tooltip("Ctrl+F2启动股票交易软件并初始化",0,0,"",1)
sleep(1000)
tooltip("")
If ProcessExists($xiadanname) Then
ProgressOn("等待手动关闭网上交易系统","请手动关闭网上交易系统","剩余时间100秒",0,0)
for $ddgbjyxt=100 to 0 step -1
sleep(1000)
ProgressSet($ddgbjyxt,"剩余时间"&$ddgbjyxt&"秒")
If not ProcessExists($xiadanname) Then
$ddgbjyxt=0
EndIf
Next
ProgressOff()
sleep(1000)
If ProcessExists($xiadanname) Then
run ("taskkill /im "&$xiadanname&" /f /t ")
SLEEP(3000)
EndIf

EndIf
SLEEP(3000)
run ($xiadanpath&"\"&$xiadanname)
SLEEP(3000)

if ProcessExists($xiadanname) Then
SLEEP(1000)

WinActivate( "用户登录")
SLEEP(500)
send($wtzdzh)
SLEEP(800)
send("{TAB}")
SLEEP(500)
send($wtmm)
SLEEP(800)
send("{TAB}")
SLEEP(500)
send($wttxmm)
SLEEP(800)
send("{TAB}")
SLEEP(500)
Winmove("用户登录","",0,0,339,293)
SLEEP(800)
send("!y")
SLEEP(3000)

while WinExists("用户登录")
send("{SPACE}")
WinActivate( "用户登录")
SLEEP(2000)
send("!y")
SLEEP(2000)
wend
WinActivate("网上股票交易系统5")
SLEEP(200)
Winmove("网上股票交易系统5","",0,0,640,518)
send("{F1}")
SLEEP(200)
send("{SPACE}")
SLEEP(200)
send("{F2}")
SLEEP(200)
send("{SPACE}")
SLEEP(200)
send("{F4}")
SLEEP(200)
send("{SPACE}")
SLEEP(200)
send("{F1}")
SLEEP(200)
send("{SPACE}")
SLEEP(200)
send("399005")
SLEEP(2000)
;买入界面所用变量(可以设计按涨停价$ztj买入、跌停价$dtj卖出)
;$mrgp=CONTROLGETTEXT("网上股票交易系统","","Static29")
;$zqmc=CONTROLGETTEXT("网上股票交易系统","","Static19")
;$ztj=CONTROLGETTEXT("网上股票交易系统","","Static55")
;$dtj=CONTROLGETTEXT("网上股票交易系统","","Static68")
;$kmgs=CONTROLGETTEXT("网上股票交易系统","","Static20")
;$mc1=CONTROLGETTEXT("网上股票交易系统","","Static48")
;$mc2=CONTROLGETTEXT("网上股票交易系统","","Static47")
;$mc3=CONTROLGETTEXT("网上股票交易系统","","Static46")
;$mc4=CONTROLGETTEXT("网上股票交易系统","","Static45")
;$mc5=CONTROLGETTEXT("网上股票交易系统","","Static44")
;$zxj=CONTROLGETTEXT("网上股票交易系统","","Static49")
;$mr1=CONTROLGETTEXT("网上股票交易系统","","Static50")
;$mr2=CONTROLGETTEXT("网上股票交易系统","","Static51")
;$mr3=CONTROLGETTEXT("网上股票交易系统","","Static52")
;$mr4=CONTROLGETTEXT("网上股票交易系统","","Static53")
;$mr5=CONTROLGETTEXT("网上股票交易系统","","Static54")
;$mc1l=CONTROLGETTEXT("网上股票交易系统","","Static61")
;$mc2l=CONTROLGETTEXT("网上股票交易系统","","Static60")
;$mc3l=CONTROLGETTEXT("网上股票交易系统","","Static59")
;$mc4l=CONTROLGETTEXT("网上股票交易系统","","Static58")
;$mc5l=CONTROLGETTEXT("网上股票交易系统","","Static57")
;$zxZF=CONTROLGETTEXT("网上股票交易系统","","Static62")
;$mr1l=CONTROLGETTEXT("网上股票交易系统","","Static63")
;$mr2l=CONTROLGETTEXT("网上股票交易系统","","Static64")
;$mr3l=CONTROLGETTEXT("网上股票交易系统","","Static65")
;$mr4l=CONTROLGETTEXT("网上股票交易系统","","Static66")
;$mr5l=CONTROLGETTEXT("网上股票交易系统","","Static67")
;tooltip($mrgp&$zqmc&"涨停价:"&$ztj&"/"&"跌停价:"&$dtj&"/"&"可买股数"&$kmgs&"/"&$mc1&"/"&$mc2&"/"&$mc3&"/"&$mc4&"/"&$mc5&"/"&$mr1&"/"&$mr2&"/"&$mr3&"/"&$mr4&"/"&$mr5&"/"&$zxj&"/"&$mc1l&"/"&$mc2l&"/"&$mc3l&"/"&$mc4l&"/"&$mc5l&"/"&$mr1l&"/"&$mr2l&"/"&$mr3l&"/"&$mr4l&"/"&$mr5l&"/"&$zxZF,0,0)
;sleep(10000)
;tooltip("")
send("{SPACE}")
SLEEP(200)
send("{F2}")
SLEEP(500)
send("{SPACE}")
SLEEP(200)
send("399002")
sleep(2000)
;卖出界面所用变量
;$mcgp=CONTROLGETTEXT("网上股票交易系统","","Static112")
;$zqmc=CONTROLGETTEXT("网上股票交易系统","","Static104")
;$ztj=CONTROLGETTEXT("网上股票交易系统","","Static141")
;$dtj=CONTROLGETTEXT("网上股票交易系统","","Static154")
;$kyye=CONTROLGETTEXT("网上股票交易系统","","Static105")
;$mc1=CONTROLGETTEXT("网上股票交易系统","","Static134")
;$mc2=CONTROLGETTEXT("网上股票交易系统","","Static133")
;$mc3=CONTROLGETTEXT("网上股票交易系统","","Static132")
;$mc4=CONTROLGETTEXT("网上股票交易系统","","Static131")
;$mc5=CONTROLGETTEXT("网上股票交易系统","","Static130")
;$zxmr=CONTROLGETTEXT("网上股票交易系统","","Static135")
;$mr1=CONTROLGETTEXT("网上股票交易系统","","Static136")
;$mr2=CONTROLGETTEXT("网上股票交易系统","","Static137")
;$mr3=CONTROLGETTEXT("网上股票交易系统","","Static138")
;$mr4=CONTROLGETTEXT("网上股票交易系统","","Static139")
;$mr5=CONTROLGETTEXT("网上股票交易系统","","Static140")
;$mc1l=CONTROLGETTEXT("网上股票交易系统","","Static147")
;$mc2l=CONTROLGETTEXT("网上股票交易系统","","Static146")
;$mc3l=CONTROLGETTEXT("网上股票交易系统","","Static145")
;$mc4l=CONTROLGETTEXT("网上股票交易系统","","Static144")
;$mc5l=CONTROLGETTEXT("网上股票交易系统","","Static143")
;$zxmc=CONTROLGETTEXT("网上股票交易系统","","Static148")
;$mr1l=CONTROLGETTEXT("网上股票交易系统","","Static149")
;$mr2l=CONTROLGETTEXT("网上股票交易系统","","Static150")
;$mr3l=CONTROLGETTEXT("网上股票交易系统","","Static151")
;$mr4l=CONTROLGETTEXT("网上股票交易系统","","Static152")
;$mr5l=CONTROLGETTEXT("网上股票交易系统","","Static153")
;tooltip($mcgp&$zqmc&"涨停价:"&$ztj&"/"&"跌停价:"&$dtj&"/"&"可用余额"&$kyye&"/"&$mc1&"/"&$mc2&"/"&$mc3&"/"&$mc4&"/"&$mc5&"/"&$mr1&"/"&$mr2&"/"&$mr3&"/"&$mr4&"/"&$mr5&"/"&$zxmr&"/"&$mc1l&"/"&$mc2l&"/"&$mc3l&"/"&$mc4l&"/"&$mc5l&"/"&$mr1l&"/"&$mr2l&"/"&$mr3l&"/"&$mr4l&"/"&$mr5l&"/"&$zxmc,0,0)
;sleep(1000)
;tooltip("")
send("{SPACE}")
SLEEP(200)
send("{F1}")
SLEEP(500)
send("{SPACE}")
SLEEP(200)
send("399001")
sleep(2000)
tooltip("Ctrl+F2启动股票交易软件并初始化____ 已完成",0,0,"",1)
sleep(1000)
tooltip("")
$CtrlF2test=True
Else
tooltip("Ctrl+F2启动股票交易软件失败,请手动启动股票交易软件,看是否正常,尽量退出驻留的其他软件",0,0,"",2)
sleep(10000)
tooltip("")
$CtrlF2test=False
checkini()
EndIf
EndFunc ;Ctrl+F2启动股票交易软件并初始化


Func Monitoringfunc() ;自动监视预警并自动发出委托交易
$mahour=@HOUR
$mamin=@MIN
$masec=@SEC
$maday=@MDAY
$mamon=@MON
$gZFs=1 ;可以编辑增加工作方式选择:从开盘到现在已发预警都下单、从上次退出预警至现在未下单都下单(最早至今天开盘)、从启动预警开始监控下单。 本例中使用第三种:即时监控新增预警下单

SplashTextOn("飞狐预警自动交易正在监控","飞狐预警自动交易正在监控",200,36,600,0,1,"",10,400)
;ControlSetText("飞狐预警自动交易正在监控","","Static1","飞狐预警自动交易正在监控")
;sleep(800)

while 1
if $monitoring=False Then ;此IF语句段侦测到退出监控热键并起到退出监控作用。
SplashOff()
ExitLoop
EndIf
CopyCountAlert ()
$yjzsfirst=$yjzsc
$yjxzsfirst=$yjzsf
If $yjzssec=$yjzsfirst And $yjxzssec=$yjxzsfirst Then
$monsleep=1
Else
$monsleep=0
EndIf
If $monsleep=0 Then
CopyAlert()
EndIf
If $monsleep=0 Then
alertbat()
EndIf
If $monsleep=0 Then
xiadanfunc()
EndIf
;sleep(999)
if $monitoring=False Then ;此IF语句段侦测到退出监控热键并起到退出监控作用。
SplashOff()
ExitLoop
EndIf

CopyCountAlert ();复制预警总数和新增数
$yjzssec=$yjzsc
$yjxzssec=$yjzsf
If $yjzssec=$yjzsfirst And $yjxzssec=$yjxzsfirst Then
$monsleep=1
Else
$monsleep=0
EndIf
If $monsleep=0 Then
CopyAlert()
EndIf
If $monsleep=0 Then
alertbat()
EndIf
If $monsleep=0 Then
xiadanfunc()
EndIf
if $monitoring=False Then ;此IF语句段侦测到退出监控热键并起到退出监控作用。
SplashOff()
ExitLoop
EndIf

WEnd
SplashOff()
EndFunc ;自动监视预警并自动发出委托交易

Func alertbat() ;预警信息处理
$i=0
Local $aNewArray[UBound($jgxxh)]
$jgxxh = $aNewArray
Local $aNewArraya[UBound($jgxxha)]
$jgxxha = $aNewArraya
Local $aNewArrayb[UBound($jgxxhb)]
$jgxxhb = $aNewArrayb
Local $aNewArrayc1[UBound($jgxxhc1)]
$jgxxhc1 = $aNewArrayc1
Local $aNewArrayc2[UBound($jgxxhc2)]
$jgxxhc2 = $aNewArrayc2
Local $aNewArrayc3[UBound($jgxxhc3)]
$jgxxhc3 = $aNewArrayc3
Local $aNewArrayc4[UBound($jgxxhc4)]
$jgxxhc4 = $aNewArrayc4
Local $aNewArrayc5[UBound($jgxxhc5)]
$jgxxhc5 = $aNewArrayc5
Local $aNewArrayc6[UBound($jgxxhc6)]
$jgxxhc6 = $aNewArrayc6
Local $aNewArrayc7[UBound($jgxxhc7)]
$jgxxhc7 = $aNewArrayc7
Local $aNewArrayc8[UBound($jgxxhc8)]
$jgxxhc8 = $aNewArrayc8
Local $aNewArrayc9[UBound($jgxxhc9)]
$jgxxhc9 = $aNewArrayc9
Local $aNewArrayma[UBound($monalert)]
$monalert = $aNewArrayma
$jgxxhcnum=0
If $monclip<>"" Then
$monalert=StringSplit($monclip,@CR&@LF,1)
$monalertcount=$monalert[0]-2;总预警信息行数=$monalert[0]-2
;起始预警信息在$monalert[3]处
;最后一行信息为$monalert[$monalert[0]]
If $monalertcount>0 Then
$i=0
while $i<=$monalertcount-1
if $monitoring=False Then ;此IF语句段侦测到退出监控热键并起到退出监控作用。
SplashOff()
ExitLoop
EndIf
$i=$i+1
$jgxxh[$i]=$monalert[$i+2]
$jgxxha=StringSplit($jgxxh[$i],@TAB,1)
$jgxxhb[1]=$jgxxha[1] ;品种代码
if StringInStr($jgxxha[3],"买")>0 and StringInStr($jgxxha[3],"卖")>0 Then
$jgxxhb[2]="ZF"
ElseIf StringInStr($jgxxha[3],"买")>0 and StringInStr($jgxxha[3],"卖")=0 Then
$jgxxhb[2]="mr";操作方向:买入
ElseIf StringInStr($jgxxha[3],"买")=0 and StringInStr($jgxxha[3],"卖")>0 Then
$jgxxhb[2]="mc";操作方向:卖出
ElseIf StringInStr($jgxxha[3],"买")=0 and StringInStr($jgxxha[3],"卖")=0 Then
$jgxxhb[2]="ZF"
EndIf
$jgxxhb[3]=StringMid($jgxxha[3],2,6);单笔买卖使用金额上限
$jgxxhb[4]=StringMid($jgxxha[4],1,2);月份
$jgxxhb[5]=StringMid($jgxxha[4],4,2);日期
$jgxxhb[6]=StringMid($jgxxha[4],7,2);小时
$jgxxhb[7]=StringMid($jgxxha[4],10,2);分钟
$jgxxhb[8]=StringMid($jgxxha[4],13,2);秒
$jgxxhb[9]=$jgxxha[5];预警价格


;过滤无效预警信息
$tempjgxxhb6=(Number($jgxxhb[6])=Number($mahour) and Number($jgxxhb[7])<Number($mamin))
If $jgxxhb[2]="ZF" or StringIsInt($jgxxhb[3])=0 or $jgxxhb[4]<>$mamon or $jgxxhb[5]<>$maday or Number($jgxxhb[6])<Number($mahour) Or $tempjgxxhb6=1 Then
$jgxxhc1[$i]=-1
$jgxxhc2[$i]=$jgxxhb[2]
$jgxxhc3[$i]=$jgxxhb[3]
$jgxxhc4[$i]=$jgxxhb[4]
$jgxxhc5[$i]=$jgxxhb[5]
$jgxxhc6[$i]=$jgxxhb[6]
$jgxxhc7[$i]=$jgxxhb[7]
$jgxxhc8[$i]=$jgxxhb[8]
$jgxxhc9[$i]=$jgxxhb[9]
Else
$jgxxhc1[$i]=$jgxxhb[1]
$jgxxhc2[$i]=$jgxxhb[2]
$jgxxhc3[$i]=$jgxxhb[3]
$jgxxhc4[$i]=$jgxxhb[4]
$jgxxhc5[$i]=$jgxxhb[5]
$jgxxhc6[$i]=$jgxxhb[6]
$jgxxhc7[$i]=$jgxxhb[7]
$jgxxhc8[$i]=$jgxxhb[8]
$jgxxhc9[$i]=$jgxxhb[9]
EndIf
$jgxxhcnum=$i
WEnd

Else
EndIf

Else
EndIf
;_ArrayDisplay($jgxxhc1) ;显示预警信息处理后数组数据 ,没学会二维数组清空,只好出此下策,把数组拆开存储和清空了
;_ArrayDisplay($jgxxhc2) ;显示预警信息处理后数组数据
;_ArrayDisplay($jgxxhc3) ;显示预警信息处理后数组数据
;_ArrayDisplay($jgxxhc4) ;显示预警信息处理后数组数据
;_ArrayDisplay($jgxxhc5) ;显示预警信息处理后数组数据
;_ArrayDisplay($jgxxhc6) ;显示预警信息处理后数组数据
;_ArrayDisplay($jgxxhc7) ;显示预警信息处理后数组数据
;_ArrayDisplay($jgxxhc8) ;显示预警信息处理后数组数据
;_ArrayDisplay($jgxxhc9) ;显示预警信息处理后数组数据
EndFunc

Func xiadanfunc();下单功能块
$j=$jgxxhcnum
$i=0
While $i<=$j
$i=$i+1
;1
if $jgxxhc1[$i]>0 Then
;2
if $jgxxhc2[$i]="mr" Then
;进行买入操作
;$jgxxhc1[$i] 证券代码
;$jgxxhc3[$i] 买卖金额
Local $mmje=Number($jgxxhc3[$i])
;3
If WinExists("网上股票交易系统5") Then
$mrjgqs=""
WinActivate("网上股票交易系统5")
SLEEP(200)
Winmove("网上股票交易系统5","",0,0,640,518)
send("{SPACE}")
SLEEP(200)
send("{F4}")
SLEEP(200)
send("{SPACE}")
SLEEP(200)
send("{F1}")
SLEEP(500)
send("+{END}")
Sleep(200)
SEND("{DEL}")
send($jgxxhc1[$i])
SLEEP(1000)
Send("{TAB}")
SLEEP(1000)
$mrjgqs=ControlGetText("网上股票交易系统5","","Edit2");买入价格钱数
;4
if $mrjgqs="" Then
sleep(1000)
Else
$mrjgqsnum=Number($mrjgqs)
$mrkemai=ControlGetText("网上股票交易系统5","","Static20");可买股数
;5
IF $mrkemai="" Then
Else
$jhmrgs=Int($mmje/$mrjgqsnum/100)*100
;6
if $mrkemai<$jhmrgs Then
$jhmrgs=$mrkemai
EndIf;6
Send("{TAB}")
SLEEP(300)
Send($jhmrgs)
SLEEP(300)
send("!b")
sleep(500)
send("{SPACE}")
SLEEP(500)
send("{SPACE}")
SLEEP(500)
send("{SPACE}")
SLEEP(500)
;7
if $monitoring=False Then ;此IF语句段侦测到退出监控热键并起到退出监控作用。
SplashOff()
ExitLoop
EndIf;7
EndIf;5
EndIf;4
Else;3
tooltip("股票交易软件异常退出,请手动启动股票交易软件,看是否正常,尽量退出驻留的其他软件",0,0,"",2)
sleep(10000)
tooltip("")
ExitLoop
EndIf;3
EndIf;2
;8
If $jgxxhc2[$i]="mc" Then
;进行卖出操作
;$jgxxhc1[$i] 证券代码
;$jgxxhc3[$i] 买卖金额
Local $mmje=Number($jgxxhc3[$i])
;9
If WinExists("网上股票交易系统5") Then
$mcjgqs=""
WinActivate("网上股票交易系统5")
SLEEP(200)
Winmove("网上股票交易系统5","",0,0,640,518)
send("{SPACE}")
SLEEP(200)
send("{F4}")
SLEEP(200)
send("{SPACE}")
SLEEP(200)
send("{F2}")
SLEEP(500)
send("+{END}")
Sleep(200)
SEND("{DEL}")
send($jgxxhc1[$i])
SLEEP(1000)
Send("{TAB}")
SLEEP(1000)
$mcjgqs=ControlGetText("网上股票交易系统5","","Edit9");卖出价格钱数
;10
if $mcjgqs="" Then
sleep(1000)
Else;10
$mcjgqsnum=Number($mcjgqs)
$mckemai=ControlGetText("网上股票交易系统5","","Static105");卖出可用余额
;11
IF $mckemai="" Then
Else;11
$jhmcgs=Int($mmje/$mcjgqsnum/100)*100
;12
if $mckemai<$jhmcgs Then
$jhmcgs=$mckemai
EndIf;12
Send("{TAB}")
SLEEP(300)
Send($jhmcgs)
SLEEP(300)
send("!b")
sleep(500)
send("{SPACE}")
SLEEP(500)
send("{SPACE}")
SLEEP(500)
send("{SPACE}")
SLEEP(500)
;13
if $monitoring=False Then ;此IF语句段侦测到退出监控热键并起到退出监控作用。
SplashOff()
ExitLoop
EndIf;13
EndIf;11
EndIf;10
Else;9
tooltip("股票交易软件异常退出,请手动启动股票交易软件,看是否正常,尽量退出驻留的其他软件",0,0,"",2)
sleep(10000)
tooltip("")
ExitLoop
EndIf;9
EndIf;8
EndIf;1
WEnd

EndFunc


Func CopyAlert()
While not WinExists("飞狐交易师 -")
if $monitoring=False Then ;此IF语句段侦测到退出监控热键并起到退出监控作用。
SplashOff()
ExitLoop
EndIf
ShowMessageCtrlF1()
WEnd
WinActivate("飞狐交易师 -")
While Not WinExists("预警 - ")
if $monitoring=False Then ;此IF语句段侦测到退出监控热键并起到退出监控作用。
SplashOff()
ExitLoop
EndIf
SLEEP(200)
WinActivate("飞狐交易师 -")
SLEEP(500)
send("{SPACE}")
SLEEP(200)
send("!y")
SLEEP(500)
Send("^a")
SLEEP(500)

WEnd


WinActivate("预警 - ")
Winmove("预警 - ","",0,0,504,354)
SLEEP(200)
MouseMove(17,248)
MouseClick("right")
SLEEP(200)
SEND("{UP}")
SLEEP(200)
SEND("{ENTER}")
SLEEP(200)
SEND("{SPACE}")
SLEEP(200)
SEND("{SPACE}")
SLEEP(200)
SEND("{SPACE}")
SLEEP(200)

$monclip = ClipGet()
EndFunc


Func CopyCountAlert()
While Not WinExists("预警总数:")
WinActivate("飞狐交易师 -")
SLEEP(200)
Winmove("飞狐交易师 -","",0,0,960,518)
SLEEP(200)
send("{SPACE}")
SLEEP(200)
send("!y")
SLEEP(500)
MouseClick("left",806,502,3)
SLEEP(200)
WinActivate("行情笔数:")
WinActivate("预警总数:")
WinActivate("查找结果:(")
WinActivate("日志记录:")
Winmove("行情笔数:","",0,0,375,255)
Winmove("预警总数:","",0,0,375,255)
Winmove("查找结果:(","",0,0,375,255)
Winmove("日志记录:","",0,0,375,255)
SLEEP(200)
MouseMove(76,239)
SLEEP(200)
MouseClick("left")
SLEEP(200)
WEnd
$yjzs=winGetTitle("预警总数:","")
$yjzsa=Stringinstr($yjzs," ",0,1,1)
$yjzsb=$yjzsa-6
$yjzsc=stringmid($yjzs,6,$yjzsb) ;预警总数
$yjzsd=Stringinstr($yjzs,":",0,2,1)
$yjzse=$yjzsd+1
$yjzsf=stringmid($yjzs,$yjzse) ;新增数
SLEEP(200)
EndFunc ;复制预警总数信息


Func _StringEncryptW($i_Encrypt, $s_EncryptText, $s_EncryptPassword, $i_EncryptLevel = 1)
If $i_Encrypt <> 0 And $i_Encrypt <> 1 Then
SetError(1)
Return ''
ElseIf $s_EncryptText = '' Or $s_EncryptPassword = '' Then
SetError(1)
Return ''
Else
If Number($i_EncryptLevel) <= 0 Or Int($i_EncryptLevel) <> $i_EncryptLevel Then $i_EncryptLevel = 1
Local $v_EncryptModified, $i_EncryptCountH, $i_EncryptCountG, $v_EncryptSwap, $av_EncryptBox[256][2]
Local $i_EncryptCountA, $i_EncryptCountB, $i_EncryptCountC, $i_EncryptCountD, $i_EncryptCountE
Local $v_EncryptCipher, $v_EncryptCipherBy
If $i_Encrypt = 1 Then
For $i_EncryptCountF = 0 To $i_EncryptLevel Step 1
$i_EncryptCountG = ''
$i_EncryptCountH = ''
$v_EncryptModified = ''
For $i_EncryptCountG = 1 To StringLen($s_EncryptText)
If $i_EncryptCountH = StringLen($s_EncryptPassword) Then
$i_EncryptCountH = 1
Else
$i_EncryptCountH += 1
EndIf
$v_EncryptModified = $v_EncryptModified & ChrW(BitXOR(AscW(StringMid($s_EncryptText, $i_EncryptCountG, 1)), AscW(StringMid($s_EncryptPassword, $i_EncryptCountH, 1)), 255))
Next
$s_EncryptText = $v_EncryptModified
$i_EncryptCountA = ''
$i_EncryptCountB = 0
$i_EncryptCountC = ''
$i_EncryptCountD = ''
$i_EncryptCountE = ''
$v_EncryptCipherBy = ''
$v_EncryptCipher = ''
$v_EncryptSwap = ''
$av_EncryptBox = ''
Local $av_EncryptBox[256][2]
For $i_EncryptCountA = 0 To 255
$av_EncryptBox[$i_EncryptCountA][1] = AscW(StringMid($s_EncryptPassword, Mod($i_EncryptCountA, StringLen($s_EncryptPassword)) + 1, 1))
$av_EncryptBox[$i_EncryptCountA][0] = $i_EncryptCountA
Next
For $i_EncryptCountA = 0 To 255
$i_EncryptCountB = Mod(($i_EncryptCountB + $av_EncryptBox[$i_EncryptCountA][0] + $av_EncryptBox[$i_EncryptCountA][1]), 256)
$v_EncryptSwap = $av_EncryptBox[$i_EncryptCountA][0]
$av_EncryptBox[$i_EncryptCountA][0] = $av_EncryptBox[$i_EncryptCountB][0]
$av_EncryptBox[$i_EncryptCountB][0] = $v_EncryptSwap
Next
For $i_EncryptCountA = 1 To StringLen($s_EncryptText)
$i_EncryptCountC = Mod(($i_EncryptCountC + 1), 256)
$i_EncryptCountD = Mod(($i_EncryptCountD + $av_EncryptBox[$i_EncryptCountC][0]), 256)
$i_EncryptCountE = $av_EncryptBox[Mod(($av_EncryptBox[$i_EncryptCountC][0] + $av_EncryptBox[$i_EncryptCountD][0]), 256)][0]
$v_EncryptCipherBy = BitXOR(AscW(StringMid($s_EncryptText, $i_EncryptCountA, 1)), $i_EncryptCountE)
$v_EncryptCipher &= Hex($v_EncryptCipherBy, 2)
Next
$s_EncryptText = $v_EncryptCipher
Next
Else
For $i_EncryptCountF = 0 To $i_EncryptLevel Step 1
$i_EncryptCountB = 0
$i_EncryptCountC = ''
$i_EncryptCountD = ''
$i_EncryptCountE = ''
$v_EncryptCipherBy = ''
$v_EncryptCipher = ''
$v_EncryptSwap = ''
$av_EncryptBox = ''
Local $av_EncryptBox[256][2]
For $i_EncryptCountA = 0 To 255
$av_EncryptBox[$i_EncryptCountA][1] = AscW(StringMid($s_EncryptPassword, Mod($i_EncryptCountA, StringLen($s_EncryptPassword)) + 1, 1))
$av_EncryptBox[$i_EncryptCountA][0] = $i_EncryptCountA
Next
For $i_EncryptCountA = 0 To 255
$i_EncryptCountB = Mod(($i_EncryptCountB + $av_EncryptBox[$i_EncryptCountA][0] + $av_EncryptBox[$i_EncryptCountA][1]), 256)
$v_EncryptSwap = $av_EncryptBox[$i_EncryptCountA][0]
$av_EncryptBox[$i_EncryptCountA][0] = $av_EncryptBox[$i_EncryptCountB][0]
$av_EncryptBox[$i_EncryptCountB][0] = $v_EncryptSwap
Next
For $i_EncryptCountA = 1 To StringLen($s_EncryptText) Step 2
$i_EncryptCountC = Mod(($i_EncryptCountC + 1), 256)
$i_EncryptCountD = Mod(($i_EncryptCountD + $av_EncryptBox[$i_EncryptCountC][0]), 256)
$i_EncryptCountE = $av_EncryptBox[Mod(($av_EncryptBox[$i_EncryptCountC][0] + $av_EncryptBox[$i_EncryptCountD][0]), 256)][0]
$v_EncryptCipherBy = BitXOR(Dec(StringMid($s_EncryptText, $i_EncryptCountA, 2)), $i_EncryptCountE)
$v_EncryptCipher = $v_EncryptCipher & ChrW($v_EncryptCipherBy)
Next
$s_EncryptText = $v_EncryptCipher
$i_EncryptCountG = ''
$i_EncryptCountH = ''
$v_EncryptModified = ''
For $i_EncryptCountG = 1 To StringLen($s_EncryptText)
If $i_EncryptCountH = StringLen($s_EncryptPassword) Then
$i_EncryptCountH = 1
Else
$i_EncryptCountH += 1
EndIf
$v_EncryptModified &= ChrW(BitXOR(AscW(StringMid($s_EncryptText, $i_EncryptCountG, 1)), AscW(StringMid($s_EncryptPassword, $i_EncryptCountH, 1)), 255))
Next
$s_EncryptText = $v_EncryptModified
Next
EndIf
Return $s_EncryptText
EndIf
EndFunc ;==>_StringEncryptW 网上找到的网友改的支持UNICODE的MD5加密算法

对我有用(88)对我没用(0)