kalemaroni Posted September 9, 2020 Report Share Posted September 9, 2020 I want to rename the captions (window titles) of certain windows as soon as the title of those windows come into view. At the moment I have a macro that when I hit the hotkey activation it prompts for the new window title and changes the current focused window title to the prompted value. However, when I restart the computer it changes all those window titles back to their original value. My idea was to, when the hotkey is pressed, dynamically create a macro that is activated by the original window title and then changing the title from within that macro. Is this possible? Quote Link to comment Share on other sites More sharing options...
acantor Posted September 9, 2020 Report Share Posted September 9, 2020 It might be possible. Perhaps captures the current window title, revise it (or prompt the user to revise it), and save the result in a global variable that is restored the next time the macro is activated? Store the new name in a file that the macro reads when it is run? Try to avoid creating a macro that modifies another by manipulating the MEP user interface. I know it's possible because I've done it, but phew!!! It was a lot of work. Although result was almost 100% reliable, it failed occasionally... and spectacularly. Quote Link to comment Share on other sites More sharing options...
Cory Posted September 9, 2020 Report Share Posted September 9, 2020 Sure. Just Repeat with Windows command and when you find the one you want, change it. Also why don't you have a macro for each window title that activates by Window Title instead of HotKey? Then it would happen automatically. What command do you use to change them? I remember this from long ago, but have forgotten. Quote Link to comment Share on other sites More sharing options...
kalemaroni Posted September 10, 2020 Author Report Share Posted September 10, 2020 16 hours ago, Cory said: Sure. Just Repeat with Windows command and when you find the one you want, change it. --This is a workaround that I may end up having to do but it's not ideal Also why don't you have a macro for each window title that activates by Window Title instead of HotKey? Then it would happen automatically. --This is what I want to do ultimately as it's the elegant solution, it's just that I don't know what the window titles are going to be, hence wanting to know how to create a macro like this dynamically. What command do you use to change them? I remember this from long ago, but have forgotten. -- I couldn't actually find a command to change them so I found a 3rd party app that does it and I just pass it command line parameters Quote Link to comment Share on other sites More sharing options...
kalemaroni Posted September 10, 2020 Author Report Share Posted September 10, 2020 17 hours ago, acantor said: It might be possible. Perhaps captures the current window title, revise it (or prompt the user to revise it), and save the result in a global variable that is restored the next time the macro is activated? Store the new name in a file that the macro reads when it is run? Try to avoid creating a macro that modifies another by manipulating the MEP user interface. I know it's possible because I've done it, but phew!!! It was a lot of work. Although result was almost 100% reliable, it failed occasionally... and spectacularly. I'd love to know how to create a macro dynamically - specifically the type that activates on Window Title becoming active. Please could you share how you did it? Quote Link to comment Share on other sites More sharing options...
acantor Posted September 10, 2020 Report Share Posted September 10, 2020 It's easy to change a macro activated by hotkey into a macro that is activated by the window title. In fact, the same macro can be activated by either a hotkey, or a window title. Open the script in the Macro Explorer, and go to the "Activations" tab. Click "Add" and then choose "Window Title." There are a lot of options, e.g., window gains focus or opens, partial or exact match of the title, etc. Some options are more reliable than others: for example, some people on this forum (but not all), recently noted that a trigger of a window gaining focus worked better than a trigger of a window opening. When creating a macro from scratch, you can set the activation to window title as easily as you can set it to hotkey: If your question is related to the code to capture the window title and rename it, perhaps you are looking for something like this? Variable Set String %Title% to topmost window title Variable Modify String: Replace "- Mozilla Firefox" in %Title% with "" // Delete "- Mozilla Firefox" by replacing it with "" Variable Set String %NewTitle% to "<title>%Title%</title>" MessageBox: New title = %NewTitle% Quote Link to comment Share on other sites More sharing options...
Cory Posted September 10, 2020 Report Share Posted September 10, 2020 acantor: I already suggested using window activation but the OP said he doesn't know what the window title will be. OP: I assume that the window title is so different that the partial match or wildcard option will not work. Is that correct? Can you give us some examples? Screen shots? I'm confused. How do you know the app if every time the window appears is has a radically different window title? Another thought: How about being proactive instead of reactive? Instead of launching the program and then trying to detect it, have MEP launch the program and then you can get the window title of the active window. Create a shortcut or whatever to MeProc.exe. CHeck out the help section "Command Line Parameters". 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.