Jump to content
Macro Express Forums

Dynamically Control Macro Playback Speed


Recommended Posts

I would really like to be able to control the Macro Playback Speed using, say, the arrow keys (or some other would be fine, too).

Let's assume a start-up speed at the default 1.0.  Pressing the up arrow would increase the speed to, say, 1.1.  Pressing again, 1.2.  Etc.

Pressing down arrow would reduce speed to 0.9.  Again, 0.8.

What's the possibility of being able to accomplish this?

Thanks!

Nicholas Kormanik

 

 

Link to comment
Share on other sites

It looks like Macro Playback Speed can do this, by (1) embedding Wait Time Delay (milliseconds) at various points in the macro, and (2) pre-loading a variable with a delay multiple. 

For example, put Wait Time Delay (%base_delay_milliseconds%) at various points in the macro, like before each mouse movement, text typing, etc.  Very early in the macro logic, load a multiple into a second variable (%delay_multiple%), and issue the Macro Playback Speed command using %delay_multiple% as the parameter. 

You probably want a second macro, triggered by your plus-speed or minus-speed keys, to store %delay_multiple% into a file or environmental variable.  Then each time the principal macro runs, it accesses the file/environmental variable in order to set %delay_multiple%.  This makes the whole thing dynamic so you can change %delay_multiple% on the fly without re-coding the macro. 

I haven’t done what I have described above, but it looks like it should work.  As far as I can see from ME Help screens, Macro Playback Speed only affects delay times, and does NOT affect other macro commands. 

Let us know how you make out with this. 

Link to comment
Share on other sites

A macro will not listen for keystrokes like I think you're hoping for. So you will need to do something like what rberg is suggesting. I would use the registry instead of a file. Also the arrow keys are used in applications which is a conflict. You can help reduce this problem by scoping the second speed control macro to that application or the macro. You might want to use the angle brackets or something like that in combination with a modifier key like the Ctrl. Ctrl+< for down and Ctrl+> for up. Something like that. And I would have them simply enter the text "Up"" or "Down" in your registry value. Make your macro use a variable for delays or speed values. Then, as rberg said, put several catches in your macro that look at that key. If it "Up" appears have it decrease the value (faster) and write blank text back to the registry. 

Link to comment
Share on other sites

Yes, you can initiate another macro while the first one is running. The idea is to have your main macro read a value from the registry and adjust the playback speed.

Something like this:

Read Registry Value "HKEY_CURRENT_USER\Software\Insight Software Solutions\Macro Express 4\$Temp\MacSpeed" into %MacSpeed%
Macro Playback Speed: %MacSpeed%
 
// Do something
Delay: 0.5 seconds
 
Read Registry Value "HKEY_CURRENT_USER\Software\Insight Software Solutions\Macro Express 4\$Temp\MacSpeed" into %MacSpeed%
Macro Playback Speed: %MacSpeed%
 
// Do something else
Delay: 0.25 seconds

 

Link to comment
Share on other sites

Do you prefer saving the MacSpeed number into the Registry?  Why?  Is there an alternative, like, for instance, just the clipboard?

How would one get the changed MacSpeed number into the Registry?  A normal registry key file?

So, let's assume the default MacSpeed is 1.0.

We want to change that number to 1.1.  Then to 1.2.  Then 1.3.  Etc.

All by changing the MacSpeed number held in the Registry value?

Perhaps by setting on the desktop several registry key files, for each speed, and double-clicking on those respective files?

MacSpeed 1.0.reg

MacSpeed 1.1.reg

MacSpeed 1.2.reg

Link to comment
Share on other sites

By the way, the only thing my "main macro program" is doing is 'pressing' page-down, over and over and over again.  In an ebook.  Simply going to the next page.  That's it.

But I want to be able to speed up or slow down the reading pace.

That's the whole purpose here presently.

 

Link to comment
Share on other sites

Clever idea, to force yourself to speed-read? 

It doesn't matter too much where you store the speed-multiple, whether a text file or the registry or wherever.  Use whichever approach is easiest for you to program.  I like a file for something simple like this, if only because I can view and manipulate the file with Notepad, independent of Macro Express. 

Link to comment
Share on other sites

6 hours ago, nkormanik said:

Do you prefer saving the MacSpeed number into the Registry?  Why?  Is there an alternative, like, for instance, just the clipboard?

I am comfortable with the registry. It may be a bit more efficient than file I/O. But, as rberq said, it doesn't really matter where you store it. What have you tried? How did it work out?

6 hours ago, nkormanik said:

How would one get the changed MacSpeed number into the Registry?  A normal registry key file?

Uh, put a "Write Registry Value" command in your second macro.

Link to comment
Share on other sites

5 hours ago, Samrae said:

I am comfortable with the registry. It may be a bit more efficient than file I/O. But, as rberq said, it doesn't really matter where you store it. What have you tried? How did it work out?

Uh, put a "Write Registry Value" command in your second macro.

I've not used "Write Registry Value" before.  Will have to give it a try.

Thanks!

Link to comment
Share on other sites

More guidance please.  Error:  I set the 'default' value to 1.0.  Should one create a new key?  String value?  Binary value?  DWORD?

HKEY_CURRENT_USER\Software\Insight Software Solutions\Macro Express 4\$Temp\MacSpeed\

The variable, "", is not a valid variable. Please use a variable of the following type:
  Text Variables
  Integer Variables
  Large Integer Variables
  Decimal Variables
  Date/Time Variables
  Boolean Variables
  Control Variables
  Handle Variables
Please correct.

Link to comment
Share on other sites

Perhaps simpler approach.  Just use Macro Express variable.  What I tried below doesn't seem to work, however.  Any suggestions or comments?


Start (Enter):

<VARIABLE SET DECIMAL Option="\x00" Destination="%Speed%" Value="1"/>
<REPEAT START Start="1" Step="1" Count="1000" Save="FALSE"/>
<MACRO PLAYBACK SPEED Speed="%Speed%"/>
<TEXT TYPE Action="0" Text="<PAGE DOWN>"/>
<DELAY Flags="\x01" Time="5"/>
<END REPEAT/>


Slower (keypad -):

<VARIABLE MODIFY DECIMAL Option="\x02" Destination="%Speed%" Value1="%Speed%" Value2="1.1"/>


Faster (keypad +):

<VARIABLE MODIFY DECIMAL Option="\x02" Destination="%Speed%" Value1="%Speed%" Value2=".9"/>
 

 

Link to comment
Share on other sites

If you are going to use a variable, why not skip the PLAYBACK SPEED command and use the variable directly in the DELAY command?  If the variable is to be modified in a second macro, read the help screens on global vs. local variables to make sure the modified value is carried over from one macro to the other. 

Link to comment
Share on other sites

Okay, let's give that a try, then:

<VARIABLE SET DECIMAL Option="\x00" Destination="%MillisecondsPerPage%" Value="5555"/>
<REPEAT START Start="1" Step="1" Count="1000" Save="FALSE"/>
<TEXT TYPE Action="0" Text="<PAGE DOWN>"/>
<DELAY Flags="\x02" Time="%MillisecondsPerPage%"/>
<END REPEAT/>

Issue remains, though, how to then dynamically change %MillisecondsPerPage%.

Suggestions?

 

Link to comment
Share on other sites

As before -- modify it in a second, independent macro, and save it in a file or registry key or environmental variable.  Reload it in the above macro, either immediately before or immediately after the REPEAT START line depending how soon you want it to take effect.  That is, if you load it before REPEAT it won't take effect until after 1000 iterations; if loaded after REPEAT it should take effect instantly.  Depending where the value is stored (file, registry, etc.) the load time will appear to slow the macro down so the keystrokes will be farther apart in time, especially if reloaded every time through the REPEAT loop. 

Just out of curiosity, what do you do after the 1000 REPEATs are done?  End the macro?  Why 1000 REPEATs as opposed to 10, or 100, or 10,000? 

Link to comment
Share on other sites

On 7/6/2018 at 7:48 PM, nkormanik said:

Should one create a new key?  String value?  Binary value?  DWORD?

Yes, create a new key. Use DWORD in the registry value and use a Decimal Macro Express variable.

On 7/6/2018 at 7:48 PM, nkormanik said:

The variable, "", is not a valid variable. Please use a variable of the following type:

This means you did not enter a variable name. Enter the name of a Macro Express variable. Be sure to create a Decimal variable.

On 7/8/2018 at 5:40 AM, rberq said:

If you are going to use a variable, why not skip the PLAYBACK SPEED command and use the variable directly in the DELAY command? If the variable is to be modified in a second macro, read the help screens on global vs. local variables to make sure the modified value is carried over from one macro to the other. 

A Macro Express "Global" variable is only global to a single macro thread. In other words, to a specific macro and any macros launched by that macro via the Macro Run command. A variable set or changed in a secondary macro will not affect a variable in the primary macro, even if the variable name is the same.

As suggested previously, to do what you want you will need to create a secondary macro that modifies and stores the value in an external location such as a file or the registry. The primary macro will need to read the value from the external location.

Edited by Samrae
Clarified a few things
Link to comment
Share on other sites

10 hours ago, rberq said:

Just out of curiosity, what do you do after the 1000 REPEATs are done?  End the macro?  Why 1000 REPEATs as opposed to 10, or 100, or 10,000? 

Well, this is for 'speed reading' some interesting epub.  So, tentatively, after 1000 pages -- however long that takes -- I suppose I'll close my eyes and rest for a few minutes.

 

Link to comment
Share on other sites

4 minutes ago, nkormanik said:

... tentatively, after 1000 pages -- however long that takes -- I suppose I'll close my eyes and rest for a few minutes.

 

OK, I guess after you read that much you deserve a rest.  But no quitting early ....?

Link to comment
Share on other sites

4 hours ago, Samrae said:

A Macro Express "Global" variable is only global to a single macro thread. In other words, to a specific macro and any macros launched by that macro via the Macro Run command. A variable set or changed in a secondary macro will not affect a variable in the primary macro, even if the variable name is the same.

As suggested previously, to do what you want you will need to create a secondary macro that modifies and stores the value in an external location such as a file or the registry. The primary macro will need to read the value from the external location.

Banging my head against the desk over this one.  Was trying to use Save All Variables and Restore All Variables to try to get the two (etc.) macros to be on the same page, i.e., using the same variable between them.

One would think Macro Express would have a truly Global variable option, that ALL macros have access to.

 

Link to comment
Share on other sites

I think Environment Variables are global in the sense that you need.  These lines show how easy it is to save and recall text data to an "environment variable".  As far as I can tell, you can give the environment variable just about any name you like, and it is created on the fly.  For testing I just called it "xyz".  If you store your speed value as text, you will need to use Variable Modifiy String and Variable Modify Integer to convert back and forth between text and integer for the number of milliseconds to wait.  

//  
Variable Set String %T1% "abcdefg"
Text Box Display: %T1%
Variable Modify String: Save %T1% to Environment Variable xyz
Variable Set String %T1% "xxxxxxxxxxxxxxxxxx"
Text Box Display: %T1% (should display the "xxxxxxxxxxxxxxxxxx" value just loaded into %T1%)
Variable Set String %T1% from Environment Variable xyz
Text Box Display: %T1% (should display the original "abcdefg" text)
// 

Edited by rberq
Link to comment
Share on other sites

  • 3 years later...

Still struggling with "increase speed" and "decrease speed".

 

All the macro will do is press Page Down, again and again.  Just at different speeds.  Say, if Ctrl-+ or Ctrl-- keys are pressed.

 

Press Page Down 1000 times.  That simple.

 

Seems like there ought to be some little macro package for this very purpose.  Speed up; 
Slow down.  I mean, aren't there a lot of uses for such a thing?

 

Thanks.

 

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...