按键精灵双开窗口脚本 怎么让两个窗口同时运行

我这个脚本 第一个窗口只运行一次 第二个重复运行的,如何修改为两个脚本同时运行??

HwndEx = Plugin.Window.Search("魔兽世界")
dim MyArray
MyArray = Split(HwndEx, "|")

Delay 10000 '延时时间
For UBound(MyArray)
Call Plugin.Bkgnd.KeyPress(Myarray(0), 70)
Delay 3500'延时时间
Call Plugin.Bkgnd.KeyPress(Myarray(0), 70)
Delay 3250'延时时间
Call Plugin.Bkgnd.KeyPress(Myarray(0), 49)
Delay 2310'延时时间
Call Plugin.Bkgnd.KeyPress(Myarray(0), 52)
Delay 1280'延时时间

i=i+1
Next
If UBound(MyArray) >= 1 Then
i=1
For UBound(MyArray)
Call Plugin.Bkgnd.KeyPress(Myarray(1), 50)
Delay 3650'
Call Plugin.Bkgnd.KeyPress(Myarray(1), 70)
Delay 3120'
Call Plugin.Bkgnd.KeyPress(Myarray(1), 69)
Delay 3030'
Call Plugin.Bkgnd.KeyPress(Myarray(1), 82)
Delay 4890'
Call Plugin.Bkgnd.KeyPress(Myarray(1), 32)
Delay 4100'
Call Plugin.Bkgnd.KeyPress(Myarray(1), 49)
Delay 3120'
Call Plugin.Bkgnd.KeyPress(Myarray(1), 69)
Delay 3820'
Call Plugin.Bkgnd.KeyPress(Myarray(1), 81)
Delay 1830'
Call Plugin.Bkgnd.KeyPress(Myarray(1), 50)
Delay 3580'
Call Plugin.Bkgnd.KeyPress(Myarray(1), 70)
Delay 3210'
Call Plugin.Bkgnd.KeyPress(Myarray(1), 69)
Delay 3150'
Call Plugin.Bkgnd.KeyPress(Myarray(1), 49)
Delay 2205'
Call Plugin.Bkgnd.KeyPress(Myarray(1), 69)
Delay 11000'
i=i+1
Next
End If

单线程脚本怎么写也不会同时操作两个窗口,改成了多线程,变量i删了,循环改成了do...loop,两个窗口的脚本以子程序的方式调用,可以测试一下

HwndEx = Plugin.Window.Search("魔兽世界")
dim MyArray
MyArray = Split(HwndEx, "|")
Delay 10000'延时时间

Dimenv 窗口二

Call 窗口一_sub
窗口二=BeginThread(窗口二_sub)



Sub 窗口一_sub
    Do
        Call Plugin.Bkgnd.KeyPress(Myarray(0), 70)
        Delay 3500'延时时间
        Call Plugin.Bkgnd.KeyPress(Myarray(0), 70)
        Delay 3250'延时时间
        Call Plugin.Bkgnd.KeyPress(Myarray(0), 49)
        Delay 2310'延时时间
        Call Plugin.Bkgnd.KeyPress(Myarray(0), 52)
        Delay 1280'延时时间
    Loop
End Sub
Sub 窗口二_sub
    Do
        Call Plugin.Bkgnd.KeyPress(Myarray(1), 50)
        Delay 3650'
        Call Plugin.Bkgnd.KeyPress(Myarray(1), 70)
        Delay 3120'
        Call Plugin.Bkgnd.KeyPress(Myarray(1), 69)
        Delay 3030'
        Call Plugin.Bkgnd.KeyPress(Myarray(1), 82)
        Delay 4890'
        Call Plugin.Bkgnd.KeyPress(Myarray(1), 32)
        Delay 4100'
        Call Plugin.Bkgnd.KeyPress(Myarray(1), 49)
        Delay 3120'
        Call Plugin.Bkgnd.KeyPress(Myarray(1), 69)
        Delay 3820'
        Call Plugin.Bkgnd.KeyPress(Myarray(1), 81)
        Delay 1830'
        Call Plugin.Bkgnd.KeyPress(Myarray(1), 50)
        Delay 3580'
        Call Plugin.Bkgnd.KeyPress(Myarray(1), 70)
        Delay 3210'
        Call Plugin.Bkgnd.KeyPress(Myarray(1), 69)
        Delay 3150'
        Call Plugin.Bkgnd.KeyPress(Myarray(1), 49)
        Delay 2205'
        Call Plugin.Bkgnd.KeyPress(Myarray(1), 69)
        Delay 11000'
    Loop
End Sub

追问

这个也不能同时对两个窗口同时操作,也是第一个窗口循环结束后循环第二个窗口

追答

第八行和第九行换一下就行了,先用线程调用子程序,主线程就会继续运行了
我本机没测试,抱歉

温馨提示:答案为网友推荐,仅供参考
第1个回答  2018-11-06
那种编程代码太麻烦了,现在都是用图形化界面软件“无敌点击狗”来操作的,无敌点击狗能自动打开点击,模拟按键操作,自动网页窗口调用等功能,而且不需复杂的编程。本回答被网友采纳
第2个回答  2018-11-07
写2个脚本,同时运行。
你这个脚本我没看懂,i的变量究竟用在哪里了,改成整体循环不行吗?第一个窗口运行完一次之后,再运行第二个窗口,然后整体循环。这个循环条件没看懂。
第3个回答  2018-11-07
hwnd1=Plugin.Window.mousepoint()
delay 3000
hwnd2=Plugin.Window.mousepoint()//自己切换下两个窗口

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网