Using code to automatically click a mouse - automation

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.

Related

Open find and replace dialog in the IDE

Is there any way to open the Find and Replace dialog in the Access VBA IDE programmatically? To be clear, not F&R on a form or control but in the code window itself? Access doesn't have SendKeys and I can't find any command to do it.
Reason I ask is I have an ultrawide monitor and the dialog always opens in the top left of the screen. I'd like to use WinApi's SetWindowPos to reposition it as I use F&R a lot in my current project. I'm considering rolling my own function using VBE Extensibility but checking here first for a quick solution.
Not that I know of, but you could check out MZ-Tools.
Its Find/Replace window at least opens where you left it:

Multiple Cursors for Sikuli Automation

Is there an already existing program which creates a dummy cursor for Sikuli to use whilst the user maintains control of the Mouse cursor? I am looking for ways to make debugging code less arduous when working with Sikuli. Any tips in that regard are also welcomed!
This is not possible as Sikuli does not mock a mouse cursor but works with mouse and keyboard through Java Robot library to generate native system input events. Some doco on that can be found here.

Excel Macro to get by Security PopUp

I am trying to write a macro to log into a website but I keep getting stopped by a security alert pop up that requires me to click OK to continue. Any idea what lines to put in to make it click on the OK button so I can proceed to the site?
If you want to stick with VBA, a few options come to mind. The quick and dirty approach would just be to use Sendkeys, and send Enter. It's super unreliable though, but may work in your specific case.
Another option is using windows APIs to send/post the relevant message to the window. See here
The final option I'll offer is considering Authotkey as a language stand-in. It makes this type of interaction really easy. It has COM support, so you can still use Excel, just like VBA.
http://www.contextures.com/excelvbasendkeys.html
SendKeys should be able to do this I think...
SendKeys "~"
O

Sending keystrokes/mouse clicks to a Java program with Autohotkey

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 :)

How can I send clicks or keys from a VB6 app to an Excel dialog box?

My employer has purchased a third-party tool, OfficeConverter from Conveter Technology that automates the conversion / repair of Office 2003-formatted files to Office 2007 format. This tool also highly automates the translation / change in macro / VBA code requirements between Office 2003 and 2007 formats.
My problem is that during this conversion the tool is opening the targeted Office product, say Excel and is then opening the target user file (ie. Report.xls) and is then examining any VBA / macro code for change requirements. The problem is that IF the Excel file code is dependent upon some external tool like an .OCX file and if that tool doesn't exist on the PC that I'm performing this action on, Excel will pop up a message that the Object has not been found, stopping the entire conversion process (thousands of files in a row) until someone comes along and MANUALLY clicks the appropriate button to close the dialogue box.
I figured that creating a small watching application in VB6 (hey, I'm old and my skills are too) could sit on the same PC and watch for these dialogue boxes and, depending on the specific message, click the appropriate button via the SendMessage API call.
The problem is that I haven't been able to get SendMessage to actually PUSH the button for me, I've tried sending it the Return key value (vbKeyReturn) or even the Space key (vbKeySpace) but the action never results in the dialogue box closing like it should. I can get the focus to tab between whichever buttons on the dialogue box are enabled, but that is about it.
I've attempted to use SendKeys, but that is far less reliable and strongly discouraged in the current documentation that I've come across.
Any suggestions? :)
If you have the hWnd for the button, and the machine is unattended, you can easily use MouseEvent to move the cursor over the button and click it. This sample includes a drop-in ready module that'll do the dirty work for you given just the window handle:
http://vb.mvps.org/samples/MouseEvent
Otherwise, the most straightforward way is probably to just send WM_LBUTTONDOWN and WM_LBUTTONUP sequentially.
EDIT: If you "just want to get it done" take Jim's advice and try Gary Chanson's Window Demon tool.
Take a look at this utility "Window Demon" by Gary Chanson
Karl: how quickly we forget our pals!
I would suggest taking a look at AutoIt.
It is perfect for this task, look for a window with a particular text on it and click a button.
Runs in the system tray as a standalone application.