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!
I have found that ImageSearch is almost always worse than the alternatives, which include:
Keyboard Shortcuts (Tab over to the correct control, then Send {Enter})
ControlSend
ControlGet (Grab the coordinates, then use MouseClick)
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
Related
While I'm using my computer a blue window will pop up for a second then go away. The label said windows power shell, I've tried looking at the event viewer but I could not identify anything there since I'm a new user. What could be causing this?
Running windows 10
Sometimes installed programs open up command prompts to run services/init tasks, so its not completely unusual.
I've never seen it happen with powershell however.
it could be innocent and just a program you have installed running init behavior, but it could also be malicious.
the first thing to try is checking what programs are set to startup automatically. if there is a load of bloat, you could try turning off the unnecessary ones and see if it still happens.
but realistically the only real way forward is to get a good quality antivirus, and run a full system scan over your pc to double check. it wont give you 100% certainly as things could possibly get passed it, but realistically if it passes you should be fine
I'm using Google Cloud Platform and have a virtual machine. I'm also messing around with webscrapers.
I'm currently trying to do a simple scrape of reddit using a ruby script. That part works pretty well. It essentially continues down and down (to the end of reddit!) scrape the articles, though this, obviously takes some time.
Right now, in order to scrape (I'm running ruby scrape.rb > reddit.txt) I have to keep the google virtual machine ssh browser window open on my computer or the process will exit (which makes enough sense). However, what I'd like to do is have the process persist even if I close the window.
Is there a way to somehow have this process continue to run? Then I can periodically log in and check reddit.txt which will continue to grow even I'm not ssh'ed in.
Thanks!
This seems to be the answer.
The command nohup is exactly what I was looking for!
Years ago, there were functions in Win32 whereby the app could check to see if a user was running the app via Terminal Services/Remote Desktop. I thnk it was something like:
GetSystemMetrics(1000H)
Is there a system call one can make to check to see if a Win32 or Win64 app is being run remotely via a program like GotoMyPC or LogMeIn?
No, there is not. Those are third party apps doing their own video/input capturing and network streaming. They are plain ordinary apps as far as Windows is concerned. Terminal Services is built into Windows, which is why there are APIs to query TS status.
The only way I can (currently) think of, other than using the aforementioned API call, is also seeing if any particular processes you can identify are running (e.g. GotoMyPC or LogMeIn... they will have some process running). Without doing too much research, they may be running without actually having someone using them. If, however, they launch something to do the streaming, you could check for that.
Just to make sure that this isn't an XY problem, what is it that you're trying to do - and perhaps there is another way?
I'm having a very strange problem. I'm using dfs-datastores Pail abstraction to write data to HDFS in Java. I don't think the Pail piece is important to the problem though.
When it calls org.apache.hadoop.fs.FileSystem getFS(java.lang.String path) with a path on my local filesystem it pauses for about 2 minutes seemingly doing nothing then returns. This is on my laptop.
The weird thing is that it worked really fast when I was on the network at my office today, but now that I'm home it's doing it again. I'm running Ubuntu 10.10 64-bit with Java 1.7.
Anyone have any ideas what it's doing? What could be different between being at work and being at home?
UPDATE:
I've been stepping through code with the debugger and it seems to be having trouble in Configuration.loadResource(). It's calling that multiple times and it will take 5-10 seconds to return from that function.
UPDATE2:
I've narrowed this down a little further. The biggest hang up seems to be when it calls KerberosName.setConfiguration(). Which would explain why it runs fast at work since the Active Directory acts as a Kerberos server. I don't have one here at home, so it can't find one. Now they question is why in the world it's trying to load the Java Kerberos stuff.
I found a solution (or at least a work around). I installed the krb5-kdc package and now my little program runs fast without any unexplained pauses. After this I removed krb5-kdc, tested and it was still running fast. I removed /etc/krb5.conf and it started doing the pause again. It looks like using the Hadoop library on Ubuntu (at least) requires a /etc/krb5.conf file.
Maybe this will help someone else.
After intensive searching why certain workstations wouldn't perform a certain action when just being started up in the morning (...) I've discovered that GetPrivateProfileInt just returns the default value and doesn't bother to set GetLastError to something non-zero when the network-subsystem hasn't activated yet (e.g. because the DHCP client is still trying to get hold of an IP address to use.)
Does this sound familiar to someone? Does anybody happen to know what I should/could do about it?
For now I'll correct by using an alternate default value, and stalling a bit while I get my default value.
GetPrivateProfileInt() is one of those innocent looking Windows API functions that has a ton of code behind it. There's a mass of appcompat code, designed to allow Win3 programs to run on modern versions of Windows. One of the side-effects is that it is incredibly slow, it took about 50 msec the last time I profiled it.
Looks like you found a flaw in it. For all I know, it might actually be designed appcompat behavior. Emulating the way this API worked 18 years ago. I have no clue of course if that's accurate.
The very best thing you can do is stop using it. A possible workaround is to open the file first so that your program blocks until the service is up and running.
I would check if the file exists and sleep for a few seconds until the file is there. After some number of tries either use the default value or take an appropriate action.