炒股用的脚本 我上班作业时用的脚本 无保留

    复制代码 代码如下:

    # 在此定义全局变量
    dim DigitImgs[10], DigitImgs1[10], DigitImgs2[10]
    function main
    while true //无限循环执行以下代码
    # 在此添加由向导创建或录制的代码
    MouseLeftClick(917, 665)
    Wait(300)
    MouseLeftClick(836, 293)
    Wait(3000)
    //①开始复制股票名字
    //取窗口原点坐标
    GetActiveWindowXY(WinX0, WinY0)
    //在窗口坐标(143, 156)按下鼠标左键
    MouseMove(WinX0+143, WinY0+156)
    MouseLeftDown()
    Wait(300)
    //在窗口坐标(81, 160)放开鼠标左键
    MouseMove(WinX0+81, WinY0+158)
    MouseLeftUp()
    Wait(200)
    //在窗口坐标(109, 155)单击鼠标右键
    MouseMove(WinX0+109, WinY0+155)
    MouseRightClick()
    Wait(200)
    KeyPress(“c”)
    Wait(200)
    //在屏幕坐标(101, 647)单击鼠标左键
    MouseLeftClick(101, 647)
    Wait(200)
    //在屏幕坐标(331, 345)单击鼠标右键
    MouseRightClick(331, 345)
    Wait(200)
    KeyPress(“p”)
    Wait(200)
    //在窗口坐标(602, 512)单击鼠标左键
    mouseMove(WinX0+318, WinY0+249)
    MouseLeftClick()
    Wait(200)
    //②开始复制股票代码
    //在窗口坐标(109, 106)双击鼠标左键
    MouseMove(WinX0+109, WinY0+106)
    MouseLeftClick()
    Wait(200)
    MouseMove(WinX0+109, WinY0+106)
    MouseLeftClick()
    Wait(200)
    //在窗口坐标(111, 105)单击鼠标右键
    MouseMove(WinX0+111, WinY0+105)
    MouseRightClick()
    Wait(100)
    KeyPress(“c”)
    Wait(100)
    //在屏幕坐标(109, 645)单击鼠标左键
    MouseLeftClick(109, 645)
    Wait(100)
    //在屏幕坐标(351, 380)单击鼠标右键
    MouseRightClick(351, 380)
    Wait(100)
    KeyPress(“p”)
    //③开始复制诊断
    Wait(100)
    //在窗口坐标(528, 300)按下鼠标左键
    MouseMove(WinX0+528, WinY0+300)
    MouseLeftDown()
    Wait(100)
    //在窗口坐标(520, 263)放开鼠标左键
    MouseMove(WinX0+520, WinY0+263)
    MouseLeftUp()
    Wait(100)
    //如果窗口坐标(111, 290)的颜色等于(49, 106, 197) 那么
    if CheckColor(WinX0+111, WinY0+290, Color(51, 94, 168), 5) then
    Wait(100)
    MouseMove(WinX0+111, WinY0+290)
    MouseRightClick()
    KeyPress(“c”)
    else //否则
    beep(784,0319)
    beep(784,0160)
    beep(880,0284)
    beep(578,0421)
    beep(523,0478)
    beep(523,0239)
    beep(440,0142)
    beep(578,0421)
    beep(784,0319)
    beep(784,0319)
    beep(880,0142)
    beep(1046,0120)
    beep(880,0142)
    beep(784,0160)
    beep(523,0239)
    beep(440,0284)
    beep(578,0421)
    end if
    Wait(100)
    //④在文本修改诊断符号
    //在屏幕坐标(802, 77)单击鼠标左键
    MouseLeftClick(802, 77)
    Wait(100)
    KeyDown(“CTRL”)
    KeyPress(“v”)
    KeyPress(“h”)
    KeyPress(“SPACE”)
    KeyUp(“CTRL”)
    KeyPress(“;”)
    KeyPress(“TAB”)
    KeyDown(“CTRL”)
    KeyPress(“SPACE”)
    KeyUp(“CTRL”)
    KeyPress(“;”)
    KeyDown(“alt”)
    KeyPress(“a”)
    KeyUp(“alt”)
    KeyPress(“ESC”)
    KeyDown(“CTRL”)
    KeyPress(“h”)
    KeyPress(“SPACE”)
    KeyUp(“CTRL”)
    KeyPress(“,”)
    KeyPress(“TAB”)
    KeyDown(“CTRL”)
    KeyPress(“SPACE”)
    KeyUp(“CTRL”)
    KeyPress(“,”)
    KeyDown(“alt”)
    KeyPress(“a”)
    KeyUp(“alt”)
    KeyPress(“ESC”)
    KeyDown(“ctrl”)
    KeyPress(“a”)
    KeyPress(“x”)
    KeyUp(“CTRL”)
    //在屏幕坐标(106, 630)单击鼠标左键
    MouseLeftClick(106, 630)
    Wait(100)
    //在屏幕坐标(381, 492)单击鼠标右键
    MouseRightClick(381, 492)
    KeyPress(“p”)
    Wait(100)
    //读入数字0-9的图像文件到数组
    LoadImage(“h1.Sel”, DigitImgs[1])
    LoadImage(“h2.Sel”, DigitImgs[2])
    LoadImage(“h3.Sel”, DigitImgs[3])
    LoadImage(“h4.Sel”, DigitImgs[4])
    LoadImage(“h5.Sel”, DigitImgs[5])
    LoadImage(“h6.Sel”, DigitImgs[6])
    LoadImage(“h7.Sel”, DigitImgs[7])
    LoadImage(“h8.Sel”, DigitImgs[8])
    LoadImage(“h9.Sel”, DigitImgs[9])
    LoadImage(“h0.Sel”, DigitImgs[10])

    LoadImage(“1.Sel”, DigitImgs1[1])
    LoadImage(“2.Sel”, DigitImgs1[2])
    LoadImage(“3.Sel”, DigitImgs1[3])
    LoadImage(“4.Sel”, DigitImgs1[4])
    LoadImage(“5.Sel”, DigitImgs1[5])
    LoadImage(“6.Sel”, DigitImgs1[6])
    LoadImage(“7.Sel”, DigitImgs1[7])
    LoadImage(“8.Sel”, DigitImgs1[8])
    LoadImage(“9.Sel”, DigitImgs1[9])
    LoadImage(“0.Sel”, DigitImgs1[10])

    LoadImage(“b1.Sel”, DigitImgs2[1])
    LoadImage(“b2.Sel”, DigitImgs2[2])
    LoadImage(“b3.Sel”, DigitImgs2[3])
    LoadImage(“b4.Sel”, DigitImgs2[4])
    LoadImage(“b5.Sel”, DigitImgs2[5])
    LoadImage(“b6.Sel”, DigitImgs2[6])
    LoadImage(“b7.Sel”, DigitImgs2[7])
    LoadImage(“b8.Sel”, DigitImgs2[8])
    LoadImage(“b9.Sel”, DigitImgs2[9])
    LoadImage(“b0.Sel”, DigitImgs2[10])

    //函数只能在”函数外面“定义,然后使用调用语句,函数定义的顺序无所谓:
    myfunc()// 调用myfunc
    Wait(100)
    //运行程序”D:\Seraph练习\x.txt”
    RunApp(“D:\Seraph练习\1\x.txt”)
    Wait(800)

    KeyDown(“CTRL”)
    KeyPress(“a”)
    Wait(100)
    KeyPress(“x”)
    KeyPress(“s”)
    KeyUp(“CTRL”)
    //如果图像”输出文本图标.sel”在此时出现
    if FindImageEx(“输出文本图标.sel”, Color(10, 10, 10), 372, 356, 928, 710, true, FoundX, FoundY) then
    //在图像上的(5, 5)位置点击鼠标
    MouseLeftClick(FoundX+5, FoundY+5)
    end if
    Wait(100)
    //在屏幕坐标(109, 640)单击鼠标左键
    MouseLeftClick(109, 640)
    //在屏幕坐标(343, 443)单击鼠标右键
    MouseRightClick(343, 443)
    Wait(600)
    KeyPress(“p”)
    Wait(100)
    KeyPress(“LEFT”)
    KeyPress(“LEFT”)
    KeyPress(“.”)
    KeyPress(“RETURN”)
    //等待2毫秒
    Wait(2000)
    KeyPress(“RETURN”)
    //等待5毫秒
    Wait(2000)
    //在屏幕坐标(910, 654)单击鼠标左键
    MouseLeftClick(910, 654)
    Wait(100)
    KeyPress(“DOWN”)
    //在窗口坐标(546, 57)单击鼠标左键
    MouseLeftClick(WinX0+546, WinY0+57)


    wend//无限循环执行以上代码
    end function
    function myfunc
    if ReadNumber(DigitImgs, 974, 523, 1017, 540, true, Num) then
    //此时如果读取成功,数字被保存在变量 Num 中
    Print(“找到图像”&Num)
    WriteTextToFile( “x.txt”, CStr(Num), true )
    exit function //退出函数,运行后面的脚本去了
    end if

    //失败就继续识别绿色数字
    if ReadNumber(DigitImgs1, 974, 523, 1017, 540, true, Num) then
    //此时如果读取成功,数字被保存在变量 Num 中
    Print(“找到图像”&Num)
    WriteTextToFile( “x.txt”, CStr(Num), true )
    exit function //退出函数,运行后面的脚本去了
    end if

    //失败就继续识别白色数字
    if ReadNumber(DigitImgs2, 974, 523, 1017, 540, true, Num) then
    //此时如果读取成功,数字被保存在变量 Num 中
    Print(“找到图像”&Num)
    WriteTextToFile( “x.txt”, CStr(Num), true )
    exit function //退出函数,运行后面的脚本去了
    end if
    do
    // 失败就报警
    beep(784,0319)
    beep(784,0160)
    beep(880,0284)
    beep(578,0421)
    loop

    end function
    # 在此添加子函数


    这个脚本帮助了我将近半年的时间 哈哈哈
    虽然现在不用这个了 但是还是留着 以后做纪念 哈哈哈哈哈哈

发表评论

发表评论