Can I ControlClick a link or object if there's no Control information? - automation

I'm using AutoIt to automate the handling of a proprietary Windows EHR application, and it looks like the creators of the application wrote it without adding classes, IDs, or names to any of their links or menu items inside the application. The application I'm trying to automate is PrimeSUITE by Greenway Health.
I've gotten it to work by using MouseClick and adding coordinates, but that only works so long as the user doesn't move the Window. I'd like to use the more reliable ControlClick method to send click commands (I don't think there's a third way to send click commands in AutoIt).
Luckily, there's a keyboard shortcut built into the application to open the menu item I want in a new window. This is how I'm currently having to access the menu item:
WinActivate(": PrimeSUITE -- #CompanyName# -- PRIMESUITETEST")
Send("{F7}")
WinActivate("Report Selection -- Webpage Dialog")
WinWaitActive("Report Selection -- Webpage Dialog")
At this point I have to rely on the window's position on the screen not moving, so that I can send MouseClick coordinates (whose origin point begins in the top-left corner of my monitor screen, rather than the current active Window's top-left corner).
I'd like to be able to activate it somehow like:
ControlClick( ": PrimeSUITE -- #CompanyName# -- PRIMESUITETEST", "Reporting", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "left", 1, 491, 15)
So that the coordinates are relative to the active window's top-left corner rather than the monitor screen's top-left corner.
For context, this is what I see when I am hovering in the application's main window (note, the application is run from the desktop; it's not a web app accessed in IE), no matter which part, regardless of whether I'm in a blank space or hovering a link/menu item:
But as soon as I hover over a menu item and then move the cursor to a submenu item, I get this:
Here is the Tree View of what Inspect.exe found:
Am I going to be stuck with the MouseClick method via screen coordinates, or is there a way to use ControlClick or some other way to send clicks programmatically?

Even though it is a desktop application it is using IE objects. You can attach to it with _IEAttach and then use _IEAction to click on objects like your menu.
Here is an example of how to attach to PrimeSUITE (you may need to change the window title).
#include <IE.au3>
$hWin = WinGetHandle("PrimeSUITE")
If WinExists($hWin) Then
$oIE = _IEAttach($hWin, "embedded")
_IELoadWait($oIE)
MsgBox(262144, "", _IEBodyReadHTML($oIE))
Else
MsgBox(262144, "", "Window not found.")
EndIf
Once you are attached you can look at the HTML to see how you want to automate the program. You have a lot of IE functions besides _IEAttach that you can use. For example: _IELinkClickByText, _IELinkClickByIndex, _IEFormElementSetValue, and _IEFormElementOptionSelect.

Related

Showing file name when in full screen mode in Intelij Idea

Intelij Idea does hides every thing when in full screen mode so that the developer can make use of maximum screen space available for writing code. From the documentation:
In Full Screen mode, IntelliJ IDEA expands the main window to occupy
the entire screen. All operating system controls are hidden, but you
can access the main menu if you hover the mouse pointer over the top
of the screen.
I recently embarked on the journey to minimise the use of mouse and therefore have started using the full screen mode. It sometimes happen that I need to know the file name. This is required as we have many files with more or less similar names (eg. XXXPreMigrationService, XXXPostMigrationService). Now in order to see the file name, I can use different approaches:
Alt+1 Shows file in the Project Explorer window.
Alt+Home Shows file in the Navigation toolbar.
Both the approaches require me to press 2 keys (twice). Is it possible to show/hide the current file name by press/un-press any key? Is there a way I can set a shortcut for such action?

Intellij quick documentation is displayed in a separate panel instead of a popup

When I click Option-Q on an identifier to display the Quick-Documentation Popup instead of it showing up in a small dialog directly above the identifier it is showing in a large separate panel to the left.
This is suboptimal because the content is not where I wanted to look for it and because the new panel overlays the entire right side of the editor panel (and its contents).
Is there a Preferences setting for getting this to be a popup again?
Aha! There's a configuration menu that can be accessed by Right clicking on the top bar of the tool window. The first option Open as Popup is the one I wanted:

display a popup inside external application

I'm developing an application in which, if I press a combination of keys shows me a popup inside the form of another external application, I mean something like the "windows game menu", but I have no idea how to show the popup in the external application. I leave you an image to make you understand what I mean as a popup. sorry for my english but I do not speak.
Thanks in advance
You cannot control one application form of another application without having access to its code or knowing if a queue messaging command has been set for doing it.
It is possible to program a window of your application to be shown over any other , likely this will not be working over a Directx - OpenGL full-area, i.e. when you are playing a videogame that is using the same functionality because the last one is winning.
In this case your popup will be visible barely as a flick, but considering standard form application you can make it to stand over by working with userd32.dll method
"SetWindowPos" with the flag HWND_TOPMOST.
You will need first to detect the position of the application window, or if it is a fullscreen one you can simply detect the size of the screen and consider to place it in the center, then you can set the position of your application form "pop-up".
Details about the SetWindowPos , which is among windwows base dll but can be invoked from .net here below:
https://learn.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setwindowpos
Make a window topmost using a window handle

Simulate mouse presses (BUTTON 4 and 5)

I'm trying to create a single file in BAT (Windows Command Prompt) to simulate a Mouse Back and Mouse Forward event (which is in fact just pressing down mouse button 4 and 5). I can't find anything on the internet on how to simulate these exact events. Most of them are about clicking the left mouse button but that's not what I need.
The program should be as simple as possible as I do not want heavy coding on this one. It should be straight forward and I hope one of you could help me out. Is this even possible (with BAT)?
The reason for this is that Logitech Gaming Software wrongly executes the back and forward buttons' up event twice, which results in annoying behaviours while for example browsing a webpage and trying to go back one page. It would then go back two pages.
Ok, I've been a little too quick with my question but it might help others. If you have the problem of your Logitech mouse doing double forward or backwards on browsers (Chrome, IE etc.) and in Windows Explorer please try the following.
First of all, you'll want to remove the currently mapped buttons. Be sure to select the desired profile first! So go over all three buttons (MOUSE 3, MOUSE 4 and MOUSE 5 (middle, tilt left, tilt right)) and remove their current mapping. By default (generic buttons) it will be "Middle click", "Back" and "Forward".
Now right click the profile at the top and select "Scripting". This is open a new window in which we can do some very advanced but still easy coding. Clear the whole thing and paste the code you find below in there. Press "Script" >> "Save" at the top of the window to save it and enjoy the working glory! You can easely test this by right clicking the profile again and selecting "Test profile". Now press any of the three buttons and you should get the outcome we want (down and up event only once on those exact buttons).
If you want to do some coding of your own feel free to change the script! The actual numbers to each mouse button can be found by clicking "Help" >> "Scripting API" at the top, along with some handy documentation. Keep in mind that you'll have to do this for every profile you desire. Doing this on the Default Profile seems the most reasonable for browsing.
function OnEvent(event, arg)
if (event == "MOUSE_BUTTON_PRESSED" and arg == 4) then
OutputLogMessage("Pressing back button\n");
PressAndReleaseMouseButton(4);
elseif (event == "MOUSE_BUTTON_PRESSED" and arg == 5) then
OutputLogMessage("Pressing forward button\n");
PressAndReleaseMouseButton(5);
elseif (event == "MOUSE_BUTTON_PRESSED" and arg == 3) then
OutputLogMessage("Pressing middle button...\n");
PressAndReleaseMouseButton(2);
end
--OutputLogMessage("event = %s, arg = %s\n", event, arg);
end

How to create a background only program that can show a window with text fields

I want to create a program that consists of just a menu in the status bar (no dock icon or menu bar) that, when the user clicks on menu items, opens a window that allows the user to enter text (NSTextField and NSTextView).
I can make the program background only by setting the "Application is background only" property to YES in my Info.plist file, however, when I do this and display a window, firstly the window always appears behind other windows, and secondly I can't type any text into it (text goes to whatever last had focus - usually a source file in Xcode!)
This is definitely not something as simple as the fields are not enabled. Simply changing the "background only" property to NO fixes the issue, but then I get a dock icon and menu bar which I don't want.
Is what I'm trying to do possible or is there something about the background only mode that means my application can never receive text?
If it is possible what do I need to do to fix this?
From the documentation for LSBackgroundOnly:
You can use this key to create faceless background apps. You should also use this key if your app uses higher-level frameworks that connect to the window server, but are not intended to be visible to users.
So when they say “background only”, they mean background only.
The key you want is LSUIElement. Xcode describes this as “Application is agent (UIElement)”.
I personally can't stand Xcode's default behavior of showing me descriptions of some of the keys' meanings. I recommend turning on “Show Raw Keys/Values”; then, Xcode will show you the real keys being used in the dictionary.