Jump to content
Macro Express Forums

Wait for Text Playback - does it work?


Recommended Posts

I've used this command occasionally because from its description in Help it would seem to be a guarantee that my text will get entered before anything else gets processed:

"This option is to be used immediately after a Text command, such as the Text Type function. Wait for Text Playback prevents the macro from continuing until all of the text has finished playing back."

But I've often found it unreliable and usually resort to simple Delays and trial/error. Perhaps it's because I don't know exactly what 'playing back' means in this context?

What is the experience/insight of others  please?

Link to comment
Share on other sites

Good point Terry. Now that I think about it, i don't see the point. To me, if I perform a Text Type command the macro doesn't proceed until that command has completed. It seems I too need an edification.

As an aside I have found the timing of text playback off. I have several macros that I categorize as "AutoText". Usually something that completes a longer bit of text with the first bit. Like the beginning of my email address. But if MEP has been inactive for a spell, it seems to be napping and the playback is delayed several seconds. It's probably of no bearing, but I mention it just in case. 

Link to comment
Share on other sites

I have never used it.

But I have experimented with similar constructs in VB-like languages and in AutoHotkey, and I'm not sure that I can tell the difference.

In Dragon Advanced Scripting, for example, I can do this with the SendKeys statement:

SendKeys "Hello, World"

or this:

SendKeys "Hello, World", True

The "True" argument is supposed to ensure that keystrokes are completely processed before the statement returns control to the procedure.

I am not positive adding the argument makes a difference, or at least, a difference that is noticeable enough to enhance reliability.

So what I often do is add a short delay:

SendKeys "Hello, World"
Wait 0.1

If the lack of a delay causes a Macro Express script to go wonky, I do exactly the same thing:

Text Type (Simulate Keystrokes): Hello, World
Delay: 100 milliseconds

 

Link to comment
Share on other sites

I set up a test macro to copy a large block of text, switch into Notepad or Word, then type the text.  After typing it displays the begin and end time for typing.  I could detect no difference with and without the Wait Text Playback.   So, I don't know what the command is good for, either. :(  I wonder if it had some use in much earlier versions of Windows.

//  
//  
Variable Set Integer %N1% from Current Minute
Variable Set Integer %N2% from Current Second
Text Type: <CTRLD>a<CTRLU>
Delay 300 Milliseconds
Macro Run: 0_Generic_Copy_To_Clipboard
Variable Set String %T1% from Clipboard
Delay 300 Milliseconds
Text Type: <ALTD><TAB><ALTU>
Delay 500 Milliseconds
Text Type: %T1%
Wait Text Playback
Variable Set Integer %N3% from Current Minute
Variable Set Integer %N4% from Current Second
Text Box Display: Begin / End Times
//  
// 

Link to comment
Share on other sites

The Macro Express Text Type command can type text much faster than the application receiving the text can process it. Keystrokes are buffered until the application can finish processing it. Problems can occur if the buffer fills up. Other problems occur if the macro is depending on something happening as a result of the items typed but it has not occurred yet.

Sometimes a small delay works fine. Sometimes, however, a delay is not enough.

When writing the sample macro "Type Special Characters" we discovered that the more information that is entered into a Notepad window the slower it responds. So, for example, the same delay that works with the first 100 lines of text will no longer work with lines 1200-1300.

The Wait for Text Playback will wait until the buffer has been emptied before continuing.

To see how this works open the "Type Special Characters" macro in the samples.mex macro file. This macro file should be copied to the folder in your documents folder where your macro files are located. It is also installed in the same folder as the Macro Express program files. If you are unable to find a copy of samples.mex it can be downloaded here: https://www.macros.com/samplemacrospro.htm.

If you edit the Type Special Characters macro to disable the Wait for Text Playback commands it will not run correctly.

  • Like 1
Link to comment
Share on other sites

Thanks, appreciate all the feedback, including Kevin’s explanation. But I’m still unclear on whether using this command is a 100% reliable way to ensure that the TextType command has been fully processed? If so then it would seem to be essential, so why is it not built in to the TextType itself?

In addition, and this suggests it’s not 100% reliable,  why sometimes does a macro using it fail, until replaced with a delay?

I sometimes also have to preface the TextType with a Keystroke Speed, experimentally adjusted. These options (Delay/Wait/Keystroke Speed) and their possible combinations can make this a surprisingly complicated task. Yet intuitively it seems to me to be a straightforward operation: simulate the fastest possible entry of text, doing nothing else until that is finished.

Terry, UK

 

Link to comment
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...