Sending keystrokes/mouse clicks to a Java program with Autohotkey - automation

Im trying to send keystrokes and mouse movements to a Java program but once the applicaton has focus nothing is sent. It's as if the Java application takes focus of everything because Autohotkey stops responding. Everything works fine in a regular Windows app (e.g. Notepad).
I've tried using various send methods (Send, SendInput, and SendEvent) but nothing works. Does anyone have any suggestions?
The program in particular is ThinkOrSwim's ThinkDesktop.

I was able to get my script running with ThinkOrSwim by running the SciTE editor as Administrator [or running the compiled scripts as Administrator].
The TOS UI had some refresh issues but my scripts went through fine to do what I needed to do.

Some playing around I've discovered that TOS on Mac OSX can be controlled via scripting with Keyboard Maestro. It's a ugly, hacked solution, but it works. You can edit text boxes and click stuff if you know the X,Y position of elements.
Keyboard Maestro can be run via scripts (AppleScript, Python, etc.) so maybe you can build some elaborate rube goldberg.

I suggest you use Easy Macro Recorder
http://download.cnet.com/Easy-Macro-Recorder/3000-2094_4-10414139.html
Its a great tool to automate keystrokes and mouse movements.
Hope this helps :)

Related

Creating a text based browser game bot that runs in the background

I want to create a bot for a text based browser game that will have:
A separate mouse that will not interfere with my mouse
human like mouse movement with random wait times and clicks buttons like a real person (basically it can't be pixel perfect clicks every time
Pauses and alerts me when a human verification shows up
There is already a program that can do this that doesn't require coding skills called Browser Automation Studio but it costs money and feels somewhat limiting. Here is a video on how it looks when developing a bot https://youtu.be/K-jT-GwjTjg?t=2524
When you compile a bot and run it it will open up a headless chrome (I think that's what you call it) app with a separate mouse, that program can be minimised and will run in the background with no problem. I know I could just use this program but I want to learn how to code this bot on my own.
I have gone to uni for web development (failed final year oof) so I know a bit of how code works and just need some pointers on how I can start this project. From my research it seems python selenium would be good but I can't find anything on making a separate mouse so That when the bot is running I can still use my pc for other stuff.
Thanks in advance.

Using code to automatically click a mouse

I'm working with a Bloomberg data sheet and I need to export this sheet into Excel. The only way of doing so is through clicking the "export" button in the Bloomberg window. Is there any way to use code to accomplish this click. I would appreciate help with 1) indicating which coding language should be used 2) the physical code syntax that can accomplish my goal
I've tried using VBA, but there is no automatic control of the mouse.
There are two alternatives you may use to simulate mouse and keyboard automation on Windows platform.
AutoHotKey
AutoIT
I would personally recommend using AutoHotKey. It has a very extensive documentation and a fairly active community.
Additionally, please try to use keyboard shortcuts (E.g Alt+F) instead of mouse movements. If you're using keyboard shortcuts, you'll be less prone to unwanted behaviour.
Extra: If you have a web application, you may use Selenium. It works neatly with Java or Python.

ShowFileDialog1 Freezing

Okay, I have had the most aggravating problem with OpenFileDialog1. I have a program that I've been using for some 8 months, and in the past month, the program has begun to hang randomly when utilizing the OpenFileDialog1.ShowDialog() function. I have already read through all of the other posts about multi-threaded vs single threaded application. This did not fix it. Enabling the "Show Help" button did not fix it. I am mostly at a loss. here is a thorough walkthrough of the bug:
Run the application. I can always use the Open File button a few times with no problems. It freezes randomly after the program has been running for awhile.
The freeze happens after I push the ShowDialog button, and never displays the Open File Dialog window. The entire program locks up and hangs. If I pause it, Visual Studio doesn't show an error. It underlines the OpenFileDialog1.ShowDialog() in green, which is very odd.
I have found a way to break the freeze. Simply run a second instance of the program and use the OpenFileDialog function. As soon as it loads the file in the second instance, the first instance unfreezes. However, this is not a fix.
The only thing I can think of that may be causing this is the program also uses a WebBrowser1 control. It only seems to happen AFTER the WebBrowser control, which is on a seperate form, not the main form, has been initiated and utilized. Does this make any sense at all?
Thank you for anyone who can help me. I am about to tear my hair out.
Debug your program with dnspy, And when the software freezes, you will be able to see within the dnspy the actual code even if it is in a third party DLL.
I have solved this problem. It was quite unsolveable based on my description above, but hopefully I will help someone with this solution. The error is related to using the IE11 Emulation Control (11000) in the WebBrowser1 control. For some reason this interferes with OpenFileDialog and causes it to hang. I have no idea why. I changed my WebBrowser1 to use IE9 Emulation Control (9999) and the error has gone away. Thank you to those who looked into this. This is a registry entry in HKEY_CURRENT_USER.

Why is my VB app invisible to the screen recorder?

I have written a VB application in VS2010. When I try to record its operation for a demo video with Windows Media Encoder x64 or Apowersoft free screen recorder, I get a recording of everything on the desktop except my application. It's like the application is invisible to the recorder. It has worked in the past (2 weeks ago). It must be something I have done but I'm baffled. Is there a "feature" in VB that can prevent you from recording the Form?
BTW, a still screen capture works fine and sub forms I bring up are captured. Only the main form is invisible to the recorder.
Thank you for your help and time.
Not a VS or VB problem after all. What I found was that windows 7 was switching me from Aero Theme to Windows 7 Basic. The message that showed up was that I was low on display memory. (A quick pop-up in the bottom right corner that I was ignored during the recording). However, I have 4.75 G of display memory?
BTW on a video conf call it produced the same invisibility "feature" until I found the Theme switch.
I haven't actually fixed anything but now know to watch for the tell tale screen blink as it switches mode. I pause the recording, and switch it back before restarting the recording. Got through the recordings I needed for now. I was using MS Media Encoder. I have now replaced it with Adobe Premier elements but haven't tried it yet to see if I still have the problem. Need to get the "how to" videos out the door first.
Thanks again. I have read many of your Answers to others in the past that have helped me solve numerous other VB and VS problems.
Michael
That's weird since it's recording forms from the application and not other forms (main form) from the same application.
Make sure you run the recorder as administrator and not the application.

Controlling USB keyboard and mouse

We have a hardware device, with an LCD display. It supports an USB interface to connect keyboard and mose. Using these keyboard and mouse, we can navigate to varios menu items and edit entries.
We have couple of test cases written to verify that mouse click and keyboard input events are working when pressed respective key.
My task is to automate these test cases.
I donot have any control to the hardware device, as I can not access the o/s kernel or any application running there. There is one way to verify what is currently displayed on the UI. So I have to use that and verify whether the mouse/keyboard has performed the appropriate events.
As I have gone through couple of previous posts, it seems like that one of the way to achieve this is through virual HID device driver rather than actual keyboard and mosue. But I am not sure how to achieve it.
Please do help me for it. I am fine with any programming language.
I am more interested to simulate the mouse and keyboard events.
You probably don't need to write your own driver. AutoHotKey does pretty much anything you can think of, and the scripting language is quite easy to learn.
You can get it here:
http://www.autohotkey.com/
Since you're using linux, here's a similar project that will run on linux:
http://sikuli.org/