如何在 Amazon EC2 上使用 ImageSearch
我有一个经常使用 ImageSearch 的 Autohotkey 脚本 - 实际上,我有很多自己的函数都使用 ImageSearch。当我在物理计算机上运行它时它工作正常,但当我在 Amazon EC2 计算机上运行它时搜索总是失败。
我不使用远程桌面(因为当我使用远程桌面时,在我关闭连接后,ImageSearch 失败,错误级别为 2)。这就是我在 EC2 机器上使用 VNC Server 并在我的计算机上使用 VNC Viewer 的原因。因此脚本运行良好,但 ImageSearch 总是失败,ErrorLevel 1。具有相同图像和内容的相同脚本在物理机上永远不会失败。
所以我的猜测是 ImageSearch 使用某种库调用,或者以某种方式依赖于硬件,并且 EC2 实例没有与普通机器相同的设置。我在哪里可以找到有关 ImageSearch 本身如何工作的信息 - 我的意思是内部(什么叫它使用等)。
或者,也许有人已经遇到过此类问题(在 EC2 或类似的虚拟环境上)并且知道解决方案?
谢谢!
更新:我以某种方式让它工作。不幸的是无法确切地说出如何 - 只是随机尝试,最后它起作用了。谢谢!
I have an Autohotkey script that uses ImageSearch a lot - actually, i have a bunch of my own functions that all use ImageSearch. It works fine when I run it on physical computers, but the search always fails when i run it on Amazon EC2 machine.
I don't use Remote Desktop (because when I did, ImageSearch failed with ErrorLevel 2 right after I closed connection). That's why I use VNC Server on EC2 machine and VNC Viewer on my computer. So the script runs fine, but ImageSearch always fails with ErrorLevel 1. The same script with the same images and stuff never fails on the physical machine.
So my guess is that ImageSearch uses some kind of library call, or somehow is dependent on hardware, and EC2 instances don't have the same settings for that as normal machines do. Where can I find the information on how the ImageSearch itself works - i mean internally (what calls it uses etc.).
Or, maybe, someone already had this type of issue (on EC2 or similar virtual environments) and knows solution?
Thanks!
Update: I somehow got it to work. Unfortunately can't tell how exactly - just randomly tried and finally it worked. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现 ImageSearch 几乎总是比其他替代方案更糟糕,其中包括:
我在使用 ImageSearch 时遇到的主要问题之一与其他替代方案相比,它的工作起来太困难了。如果可能,如果 ImageSearch 不适合您,您可以尝试其中一种方法。
不过,要回答有关 ImageSearch 如何工作的问题,
Autohotkey 是开源的。我自己并没有太深入地研究过代码,但可以在以下站点上找到它。您可以四处看看,看看 ImageSearch 在 C++ 中实际做了什么。
基本:(下方链接)
http://www.autohotkey.com/download/OtherDownloads.htm
AHK_L:(下载链接在右边)
https://github.com/Lexikos/AutoHotkey_L
I have found that ImageSearch is almost always worse than the alternatives, which include:
One of my main problems with ImageSearch is that it's mostly just way too hard to get it to work compared to the alternatives. If possible, you may try one of these methods if ImageSearch isn't working for you.
To answer your question about how ImageSearch works, though,
Autohotkey is open-source. I myself haven't looked too deeply at the code, but it's available at the following sites. You can poke around and see what ImageSearch actually does in the C++.
Basic: (Lower link)
http://www.autohotkey.com/download/OtherDownloads.htm
AHK_L: (Downloads link on right)
https://github.com/Lexikos/AutoHotkey_L