【问题标题】:Multiple pixel searches with mouse clicks通过鼠标点击进行多像素搜索
【发布时间】:2017-11-23 10:07:12
【问题描述】:
WinActivate("BlueStacks App Player")

While 1
    $Button1 = PixelSearch(0, 0, 1365, 767, 0x79b82c)
    MouseClick("primary", $Button1[0], $Button1[1], 1, 0)

    If(PixelSearch(0, 0, 1365, 767, 0x6e6e6e) Or PixelSearch(0, 0, 1365, 767, 0x5e5e5e)) Then
        MouseClick("primary", 748, 274, 1, 0)
    Else
        $Button2 = PixelSearch(0, 0, 1365, 767, 0xfca378)
        MouseClick("primary", $Button2[0], $Button2[1], 8, 0)
        $Button3 = PixelSearch(0, 0, 1365, 767, 0xfd64a7)
        MouseClick("primary", $Button3[0], $Button3[1], 1, 0)
    EndIf
WEnd

我正在为 Bluestacks 应用播放器制作自动化脚本。

我要做的是PixelSearch() 找到按钮的位置,然后左键单击它,这会打开另一个新窗口。另一个PixelSearch() 再次找到新像素并在一个坐标上单击 8 次,在另一个坐标上单击 1 次。

我创建了无限循环,因为我希望它无限发生。问题是,只有第一个 PixelSearch()MouseClick() 有效;第一次单击后功能停止。我希望脚本在新窗口打开后继续(该窗口在 Bluestacks 中的同一应用程序中打开)。

【问题讨论】:

    标签: scripting automation autoit bluestacks


    【解决方案1】:

    试试这个代码:

    WinActivate("BlueStacks App Player")
    
    While 1
        $Button1 = PixelSearch(0, 0, 1365, 767, 0x79b82c)
        If not @error then
          MouseClick("", $Button1[0], $Button1[1], 1, 0)
          If PixelSearch(0, 0, 1365, 767, 0x6e6e6e) Or PixelSearch(0, 0, 1365, 767, 0x5e5e5e) Then
             MouseClick("", 748, 274, 1, 0)
          Else
            $Button2 = PixelSearch(0, 0, 1365, 767, 0xfca378)
            If not @error then MouseClick("", $Button2[0], $Button2[1], 8, 0)
            $Button3 = PixelSearch(0, 0, 1365, 767, 0xfd64a7)
            If not @error then MouseClick("", $Button3[0], $Button3[1], 1, 0)
          EndIf
        EndIf
     WEnd
    

    【讨论】:

      猜你喜欢
      • 2012-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-01
      • 2011-10-12
      • 1970-01-01
      相关资源
      最近更新 更多