Jump to content
Macro Express Forums

Trying to find a way for Alt+Tab to work


Recommended Posts

I have been using ME for quite a few years through several versions on different platforms and it is a great tool. At work they call me the macro king yet I only do simple things with it. This is the first time I am stumped and can't find a solution to my problem. In this particular case, I have to teach a client how to use the program and I am trying to make it as simple as possible for him.

 

Most of us know that you cannot use the alt+tab combo when recording a macro. If you hit the alt+tab, it simply shows nothing in the scripting editor after capturing the macro. Usually what I do is hit ALT+F12 (alt+F12 rarely does anything in programs so it is like plugging in a rem statement when I record a macro) everytime after I hit ALT+Tab so that when I go back in to edit in the scripting editor, I look for the ALT+F12 and replace it with Text type: <ALT><TAB>.

 

I would really like for alt+tab to work when capturing because for one, many of the macros I do is to copy from one window and paste into another and in many cases I will switch windows over 50 times before repeating the cycle. Using the mouse to switch windows is not always an option because many times screen positions can change and they can be different from computer to computer. In this particular case, I am trying to teach a semi-non-technical person how to use this program for himself. It would be much easier if he were able to record the alt+tab to switch between two windows. It would also be easier for me in the future if I didn't have to edit so much after I was done recording.

 

What I tried doing is using a different macro to perform the alt+tab function, but unfortunately it wouldn't allow me to execute a macro while recording another. It also didn't execute when using the macro inside another. I created a macro with a hotkey of ALT+F12 and made it do a Text type: <ALT><TAB>. It worked fine by itself, but did not work within another macro.

 

Has anyone got any ideas of how I can record the function of switching windows without using the mouse click? Any help would be much appreciated.

Link to post
Share on other sites

Floyd: Are you 100% sure about that? I seem to recall using the built-in MS macro program Recorder for many years, across various versions of Windows, and I'm pretty sure it reliably recorded Alt+Tab. When MS dropped it, i.e. stopped bundling it within the standard OS, I copied it across and it still worked. I've still got it around somewhere, so I'll hunt it out and try it on this XP Home PC. It's a 16-bit applicaion, of course, but I don't see why it shouldn't still work. Of course, if I'm right, then that might be because it's an MS program, and hence was able to work around the MS restriction you describe.

 

Kevin: Yes, but that doesn't help cptnmorgan with his requirement to capture changes of windows.

 

cptnmorgan: I think your substitution idea is a neat enough second best!

 

--

Terry, East Grinstead, UK

Link to post
Share on other sites

Yes, I've just tested it and can confirm that Recorder does capture Alt+Tab commands when recording macros. My test macro copy/pasted several results from Calculator into NotePad, with Alt+Tab switching between the windows.

 

So, not impossible. Maybe your developers could work out how to do it in MEX?

;)

 

--

Terry, East Grinstead, UK

Link to post
Share on other sites
finding a way to get this facility into MEX! Do you have any views on that?

I've always held the same view: if it makes sense to add a feature, and if it makes Macro Express better, then it's good for me, for Joe, for you, and good for the rest of the world, too.

 

If Alt+Tab is not implemented (I've never tried it), then I'm 100% certain the developers at Macro Express have a reason for leaving it out, but I would not be privileged to know what that reason is.

 

As for the original issue of using Alt+Tab when capturing a macro, I think it's a very bad idea. The same number of windows, in the same order, would need to be in place for the macro to run successfully subsequent times.

 

I'm not a real fan of the capture feature, although as these things go, it's a great implementation of one. But, that's just me ... others find that creating macros by capturing them is useful. And that's all that really matters.

Link to post
Share on other sites

Yes, I agree about the potential confusion that can arise on playback of such macros. My test case was limited to alternating strictly between just two apps.

 

As I've become slightly more confident with direct coding, I've done less capturing. But Recorder has another feature that MEX lacks, which makes capture more attractive. You get the option to record at 'actual' or 'fast' speed. The latter appears to strip out all delays. After an MEX capture, I used to go through tediously removing scores or hundreds of small incremental mouse moves!

 

--

Terry, East Grinstead, UK

Link to post
Share on other sites
But Recorder has another feature that MEX lacks, which makes capture more attractive. You get the option to record at 'actual' or 'fast' speed. After an MEX capture, I used to go through tediously removing scores or hundreds of small incremental mouse moves!

Not sure what you mean, but under the preferences dialog, you can choose to capture, or not capture, mouse movements and also whether to capture the delays or just ignore them.

Link to post
Share on other sites
Not sure what you mean, but under the preferences dialog, you can choose to capture, or not capture, mouse movements and also whether to capture the delays or just ignore them.

 

Thanks. I'd glanced at Options > Preferences > Capture > Only Capture Mouse Clicks occasionally in the past and always passed it by, hastily assuming it meant 'Capture only mouse actions, not keystrokes'. Now realise my error. I assume it does indeed achieve the same function as the Recorder feature I described. However, the latter is easier to use, as it's for individual macros and doesn't therefore require that you remember to change it again. So I've written a simple macro to toggle the MEX option, scoped to macedit.exe with a hotkey. For anyone else interested, here it is:

 

<REM2:In MEX itself, toggle the option to capture only mouse CLICKS, not moves.><SPKEY:0020><TEXTTYPE:<ALT>op<ARROW DOWN><ARROW DOWN><ARROW DOWN><ALT>y<TAB><TAB><TAB><TAB><TAB><ENTER>><MSTOP>

 

(One nice feature of MEX that I don't think I've used before is that you can write macros that work on MEX itself.)

 

BTW, I'd have liked to add a text message at the conclusion of that little macro, to tell the user whether the option was checked or not. Is there a clever way to do that please?

 

--

Terry, East Grinstead, UK

Link to post
Share on other sites
Thanks. I'd glanced at Options > Preferences > Capture > Only Capture Mouse Clicks occasionally in the past and always passed it by, hastily assuming it meant 'Capture only mouse actions, not keystrokes'. Now realise my error. I assume it does indeed achieve the same function as the Recorder feature I described. However, the latter is easier to use, as it's for individual macros and doesn't therefore require that you remember to change it again. So I've written a simple macro to toggle the MEX option, scoped to macedit.exe with a hotkey. For anyone else interested, here it is:

 

<REM2:In MEX itself, toggle the option to capture only mouse CLICKS, not moves.><SPKEY:0020><TEXTTYPE:<ALT>op<ARROW DOWN><ARROW DOWN><ARROW DOWN><ALT>y<TAB><TAB><TAB><TAB><TAB><ENTER>><MSTOP>

 

(One nice feature of MEX that I don't think I've used before is that you can write macros that work on MEX itself.)

 

BTW, I'd have liked to add a text message at the conclusion of that little macro, to tell the user whether the option was checked or not. Is there a clever way to do that please?

 

--

Terry, East Grinstead, UK

 

Anyone with any thoughts on how to do this please?

 

--

Terry, East Grinstead, UK

Link to post
Share on other sites
Try the registry - it's an easy setting to locate.

 

Thanks, hadn't thought of that.

 

For anyone else interested, it's at

HKEY_CURRENT_USER\Software\Insight Software Solutions\Macro Express\Capture

 

 

--

Terry, East Grinstead, UK

Link to post
Share on other sites

Macro Express saves its preferences in either HKEY_CURRENT_USER or in HKEY_LOCAL_MACHINE. Your macro can determine where the preferences are located using the Set Variable %T1% to "Preferences Registry Key" command found under the Variable Set From Misc command dialog. Use it like this:

 

Set Variable %T1% to "Preferences Registry Key"
Read Registry Integer: "Clicks Only"  // set the path in this command to '%T1%\Capture\Clicks Only'

It is a good idea to have your macro search for the location of the preferences to allow your macro to work for multiple users and on different computers. Also, in future versions of Macro Express, the location of the preferences will change. Using the Set Variable %T1% to "Preferences Registry Key" will make your macro more portable.

Link to post
Share on other sites

By the way guys... Thanks for the help. I set my client up and found that if you hit a key that doesn't do anything everytime you use the alt-tab during recording, you can go back and change the key press to the alt-tab. We pressed alt-F12 everytime we pressed alt-tab and of course the alt-tab's did not register when recording so in the direct editor we did a find and replace on all the alt-F12's to change them to alt-tab. It seemed to work perfectly. So even though it is not a direct fix, it did turn out to be a pretty easy work around.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...