AutoHotKey: How to maximize the Netflix metro app - microsoft-metro

Using AutoHotKey, I'm trying to maximize the Netflix metro when it is already running and minimized. I haven't had any luck so far.
Here is the script I've tried:
^!z::
WinActivate Netflix
WinShow Netflix
WinMaximize Netflix
return
Here's what AHK Window Spy says about the Netflix metro app:
>>>>>>>>>>( Window Title & Class )<<<<<<<<<<<
Netflix
ahk_class Windows.UI.Core.CoreWindow
>>>>>>>>>>>>( Mouse Position )<<<<<<<<<<<<<
On Screen: 528, 738 (less often used)
In Active Window: 528, 738
>>>>>>>>>( Now Under Mouse Cursor )<<<<<<<<
Color: 0x8B7272 (Blue=8B Green=72 Red=72)
>>>>>>>>>>( Active Window Position )<<<<<<<<<<
left: 0 top: 0 width: 1360 height: 768
>>>>>>>>>>>( Status Bar Text )<<<<<<<<<<
>>>>>>>>>>>( Visible Window Text )<<<<<<<<<<<
>>>>>>>>>>>( Hidden Window Text )<<<<<<<<<<<
>>>>( TitleMatchMode=slow Visible Text )<<<<
>>>>( TitleMatchMode=slow Hidden Text )<<<<

Try to launch script with admin privileges.
Always use AutoHotkey and its documentation from
http://ahkscript.org/ (current uptodate version, new official
website)! AutoHotkey and its documentation from autohotkey.com is
outdated and you may have some problems using them!
I am not user of metro applications but here are my thoughts. If WinActivate, WinShow, WinMaximize command are not working and my above suggestions are not helping too as far as I know you are left with only one solution:
You have to activate window of minimized Netflix by clicking with
Click command on minimized Netflix.
Use ImageSearch for getting coordinates to use with Click command or enter coordinates manually.

The best option I've found so far is to re-run explorer.exe to restart the Netflix metro app, even if it's already running minimized.
;Start Netflix
^!z::
Run explorer.exe netflix:
return
This causes the Netflix app to load in the foreground without creating multiple instances of the app. However as a side-effect it causes the app to navigate back to the 1st screen.
I haven't found a better way.

Related

Access the MDI toolbar menu with AutoHotKey ControlSend

Automating a process that is being run on a RDP session, I have to use ControlSend, and not Send command in AutoHotKey.
The WindowSpy doesn't find any control on the MDI toolbar, and there are no shortkey to the menu item I want to access (Filter..). How may I open the toolbar and select the item?
I've tried
ControlSend, ahk_parent, {alt}, ahk_class FNWND3170 ;Open project folder in treeview
But with no success.
I've considered using AutoIT, but I don't think that would help as the AutoIt spy doesn't pick up the control either.
Sorry, but think of the RDP window (or even full screen) as an ever-evolving bitmap image. Your PC and autohotkey have no idea what is behind the picture. Can you run the ahk script in the remote pc itself? Keep in mind, the RDP client handles your mouseclicks and keyboard (and even voice) entirely by re-directing inputs, etc. So best bet is to do a mouse click in the appropriate spot by running a script from outside the window:
CoordMode, TargetType [, RelativeTo]
Click, 44, 55 ; Clicks the left mouse button once at coordinates 44, 55 (based on CoordMode).
Use the CoordMode "RelativeTo" flag to set to "Relative" so coordinates are relative to the active window. You may have to click twice, once to activate the RDP window and then to click at the mouse position.
See https://www.autohotkey.com/docs/commands/Click.htm and https://www.autohotkey.com/docs/commands/CoordMode.htm for info.
Hth,

autohotkey ControlClick does not work on MS tools

I have a basic AHK script that I am trying to run on a MS tool SurfaceDiagnosticToolkit.exe. Trying to click any button does not work.
Steps followed,
start SurfaceDiagnosticToolkit.exe
select screen with title Microsoft Surface Diagnostic Toolkit (Fan Test 1/1)
run script below.
.
detectHiddenWindows, On;
WinActivate, Microsoft Surface Diagnostic Toolkit (Fan Test 1/1)
MouseMove,1255,1190
MouseClick,Left,1255,1190
The script will bring the window to the front, but the mouse does not move over the screen and the MouseClick does not fire.
Other AHK tools like WinMove also do not seem to work.
Interestingly this program shows a green fading bar going left to right on the toolbar icon similar to the copying files icon.
I have also tried with the same results
MouseMove, 1560, 40
Send {vk01sc000}

What's the difference between Send and ControlSend?

AutoHotkey's official documentation lists two different sets of commands for sending simulated keyboard input to a window.
Send / SendRaw / SendInput / SendPlay / SendEvent
Sends simulated keystrokes and mouse clicks to the active window.
ControlSend / ControlSendRaw
Sends simulated keystrokes to a window or control.
What's the difference between Send and ControlSend?
Is there a reason to use one over the other?
Send/SendXXX commands send input to the active window. That is the window that currently has focus, usually by clicking it with your mouse, tabbing to it, or when a window sets focus to itself.
If your AHK script were to target a Notepad window that you have open, and you were to click on another window such as Chrome, your inputs would now be sent to Chrome.
On the flipside, using ControlSend/ControlSendXXX commands will send input to a specified window or control. A control might be a textbox, button, or similar interactive elements.
Here, the above example would still output to Notepad even if you switched focus to another window such as Chrome. The downside is that you must specify which control to send to.

Activate my app from the tray - AHK

Imagine my application's window class name is classAbc
My app has a minimized in tray ability,
When a custom key is pressed it goes into tray,
How to activate it from the tray?
WinActivate, ahk_class classAbc
won't work at that time
I also tried WinShow with no success
Will it have a different class name when it goes into tray?
if so I used a macro recorder to find it's class name when it is resident in tray
but just found 2 classes which I think both are related to Microsoft windows menubar itself:
The classes and the activation codes:
WinActivate, ahk_class Shell_TrayWnd
WinActivate, ahk_class NotifyIconOverflowWindow
Tried these also but my app doesn't appeared once it goes to the tray.
Thanks in advance for any help
There are two methods depending on how your application manages its minimizing to tray:
WinShow ahk_class YOUR_APP_WINDOW_CLASS - to get the main window class name use AHK's built-in Window Spy available from a tray menu of an AHK script or in Windows Start Menu.
If the above method stops working on subsequent runs then the application stores its minimization state internally and you'll have to use TrayIcons function to send a mouse click message to the tray icon.
Since the application that is in the tray is just hidden (usually), you should use DetectHiddenWindows first. Then you use WinActivate
So it will look like this
#NoEn ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
DetectHiddenWindows, On
WinActivate, ahk_class classAbc
PS. I don't know what you want to do after activating the app from tray, but it might be a good idea to use WinWaitActive before anything else

In notepad++ change tab size instantly

I'm using notepad++ (v6.5.3) and I constantly have to change the size of the tab for viewing some results. Not that it's taking me a lot of time to do it manually everytime, but it would be great if I could optimize that.
Is there a way to do so? Would a macro be the solution, or are they just for typing stuff?
Thanks a lot!
Ok, there's an easy way how you can achieve this - I have tested it right now:
Install AutoHotKey (or start portable version which runs without installation)
In Windows 7 and above, ensure you launched AutoHotKey as Administrator (otherwise you get inconsistencies in its behavior) - if not sure, exit it and restart it as administrator
Right click Autohotkey tray icon and select Edit This Script
Import the macro below this list at the end of the AutoHotKey script file and save the file
Right click Autohotkey tray icon and select Reload This Script.
–– This was end of general steps, now let's go with your macro: ––
In N++, display Preferences window and press its Close button1 at the bottom (NOT at the top-right corner)
Now you can use shortcuts Win+F2 and Win+F3 to switch different tab sizes instantly
SendMode Input
DetectHiddenWindows, On
SetTitleMatchMode, RegEx
;--------------------------------- Hotkeys for Notepad++ only
#IfWinActive ahk_class Notepad\+\+
#F2::Send {F10}{Right 6}{Down}{Enter}{Tab 2}{Space}16{Enter}{Tab 3}{Space}
#F3::Send {F10}{Right 6}{Down}{Enter}{Tab 2}{Space}4{Enter}{Tab 3}{Space}
#IfWinActive
1) Important: N++ user experience provided in dialog boxes is absolutely terrible. There are no anchors where you can fix focus when using keyboard. Thus you always need to perform step 4 manually when leaving Preferences dialog box otherwise the macros would send keys into incorect window page OR at correct page but incorrect control. Preferences dialog window remembers selected page and control. Macros I created for you therefore assume that correct page is already listed and button Close was recently focused.
Good news is Notepad++ windows with this weird behavior are rare exception from general user experience. In other places in N++ (or in other apps) where user interface components (menus, dialogs etc.) always start from the same point you do not need any special precautions like the one in step 4.
Adjust the macros as you like:
you can create more of them
you can adjust the numbers "16" and "4" typed into tab size input box
you can change shortcut keys to something else
you can replace sending keys with sending mouse clicks at desired screen/window positions
you can achieve many other useful shortcuts in N++ and in all other apps – check AHK deeper!