Jump to content
Macro Express Forums

Toggle macro


Coward
 Share

Recommended Posts

I'm new to Macro Express and I was looking for some help on making a toggle macro.

I want it to type in a command every 10 seconds ( I know how to set a delay).

 

Like, I want to press the macro hotkey, walk away, then press it again and it will stop looping the macro. If anyone knows what I mean any help would be appreciated.

 

<TEXTTYPE:t/sellgun Damien_White sdpistol<ENTER> ><TEXTTYPE:

> ><TDELAY:10><TEXTTYPE:

t/sellgun Damien_White sdpistol<ENTER> >

 

That's what I have so far, I just want it to loop when I press a button and stop when I press the button again.

Link to comment
Share on other sites

It is probably easiest to do this with two macros rather than one, like so:

 

Macro A will simply type the command ONCE and then exit. On the Properties tab for the macro schedule it to "Play Macro Indefinitely" every ten seconds. Also on the Properties tab, clear the "Active" check box to disable the macro. Even though it is scheduled to run every ten seconds, it won't run while disabled.

 

Macro B should be initiated via the hotkey. It will toggle Macro A between the enabled / disabled state. It will be basically this:

IF MACRO_A IS ENABLED

DISABLE MACRO_A

ELSE

ENABLE MACRO_A

END IF

 

Use Options | Preferences | Scheduler to set the scheduler's time interval to 1 second. You don't have to set that small an interval, but larger intervals will provides less precision and Macro A won't run at exactly every 10 seconds.

Link to comment
Share on other sites

<TEXTTYPE:t/sellgun Damien_White sdpistol<ENTER>>

that's my bind. i set it to schedule | other (option) | Play Macro Indefinitely | Every 0 minutes and 11 seconds.

is that right?

 

Also how would I make a macro that turns that bind on and off? like, would I go into scripting editor? or what...

Link to comment
Share on other sites

Yes, schedule it to play every x seconds, whatever interval suits your fancy. You can get to the scheduling either by right-clicking on the macro in Macro Explorer, or by going into the Scripting Editor.

 

And yes, to make the toggle macro, the easiest way is to use the scripting editor. In Macro Explorer,

click Macro in the menu bar,

then Add Macro,

then choose the hot key,

then click the Scripting Editor button (upper right).

 

You will find in the long run that the scripting editor is the best way to do almost all development. It has been years since I made even a rudimentary macro by recording keystrokes.

Link to comment
Share on other sites

1. From the Macro Editor click Options, Preferences, Scheduler and change the Timer Interval to 'Check every 1 seconds'

 

2. Create a scheduled macro, named YourSchedMacro for this example, that runs every 10 seconds (as described in previous posts).

 

3. Create a macro, activated by a hotkey, with this inside:

If Macro "YourSchedMacro" Enabled
 Macro Disable: YourSchedMacro
Else
 Macro Enable: YourSchedMacro
End If

 

When you press the hotkey to run the macro created in #3 it will toggle the scheduled macro. It will not stop the scheduled macro if it is currently running. In fact, you may have to press the hotkey to toggle more than once. Macro Express will only run one macro at a time and if the scheduled macro is currently running it may not respond to the hotkey to run the toggle macro. (Macro Express Pro does not have this limitation. It will run multiple macros at the same time.)

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

×
×
  • Create New...