Author Topic: how do i set a toggle marco  (Read 2843 times)

junkman

  • Newbie
  • *
  • Posts: 5
how do i set a toggle marco
« on: April 07, 2024, 07:27:59 PM »


id like to set a marco/command sequence and have it toggle on and off using the same key. so far this is what i have.



Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: how do i set a toggle marco
« Reply #1 on: April 07, 2024, 07:49:01 PM »
Hi, junkman

What I'm seeing in your image is you're executing this command by pressing the back button on the mouse, which is then making VoiceAttack click the left mouse button five times with a slight pause between each click.

Could you describe in detail what it is you are trying to accomplish?

junkman

  • Newbie
  • *
  • Posts: 5
Re: how do i set a toggle marco
« Reply #2 on: April 10, 2024, 08:25:07 PM »
im trying to have voice attack automatically click the left mouse button repeatedly every 1.2 seconds when i press the back button or whatever button i assign the command to, and then stop once i press that button again.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: how do i set a toggle marco
« Reply #3 on: April 11, 2024, 01:23:18 AM »
A command like that could look like this:
Code: [Select]
Begin Text Compare : [{CMDALREADYEXECUTING}] Equals '1'
    Kill command, 'New Command' (by name)
End Condition - Exit when condition met
Start Indefinite Loop
    Click left mouse button [duration 0.05 seconds]
    Pause 1.2 seconds
End Loop

In this example I did swap the timings of the click and the pause, as you mention you want to "click the left mouse button repeatedly every 1.2 seconds".
If you instead want to hold down the left mouse button for 1.2 seconds even 50ms, you'd want to swap them back to what they are in your screenshot.

junkman

  • Newbie
  • *
  • Posts: 5
Re: how do i set a toggle marco
« Reply #4 on: April 12, 2024, 08:18:55 PM »
I actually need it to press and hold the mouse button for 1.2 seconds, i said the wrong thing in my post.

also where do i paste that text??

i asked bard to help me and this is what i got;

Code: [Select]
Start Loop While : Left Mouse Button Is Pressed
  ; Simulate holding the button
  Click left mouse button
  Pause 1.1  ; Adjust for 1.2 seconds hold (1000 milliseconds = 1 second)
End Loop

; Simulate releasing the button for 0.05 seconds
Pause 0.05

A command like that could look like this:
Code: [Select]
Begin Text Compare : [{CMDALREADYEXECUTING}] Equals '1'
    Kill command, 'New Command' (by name)
End Condition - Exit when condition met
Start Indefinite Loop
    Click left mouse button [duration 0.05 seconds]
    Pause 1.2 seconds
End Loop

In this example I did swap the timings of the click and the pause, as you mention you want to "click the left mouse button repeatedly every 1.2 seconds".
If you instead want to hold down the left mouse button for 1.2 seconds even 50ms, you'd want to swap them back to what they are in your screenshot.

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 291
  • Upstanding Lunatic
    • My AVCS Homepage
Re: how do i set a toggle marco
« Reply #5 on: April 12, 2024, 09:23:49 PM »
I actually need it to press and hold the mouse button for 1.2 seconds, i said the wrong thing in my post.

also where do i paste that text??

You don't paste that text anywhere.  It is a visual example of the types of actions that you would add to your command in order to produce behavior similar to what you described previously.  You would use it as a guide for which actions to add adjusting as needed the variable names and/or command to "kill" in your own actions in your command(s).

junkman

  • Newbie
  • *
  • Posts: 5
Re: how do i set a toggle marco
« Reply #6 on: April 13, 2024, 08:37:07 PM »
ok t hen, how do i setup the back button to trigger/kill the command with the same button?

I actually need it to press and hold the mouse button for 1.2 seconds, i said the wrong thing in my post.

also where do i paste that text??

You don't paste that text anywhere.  It is a visual example of the types of actions that you would add to your command in order to produce behavior similar to what you described previously.  You would use it as a guide for which actions to add adjusting as needed the variable names and/or command to "kill" in your own actions in your command(s).

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 291
  • Upstanding Lunatic
    • My AVCS Homepage
Re: how do i set a toggle marco
« Reply #7 on: April 13, 2024, 08:48:38 PM »
ok t hen, how do i setup the back button to trigger/kill the command with the same button?

By creating a command that is triggered by pressing the back button, and then using the visual example provided by Pfeil above to add these actions as shown to this command.

junkman

  • Newbie
  • *
  • Posts: 5
Re: how do i set a toggle marco
« Reply #8 on: April 14, 2024, 03:03:08 PM »
ok im getting the hang of this, but stuck on the first part. how do i get

Code: [Select]
Begin Text Compare : [{CMDALREADYEXECUTING}] Equals '1'
    Kill command, 'New Command' (by name)


single condition or compound condition builder?



also should i have it set to 'execute only once' or 'repeat continuously until stopped'?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: how do i set a toggle marco
« Reply #9 on: April 15, 2024, 12:59:41 AM »
how do i get
Code: [Select]
Begin Text Compare : [{CMDALREADYEXECUTING}] Equals '1'
    Kill command, 'New Command' (by name)
Add the "Stop Another Command" action under the "Begin a Conditional (If Statement) Block" action.

single condition or compound condition builder?
Single. The condition builder is intended for evaluating more than one statement; in this case you only need one.

also should i have it set to 'execute only once' or 'repeat continuously until stopped'?
"Execute only once"

That's what the loop is for: it causes a specific set of actions to repeat (I.E. the ones between its start and end actions)


You also have an extra "End a Conditional Block" action at the bottom of the command that should be removed, but normally you shouldn't be able to save the command in that state anyway.