Author Topic: How to add a sound in the end of repeating commands  (Read 2572 times)

johnliem

  • Newbie
  • *
  • Posts: 49
How to add a sound in the end of repeating commands
« on: November 23, 2017, 11:29:33 AM »
Hello

I make a repeating commands,  what I want to know How to add a sound in the end of repeating commands for example I make 10  repeating commands what I want  is, to add a sound so I know that the repeating commands is finished. thanks

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: How to add a sound in the end of repeating commands
« Reply #1 on: November 23, 2017, 05:43:00 PM »
You'll have to either switch to an action-based loop(which is a lot easier in newer versions of VoiceAttack as you can use a For loop to specify the repeat count), or use a variable to keep track of the repeat iterations with a condition that plays a sound when that variable reaches a certain value.

Option A:
Code: [Select]
Start Loop : Repeat 10 Times
Write '[Blue] This will execute 10 times' to log
End Loop
Play sound, 'C:\Windows\Media\ding.wav'

Option B:
Code: [Select]
Write '[Blue] This command also executes 10 times, using the "This command repeats" option' to log
Set integer [~repeatCount] to [~repeatCount] plus 1
Begin Integer Compare : [~repeatCount] Equals 10
    Play sound, 'C:\Windows\Media\ding.wav'
End Condition
The "~" character prefixed to the variable name denotes a command-scoped variable, meaning it is always "Not Set" when the command starts, and can be different when running multiple instances of the same command simultaneously(so one command instance won't affect the other).

johnliem

  • Newbie
  • *
  • Posts: 49
Re: How to add a sound in the end of repeating commands
« Reply #2 on: November 24, 2017, 12:09:44 AM »
Thanks , I will give it a go.

johnliem

  • Newbie
  • *
  • Posts: 49
Re: How to add a sound in the end of repeating commands
« Reply #3 on: November 24, 2017, 10:07:51 AM »
Thanks pfeil, it works fine now.