Yehnfikm8Gq Posted February 16, 2010 Report Share Posted February 16, 2010 I've been working on resolving the "If key is pressed.." scenario (as opposed to "Wait for key press"). That would allow user decisions while a repeat is running, like stop the repeat and process results obtained so far; print results now; jump to another part of the macro. I started off with an External Script version that passes the keypress via the Console/Text Variable but it's slow due to opening and closing the script and user32.dll. The Text Variable is examined in the repeat loop and action taken if valid. I then produced a working AutoIt exe that runs in parallel to ME and passes the pressed key to ME via an ini file. This is moderately fast, adding about 2secs for 1000 repeats in ME. I've been looking at passing to ME via a ConsoleWrite from the exe file. As far as I can see, ME cannot read from the console other than via an External Script. Is that the case? I don't want to use the Clipboard in case the main macro is using it. Quote Link to comment Share on other sites More sharing options...
Cory Posted February 17, 2010 Report Share Posted February 17, 2010 I will be very interested in what you find. Some ideas. Can AutoIT create a dialog box? Maybe even invisible? I'm thinking you could use control activations, maybe even with a supplemental macro. You might try writing to the registry instead of an INI file. I think it will be faster. Quote Link to comment Share on other sites More sharing options...
Yehnfikm8Gq Posted February 17, 2010 Author Report Share Posted February 17, 2010 Thanks for the registry idea. I'll give that a try. AutoIt is highly capable in GUI but unfortunately GUI programming is a nightmare - following Windows at a similar technical level. Very user-unfriendly and I can see why ME is a bit limited graphically. A simple dialog box is not difficult - or are you thinking more of a button? I have the AutoIt exe looping at 150mSecs which seems fine - you don't have to hold the key down very long for it to register. It passes the keypress to the ini. Currently I have only set four keys, End, keypad 1, 2, 3. Selected for applicability(End) and uncommon use (keypad 1,2,3). The more keys you add the slower it is and the more likelihood of someone pressing a hotkey by accident. I could add Ctrl+ Shift+ etc to give safer hotkeys but the current setup is fine for my purposes. The ME Repeat's If statements would read the keypress and write "" back to the ini. Each keypress could be used to trigger a different event. I was intending the usage to be for slower Repeat loops. On a fast PC it would be fairly invisible. You have to wait for the ME Repeat loop to pass through next time before the If is read so it's not an instant exit. My need came from doing some realtime measurements on the PC. For speed I put readings into an array for processing at the end. I set a large number of repeats to ensure there were enough. After a while I had what I needed but could not exit the Repeat. If I stopped the macro, I would lose all the data since it had not been committed to text file. To date I've been using the bottom right corner of the screen as active and using mouse position to jump out of loops. Keypress affords variable paths of action. I'll see how the registry thing goes and maybe post the codes. Quote Link to comment Share on other sites More sharing options...
paul Posted February 17, 2010 Report Share Posted February 17, 2010 AutoIt is highly capable in GUI but unfortunately GUI programming is a nightmare - following Windows at a similar technical level. Very user-unfriendly and I can see why ME is a bit limited graphically. A simple dialog box is not difficult - or are you thinking more of a button? And if you think AutoIt's syntax is unfriendly, take a look at AutoHotkey, which is more powerful than AutoIt with respect to what you can control via the keyboard! 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.