February 15, 201511 yr Hi Maarten Do you know if it is possible to assign a keystroke to maximise and minimize SLX? What I would like to do is assign a keystroke to allow this and then map it to my yoke so that I can bring SLX up with a push of a button. I am unsure if Windows will allow this. Many thanks again for a wonderful programme. John
February 15, 201511 yr Hi John, I cannot include it within SLX itself, because keystrokes go to the active window only. The best thing to do is to download and install the AutoHotkey windows scripting tool and then create a new script (just a plain text file with a .ahk extenstion) that looks like this: #NoEnv SetTitleMatchMode, 1 DetectHiddenWindows, On #F10:: IfWinNotExist, SimLauncherX return ActiveHwnd := WinExist("A") WinActivate, SimLauncherX WinGet, MinMax, MinMax, SimLauncherX if (MinMax > -1) { PostMessage, 0x112, 0xF020,,, SimLauncherX } else { PostMessage, 0x112, 0xF120,,, SimLauncherX } WinActivate, ahk_id %ActiveHwnd% return In this example the Windows key + F10 is used as a shortcut key: # is used for the Windows key, ! for Alt, ^ for Ctrl, + for Shift. Map the shortcut key to one of your joystick buttons and your done. The script toggles the SLX window between minimized and restored. If you want to toggle between minimized and maximized, you first need to maximize the SLX window manually. After you have installed AutoHotkey and created the script, double click on the .ahk script file to run it; if you like you can include a shortcut to the script file in your %ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp folder, so the script starts when you start Windows. If you want to activate the SLX window after it's restored, put a semicolon in front of the 'WinActivate, ahk_id %ActiveHwnd%' line. hope this helps, Maarten Maarten Boelens ([m][a:][R][t][ʏ][n]) Developer of SimLauncherX
February 16, 201511 yr Author Maarten Many thanks. I got it going by pasting your text into notepad and saving it as an ahk file to minimize SLX, but when I hit Win F10 again to restore it, it flashes on the screen for a millisecond and then goes away again. Any ideas on what I am doing wrong? Here is my ahk file: #NoEnv SetTitleMatchMode, 1 DetectHiddenWindows, On #F10:: IfWinNotExist, SimLauncherX return ActiveHwnd := WinExist("A") WinActivate, SimLauncherX WinGet, MinMax, MinMax, SimLauncherX if (MinMax > -1) { PostMessage, 0x112, 0xF020,,, SimLauncherX } else { PostMessage, 0x112, 0xF120,,, SimLauncherX } WinActivate, ahk_id %ActiveHwnd% return Best regards John
February 16, 201511 yr Hi John, As I said: "If you want to activate the SLX window after it's restored, put a semicolon in front of the 'WinActivate, ahk_id %ActiveHwnd%' line." thanks, Maarten Maarten Boelens ([m][a:][R][t][ʏ][n]) Developer of SimLauncherX
February 16, 201511 yr Author Hi John, As I said: "If you want to activate the SLX window after it's restored, put a semicolon in front of the 'WinActivate, ahk_id %ActiveHwnd%' line." thanks, Maarten Maarten I did that and I still have the same problem. Sorry to be a pain, but I feel I am nearly there. Here is my ahk file with the semicolon in. When I restore, it still flashes on the screen for a millisecond. #NoEnv SetTitleMatchMode, 1 DetectHiddenWindows, On #F10:: IfWinNotExist, SimLauncherX return ActiveHwnd := WinExist("A") WinActivate, SimLauncherX WinGet, MinMax, MinMax, SimLauncherX if (MinMax > -1) { PostMessage, 0x112, 0xF020,,, SimLauncherX } else { PostMessage, 0x112, 0xF120,,, SimLauncherX } ;WinActivate, ahk_id %ActiveHwnd% return Regards John
February 16, 201511 yr Hi John, Something is stealing keyboard focus. What is the active window after you pressed the key combination? thanks, Maarten Maarten Boelens ([m][a:][R][t][ʏ][n]) Developer of SimLauncherX
February 17, 201511 yr Author Hi John, Something is stealing keyboard focus. What is the active window after you pressed the key combination? thanks, Maarten Hi Maarten The only thing I have running is SLX. I press Win F10 and SLX minimizes to the taskbar. When I press Win F10 again, SLX stays on the screen for a millisecond before it disappears to the taskbar. I have tried using Alt F10 with the same result. As I said, SLX is the only programme I have running. Do you think there could be a problem with my script? It is the same as above. I appreciate the help you are giving me. Regards John
February 17, 201511 yr Hi John, It seems like the shortcut key is registered twice. Can you modify the script to look like this: #NoEnv SetTitleMatchMode, 1 DetectHiddenWindows, On #F10:: IfWinNotExist, SimLauncherX return if (A_TimeSincePriorHotkey > -1 and A_TimeSincePriorHotkey < 500) return ActiveHwnd := WinExist("A") WinActivate, SimLauncherX WinGet, MinMax, MinMax, SimLauncherX if (MinMax > -1) { PostMessage, 0x112, 0xF020,,, SimLauncherX } else { PostMessage, 0x112, 0xF120,,, SimLauncherX } ;WinActivate, ahk_id %ActiveHwnd% return If that doesn't work, what's the name of your script file? Maarten Boelens ([m][a:][R][t][ʏ][n]) Developer of SimLauncherX
February 17, 201511 yr Author Hi Maarten The new script is acting as before, only comes on for a millisecond. I have named it SLX hotkey.ahk I am trying to upload it for you but there doesn't seem to be any options for that. John
February 17, 201511 yr Hi John, Unfortunately I've run out of ideas. On my machine (Windows 8.1) the script runs perfectly fine and i don't know how I can be of any further help. If I think of something, I will let you know. thanks, Maarten Maarten Boelens ([m][a:][R][t][ʏ][n]) Developer of SimLauncherX
February 17, 201511 yr Author Hi Maarten Update for you info. I got it going by following the instructions at this website: http://lifehacker.com/5468862/create-a-shortcut-key-for-restoring-a-specific-window Maybe you might want to put this into an upgrade of the manual. You can also use for other applications. Thanks for all your help. John
Create an account or sign in to comment