PDA

View Full Version : AutoHotKey tip for button clicking



peterthisted
03-25-2010, 07:57 AM
Arms are up :D

I was trying to find a way to click a button in one of those panel windows you do not
wish to have open when flying VC. Using the Keyboard that is........
I think it is possible to do using calls of some kind but I find it very difficult.

So why not make the window transparent when the button press should occur.
The free app "AutoHotKey" can do just that, and in a very simple way

ex. the code line ....... "WinSet, Transparent, 200, Untitled - Notepad"
will make the window transparent.

But set the value to 1 (instead of 200) you cannot find the window at all :shock:
However I did a little testing, and it is possible still to make a mouse down event in the window.

So, the plan is to make this script for a button press that do not have a key shortcut and cannot be interfaced via fsfuipc or otherwise.

1. Open the Panel window and fix the size (can be done with AutoHotkey )

2. Pre-define all the clickspots that you want (xy-coordinates relative to the window itself, therefore the fixed size)

3. Add a keyboard shortcut to the clickspots

4. Make the window transparent

5. When a key is used, make the window front most before the mouse-xy-down.

6. Make FSX main window front again

I am not sure 5. and 6. are needed, but haven't tested.

re. Peter

peterthisted
03-25-2010, 11:42 AM
Hi again.

Done a little more testing ;)
Hope it is not only me who can see the potential in this.
I beleive this is a way to keyboard interface every single button in all of the payware aircrafts that is unsupported. 8)8)

The following works flawless as an AutoHotKey script where the "Space button" presses a button on the panel named "Main Panel":

WinSet, Transparent, 1, Main Panel
winactivate, Main Panel
winmaximize, Main Panel
winmove, Main Panel,,10,0
Space::
winactivate, Main Panel
MouseClick, left, 523,1182
winactivate, Microsoft Flight Simulator X
mousemove, 1920,1200

Just reuse the bottom 5 lines for more buttons with different co-ordinates and shortcuts.


I found that the "Main Panel" had to be moved slightly out of screen in one side, hence the winmove. There was a blinking issue, but it disaperas by that operation
I tried to make the mouse invisible during the operation using the lst line, but that did not work.
It blinks one time and the disapears.
I can live with that, but maybe there is another solution.... I'll keep looking

Forgot to mention........ FSX has to be "not full screen mode" and the Panel "un-docked"
It is easy to remove the taskbar and menubar using a couple of lines more in the beginning of the script. Haven't got those right now but I have done that before.

Re. Peter

PDT 200
03-25-2010, 01:20 PM
FSUIPC using the mouse macro will do this. (I beleive this is a way to keyboard interface every single button in all of the payware aircrafts that is unsupported). I have used this for the PIC ERJ-145 and PIC 737. Works for FS9 and FSX. Panel window doesn't have to open for the button to work.
Regards,
Brian

peterthisted
03-25-2010, 02:19 PM
Hi Brian,

I am not sure you are right.
When I try fsuipc macro, in ex. PMDG J41 it cannot detect a button via the macro.
I have tried and it will not say that the macro is possible, so I guess it will not work.

Ok, I know that it is possible for that specific aircraft using a LUA script in fsuipc, but there are a lot
others where you do not have that option.

Correct me if I am wrong, I would prefer to do it directly.
But for now I think the other solution is fairly easy to work with and also the same thing to do for every interface.

Re Peter

PDT 200
03-25-2010, 10:28 PM
There are some button clicks that the mouse macro won't map and I have no idea about PMDG stuff. I won't use their stuff because of all the problems trying to get it to work with cockpit building equipment. (I know, a lot of you builders use PMDG and have worked out the bugs, I just don't have the patience anymore.) I just thought the FSUIPC MM would help if you hadn't tried it for what you needed. Good luck finding a solution.
Regards,
Brian