rberq Posted August 29, 2020 Report Share Posted August 29, 2020 Since my hands are most often on the keyboard, I prefer using keys to using the mouse. One of my most-used macros closes the current application. If Firefox is active, it types Ctrl-w to close the active tab. Otherwise, it clicks in the upper right corner of the active application’s window. The macro is activated by the keypad minus key, and it’s generally quicker to press the key than to manually maneuver the mouse or to press that awkward Alt-F4 combination. Here’s the problem: In many Windows 10 system screens, the key is ignored so the macro doesn’t run. Other hotkey combinations are also ignored – like Ctrl-Alt-w that runs a macro to display all open windows. Is there a Windows 10 setting, or some trick, to overcome this issue? Quote Link to comment Share on other sites More sharing options...
Cory Posted August 29, 2020 Report Share Posted August 29, 2020 Are they UWP applications? If so, MEP doesn't work with them. Quote Link to comment Share on other sites More sharing options...
rberq Posted August 29, 2020 Author Report Share Posted August 29, 2020 3 hours ago, Cory said: MEP doesn't work with them. "Doesn't work with them", in this case, seems to mean that while the application is running, MEP doesn't see key strokes and therefore can't start macros. I have seen the same ME problem under Windows 7, with the Adobe PDF Reader. Adobe says the reader runs in Protected Mode as a security feature. With Adobe the Protected Mode can be turned off, and then ME is happy. Quote Link to comment Share on other sites More sharing options...
Cory Posted August 29, 2020 Report Share Posted August 29, 2020 I've made posts here ages ago about MEP and UWP when I first discovered this. You might search and check out some of the discussions back then. Not only does it not 'hear' it can't send things like commands to controls or type. MEP was designed to work with the traditional WinForms architecture, and UWP is a completely new technology. I'm not sure if it's just that it doesn't have the facilities, or, as some has suggested, that UWP apps are more protected to guard against malware and such that often operate in the same ways MEP does. I just know the if it's a UWP, there's nothing I can do in it with MEP. Quote Link to comment Share on other sites More sharing options...
acantor Posted August 30, 2020 Report Share Posted August 30, 2020 See if Alt + spacebar works in these troublesome applications. Does the hotkey invoke the window's System menu? If it does, you might be in luck, because <ALT><spacebar> followed by c should close the window. Quote Link to comment Share on other sites More sharing options...
terrypin Posted August 30, 2020 Report Share Posted August 30, 2020 Could you give a few examples of windows that resist closure? Quote Link to comment Share on other sites More sharing options...
rberq Posted August 30, 2020 Author Report Share Posted August 30, 2020 12 hours ago, terrypin said: Could you give a few examples of windows that resist closure? For example, the Windows Setup screen and the various screens that can be accessed from there. Quote Link to comment Share on other sites More sharing options...
rberq Posted August 30, 2020 Author Report Share Posted August 30, 2020 16 hours ago, acantor said: See if Alt + spacebar works in these troublesome applications Yes! It does! So now if I can figure out the name of that little window, I'll see if it can trigger a macro that types the "c". You say it's called the Windows System menu? Quote Link to comment Share on other sites More sharing options...
acantor Posted August 30, 2020 Report Share Posted August 30, 2020 Almost every window in Windows has a System menu. The menu can usually be accessed by left clicking the top left corner of the window (on the window bar, if there is one); or by pressing Alt + spacebar. If you can't find a name for the window or the application to restrict the availability of the macro, make the macro global. You might be surprised the range of windows that will be closed with these instructions: Text Type (Simulate Keystrokes): <ALT><SPACE> Delay: 100 milliseconds Text Type (Simulate Keystrokes): c It's the key sequence I use dozens of times a day to close windows. Works like a charm! Much easier than Alt + F4 (because of my need to glance at the keyboard to find F4), and more universal than the growing list of bizarre application-specific hotkeys for exiting, which includes, for example, Ctrl + Shift + Q (Firefox), Ctrl + W (File Explorer, Firefox, Chrome), Ctrl + Q (Can't remember which application, but I've seen it...) Quote Link to comment Share on other sites More sharing options...
rberq Posted August 30, 2020 Author Report Share Posted August 30, 2020 52 minutes ago, acantor said: Text Type (Simulate Keystrokes): <ALT><SPACE> Delay: 100 milliseconds Text Type (Simulate Keystrokes): c It's the key sequence I use dozens of times a day to close windows. Every bit as good as my method of finding the upper right corner and clicking on the "X". Except my macro closes just one tab at a time (Ctrl-w) if Firefox is the active application. But my problem is getting the macro to run at all, so that it can simulate the keystrokes you outlined. As Cory explained, in the UWP applications in Windows 10, ME never even sees the hotkey to trigger the macro. The beauty of the keypad-minus key is, many applications give you the option to save/no save your work when you exit, so I can just hit the minus key with my middle finger and roll my thumb down to the Enter key to confirm saving. Very fast, and no looking for keys. But I bet I can get used to a manual Alt-Space-c, if I have to. Quote Link to comment Share on other sites More sharing options...
Samrae Posted August 31, 2020 Report Share Posted August 31, 2020 It has been stated several times on forum that Macro Express does not work with UWP programs. That is not my experience. UWP programs behave differently than Win32 programs but, with some effort, I have been able to get Macro Express to work with them. I took this as a challenge to get Macro Express to work with Windows 10 Settings. Here is a macro that opens Windows Settings, navigates to Apps & Features, and closes Settings. Note: This macro was written with Macro Express Pro 6, not ME 4. // ----------------------------------- // Initialization // ----------------------------------- Variable Set Decimal %SDelay% to 0.1 // Short delay Variable Set Decimal %MDelay% to 1 // Medium delay Variable Set Decimal %LDelay% to 2 // Long delay Keystroke Speed: 200 milliseconds Text Box Display: Progress ... // ----------------------------------- // Open Windows Settings // ----------------------------------- If Not Window "Settings" is running Text Type (Simulate Keystrokes): <WIND> Delay: %SDelay% seconds Text Type (Simulate Keystrokes): <WINU> Delay: %MDelay% seconds Text Type (Simulate Keystrokes): Settings Delay: %SDelay% seconds Text Type (Simulate Keystrokes): <ENTER> Text Box Update: Progress ... Wait for Window Title: Settings End If Delay: %LDelay% seconds // Set focus to Windows Settings If Window "Settings" is running Text Box Update: Progress ... If Not Window "Settings" is focused Text Box Update: Progress ... Window Activate: Settings Delay: %LDelay% seconds End If If Program "SYSTEMSETTINGS.EXE" is running Text Box Update: Progress ... // Type Delay: %MDelay% seconds Text Type (Simulate Keystrokes): Apps & Delay: %MDelay% seconds Text Type (Simulate Keystrokes): <ENTER> Delay: %MDelay% seconds Text Type (Simulate Keystrokes): <ENTER> Text Box Update: Progress ... If Message "Close Settings?" Delay: %sDelay% seconds // Restore focus to Settings If Not Window "Settings" is focused Text Box Update: Progress ... Window Activate: Settings Delay: %LDelay% seconds End If // Now close Settings Text Box Update: Progress ... Text Type (Simulate Keystrokes): <ALTD><SPACE><ALTU> Delay: %sDelay% seconds Text Type (Simulate Keystrokes): c Text Box Update: Progress ... Delay: 1.5 seconds End If End If End If // ----------------------------------- // Done // ----------------------------------- Keystroke Speed: 0 milliseconds <COMMENT Value="-----------------------------------"/> <COMMENT Value=" Initialization"/> <COMMENT Value="-----------------------------------"/> <VARIABLE SET DECIMAL Option="\x00" Destination="%SDelay%" Value="0.1" _COMMENT="Short delay"/> <VARIABLE SET DECIMAL Option="\x00" Destination="%MDelay%" Value="1" _COMMENT="Medium delay\r\n"/> <VARIABLE SET DECIMAL Option="\x00" Destination="%LDelay%" Value="2" _COMMENT="Long delay"/> <KEYSTROKE SPEED Delay="200"/> <TEXT BOX DISPLAY Title="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Launcing SystemSettings\\f1 \r\n\\par }\r\n" Left="Center" Top="20" Width="564" Height="143" Monitor="0" OnTop="TRUE" Keep_Focus="FALSE" Mode="\x02" Delay="0"/> <COMMENT/> <COMMENT Value="-----------------------------------"/> <COMMENT Value=" Open Windows Settings"/> <COMMENT Value="-----------------------------------"/> <IF NOT WINDOW Option="\x01" Title="Settings" Partial="TRUE" Wildcards="FALSE"/> <TEXT TYPE Action="0" Text="<WIND>"/> <DELAY Flags="\x01" Time="%SDelay%"/> <TEXT TYPE Action="0" Text="<WINU>"/> <DELAY Flags="\x01" Time="%MDelay%"/> <TEXT TYPE Action="0" Text="Settings"/> <DELAY Flags="\x01" Time="%SDelay%"/> <TEXT TYPE Action="0" Text="<ENTER>"/> <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Wait for Window \\cf1\\b Settings\\cf0\\b0\\f1 \r\n\\par }\r\n"/> <WAIT FOR WINDOW TITLE Title="Settings" Partial="TRUE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="45"/> <END IF/> <COMMENT/> <COMMENT/> <DELAY Flags="\x01" Time="%LDelay%"/> <COMMENT/> <COMMENT Value="Set focus to Windows Settings"/> <IF WINDOW Option="\x01" Title="Settings" Partial="TRUE" Wildcards="FALSE"/> <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\cf1\\b\\f0\\fs20 Settings\\b0 is running\\cf0\\f1 \r\n\\par }\r\n"/> <IF NOT WINDOW Option="\x00" Title="Settings" Partial="TRUE" Wildcards="FALSE"/> <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Set Focus to \\cf1\\b Settings\\cf0\\b0\\f1 \r\n\\par }\r\n"/> <WINDOW ACTIVATE Title="Settings" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/> <DELAY Flags="\x01" Time="%LDelay%"/> <END IF/> <COMMENT/> <IF PROGRAM Option="\x01" Program="SYSTEMSETTINGS.EXE"/> <COMMENT/> <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Select Apps in \\cf1\\b Settings\\cf0\\b0\\f1 \r\n\\par }\r\n"/> <COMMENT/> <COMMENT Value="Type"/> <DELAY Flags="\x01" Time="%MDelay%"/> <TEXT TYPE Action="0" Text="Apps &"/> <DELAY Flags="\x01" Time="%MDelay%"/> <TEXT TYPE Action="0" Text="<ENTER>"/> <DELAY Flags="\x01" Time="%MDelay%"/> <TEXT TYPE Action="0" Text="<ENTER>"/> <COMMENT/> <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\cf1\\b\\f0\\fs20 Settings\\b0 is loaded\\cf0\\f1 \r\n\\par }\r\n"/> <IF MESSAGE Caption="Close Settings?" Message="Do you want to close Settings now?" BtnMode="\x00" Default="TRUE" Left="Center" Top="40" Monitor="0" Delay="0"/> <DELAY Flags="\x01" Time="%sDelay%"/> <COMMENT/> <COMMENT Value="Restore focus to Settings"/> <IF NOT WINDOW Option="\x00" Title="Settings" Partial="TRUE" Wildcards="FALSE"/> <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Set Focus to \\cf1\\b Settings\\cf0\\b0\\f1 \r\n\\par }\r\n"/> <WINDOW ACTIVATE Title="Settings" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/> <DELAY Flags="\x01" Time="%LDelay%"/> <END IF/> <COMMENT/> <COMMENT Value="Now close Settings"/> <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Closing \\cf1\\b Settings\\cf0\\b0\\f1 \r\n\\par }\r\n"/> <TEXT TYPE Action="0" Text="<ALTD><SPACE><ALTU>"/> <DELAY Flags="\x01" Time="%sDelay%"/> <TEXT TYPE Action="0" Text="c"/> <COMMENT/> <COMMENT/> <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Closed \\cf1\\b Settings\\cf0\\b0\\f1 \r\n\\par }\r\n"/> <DELAY Flags="\x01" Time="1.5"/> <END IF/> <COMMENT/> <COMMENT/> <END IF/> <END IF/> <COMMENT/> <COMMENT Value="-----------------------------------"/> <COMMENT Value=" Done"/> <COMMENT Value="-----------------------------------"/> <KEYSTROKE SPEED Delay="0"/> Quote Link to comment Share on other sites More sharing options...
Samrae Posted August 31, 2020 Report Share Posted August 31, 2020 I failed to mention that my macro is activated with Ctrl+Alt+a. It works whether or not Settings is already loaded. in other words, a Ctrl+Alt+a hotkey works as an activation from within the Settings application. Quote Link to comment Share on other sites More sharing options...
rberq Posted August 31, 2020 Author Report Share Posted August 31, 2020 2 hours ago, Samrae said: I failed to mention that my macro is activated with Ctrl+Alt+a. It works whether or not Settings is already loaded. in other words, a Ctrl+Alt+a hotkey works as an activation from within the Settings application. You have given me hope. I have a Windows 10 system on order, and I'll have a lot more time to experiment once I get everything else converted to it. Quote Link to comment Share on other sites More sharing options...
rberq Posted September 1, 2020 Author Report Share Posted September 1, 2020 Now here's a cute idea. I started a macro that runs indefinitely -- entire macro is below. So whenever I press the ESC key the macro types your suggested sequence to close the active application window. Then the macro just waits until I'm ready to close another one. Works great with Windows 7, but again ME does not see the ESC key in many Windows 10 operating system screens, so still no dice. The other problem with this, even in Windows 7, is the limited number of keys that can be waited for. I'd rather use a key that is "never" used any other time. Repeat Until %A% Does not Equal %A% Wait for Key Press: ESC Text Type (Simulate Keystrokes): <ALTD><SPACE><ALTU> Delay: 100 milliseconds Text Type (Simulate Keystrokes): c End Repeat Quote Link to comment Share on other sites More sharing options...
Cory Posted September 4, 2020 Report Share Posted September 4, 2020 On 8/29/2020 at 12:34 PM, Cory said: I've made posts here ages ago about MEP and UWP when I first discovered this. You might search and check out some of the discussions back then. Not only does it not 'hear' it can't send things like commands to controls or type. MEP was designed to work with the traditional WinForms architecture, and UWP is a completely new technology. I'm not sure if it's just that it doesn't have the facilities, or, as some has suggested, that UWP apps are more protected to guard against malware and such that often operate in the same ways MEP does. I just know the if it's a UWP, there's nothing I can do in it with MEP. I was wrong. MEP works fine in UWP apps. I've been doing my activations incorrectly. I apologize for the misinformation. Quote Link to comment Share on other sites More sharing options...
rberq Posted September 4, 2020 Author Report Share Posted September 4, 2020 1 hour ago, Cory said: I was wrong. MEP works fine in UWP apps. I've been doing my activations incorrectly. I apologize for the misinformation. So don't keep me in suspense! I'm apparently doing my activations incorrectly, also. Please tell! 😬 Quote Link to comment Share on other sites More sharing options...
Samrae Posted September 4, 2020 Report Share Posted September 4, 2020 (edited) 1 hour ago, Cory said: I was wrong. MEP works fine in UWP apps. I've been doing my activations incorrectly. I apologize for the misinformation. No, you were not wrong. UWP programs do not follow long established standards for Windows programming. Hooks work but many hotkeys are blocked. I cannot launch a UWP .exe using the Program Launch command so I have to launch it from the menus. They do not use Alt key shortcuts. The is no File menu. They are very slow and require long delays. They do not support Window Controls. Because you prefer to use Window Controls your statement that macros do not not work with UWP programs is not incorrect. Specifically, in this case, your macro activated with Ctrl+Keypad 9 did not activate. Changing the hotkey to Ctrl+Shift+b worked. Working with UWP programs is tedious and frustrating. But, with effort, I have been able to get macros to work with them. Your mileage may vary. Edited September 4, 2020 by Samrae Fixed a few typos. Added comment about Window Controls Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.