Author Topic: How to repeat a down click, based on a variable in a text file.  (Read 2845 times)

DNA-Decay

  • Guest
How to repeat a down click, based on a variable in a text file.
« on: October 19, 2018, 06:24:33 PM »
Hi,

Total noob question here:
This doesn't need voice integration, happy to run this from a keypress.

I am trying to get a traffic report from Elite Dangerous every half hour, but so far I'm only working from the Voice Attack GUI.

I've made a single command (? not even sure of naming conventions here) and exported just that as a whole profile (attached).

At the moment, the trafic report is twenty clicks down in its menu. But that order changes twice daily. Sometimes it's five clicks or even just two.
So I have to edit the command at least twice a day.

What I want is to have the command read a text file that has a single numerical entry for how many down clicks to trigger, So I can leave the Voice Attack command alone and just edit the text file.

I don't even have Singularity installed, as I just need this one thing, which should be straight forward, but I can't see my way to the first step.


Ultimately I would want an Optical Character Recognition app to "look" at each down click and when it finds the word "Traffic" to select and get the traffic report, but that seems like a steep learning curve for a single task. I'm not even sure what would be a good OCR choice. I've been told that "Open CV can do this" but I would have to devote a lot of time to that puzzle box. What I am thinking is like an OCR app that watches a particular folder and when a new screen shot comes in it looks just in one area for the word "traffic" and then writes something to the text file above. So ideally a commercially available software with a friendly GUI.

I hope that makes sense and that you can help me to:
1) Pass a variable to a command.
2) Reccomend a noob friendly OCR app.

Thanks.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: How to repeat a down click, based on a variable in a text file.
« Reply #1 on: October 20, 2018, 02:49:58 AM »
You could use a text file, but you could also set this variable using a voice command.

Using a text file would look something like:
Code: [Select]
Press Back key and hold for 0,1 seconds and release
Pause 2 seconds
Press Back key and hold for 0,1 seconds and release
Pause 2 seconds
Press Space key and hold for 0,1 seconds and release
Pause 10 seconds
Press Right key and hold for 0,1 seconds and release
Pause 0,2 seconds
Set Text [~trafficMenuItemPos] to [{VA_APPS}\trafficMenuItemPos.txt]
Start Loop : Repeat [{TXTNUM:~trafficMenuItemPos}] Times
Press Down key and hold for 0,1 seconds and release
Pause 0,2 seconds
End Loop
Press Space key and hold for 0,1 seconds and release
Pause 2 seconds
Press F10 key and hold for 0,1 seconds and release
Pause 0,2 seconds
Press Down key and hold for 0,1 seconds and release
Pause 0,2 seconds
Press Down key and hold for 0,1 seconds and release
Pause 0,2 seconds
Press Down key and hold for 0,1 seconds and release
Pause 0,2 seconds
Press F10 key and hold for 0,1 seconds and release
Pause 0,5 seconds
Press Back key and hold for 0,1 seconds and release
Pause 900 seconds
Pause 900 seconds


Using a variable instead:
Code: [Select]
Begin Integer Compare : [trafficMenuItemPos] Has Not Been Set
    Write [Red] 'Traffic menu item position unknown, use "traffic is now menu item" to set it' to log
    Say, 'Traffic menu item position unknown, use "traffic is now menu item" to set it'
End Condition - Exit when condition met
Press Back key and hold for 0,1 seconds and release
Pause 2 seconds
Press Back key and hold for 0,1 seconds and release
Pause 2 seconds
Press Space key and hold for 0,1 seconds and release
Pause 10 seconds
Press Right key and hold for 0,1 seconds and release
Pause 0,2 seconds
Start Loop : Repeat [trafficMenuItemPos] Times
    Press Down key and hold for 0,1 seconds and release
    Pause 0,2 seconds
End Loop
Press Space key and hold for 0,1 seconds and release
Pause 2 seconds
Press F10 key and hold for 0,1 seconds and release
Pause 0,2 seconds
Press Down key and hold for 0,1 seconds and release
Pause 0,2 seconds
Press Down key and hold for 0,1 seconds and release
Pause 0,2 seconds
Press Down key and hold for 0,1 seconds and release
Pause 0,2 seconds
Press F10 key and hold for 0,1 seconds and release
Pause 0,5 seconds
Press Back key and hold for 0,1 seconds and release
Pause 900 seconds
Pause 900 seconds

With a voice command like
Traffic is now menu item [1..20]
Code: [Select]
Set integer [trafficMenuItemPos] value to the converted value of {EXP: {TXTNUM:"{CMD}"} -1}

You could also use a saved value instead, so the last setting will be retained if you close VoiceAttack.



OCR is nice in theory, but regular OCR applications, especially ones that are freely available and "user friendly", are designed to recognize high-contrast(black on white), crisp text, and will likely not even "see" anything else.

On top of that, in a multiplayer game, as you're using data not provided through an official API, it may be seen as a violation of the EULA.
« Last Edit: October 22, 2018, 01:13:20 AM by Pfeil »

DNA-Decay

  • Guest
Re: How to repeat a down click, based on a variable in a text file.
« Reply #2 on: October 21, 2018, 11:35:54 PM »
Thanks Pfeil,

My problem is - as I noted above - that I'm still at the GUI.

So while I can read the code you've put up, and it makes sense. I don't know how to get it into Voice Attack.
For example I think using a saved value is a good approach, but how do I enter the code you suggest.
 Begin Integer Compare : [trafficMenuItemPos] Has Not Been Set
Do I have to set that through the GUI, in which case what menu path am I selecting:
Actually a bit of poking and I think I found it here:
[spoiler]
[/spoiler]

But in the pop up window there are a number of settings, for example equal to, oh wait I found it.
Has Not Been Set

Okay and I've found the menu path to:
    Say, 'Traffic menu item position unknown, use "traffic is now menu item" to set it'

But where is the menu path to create a step:
    Write 'Traffic menu item position unknown, use "traffic is now menu item" to set it' to log
I just can't find that.


And is there a way to write up the code directly, like for example it looks like you pulled your code from a file somewhere, but nothing looks like that in the VAP file, which is - pretty opaque to me at the moment.


Re: the EULA thing and OCR.
Absolutely I agree.
For me that's the line in the sand and I want to stay on this side of it.

I can give you some background on why we need automated traffic reports if you want, but we do have open tickets with the developer and they are aware that we have to automate to get the sample resolution they need.
A lot of folks really appreciate your help with this.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: How to repeat a down click, based on a variable in a text file.
« Reply #3 on: October 22, 2018, 01:49:48 AM »
I think using a saved value is a good approach
That example does not actually feature a saved value. It did, but I changed it to a regular variable, overlooking that "Using a saved value instead:" was still present.

is there a way to write up the code directly, like for example it looks like you pulled your code from a file somewhere, but nothing looks like that in the VAP file, which is - pretty opaque to me at the moment.
Anything that isn't an inline function is set up through the GUI, using the menu system. What I post is the contents of the action list, verbatim(right-click the action list and click "Copy All as Text" in the context menu).

You can add the modifications as follows:

Click "Other >", "Advanced ⯈", "Begin a Conditional(If Statement) Block ⯈", "Single Condition"
Click the "Integer" tab(not "Small Integer")
In the "Variable Name" field, enter "trafficMenuItemPos"
In the dropdown, select "Has Not Been Set"
Click "OK"

Click "Other >", "Advanced ⯈", "Write a Value to the Event Log"
In the "Value" field, enter "Traffic menu item position unknown, use "traffic is now menu item" to set it"
In the "Color" dropdown, select "Red"
Click "OK"

Click "Other >", "Advanced ⯈", "Sounds ⯈", "Say Something with Text-To-Speech"
In the text field, enter "Traffic menu item position unknown, use "traffic is now menu item" to set it"
Click "OK"

What you have added up until now should be at the very top of the command, with no other actions preceding it.

Double-click the "End Condition" action in the action list to edit it
Check "When this block is reached, exit command if condition is met"
Click "OK"


Lower down on the action list, select all but one set of the consecutive
Code: [Select]
Press Down key and hold for 0,1 seconds and release
Pause 0,2 seconds
actions, and delete them(either press the "Del"/"Delete" key on your keyboard, or right-click your selection and click "Delete" in the context menu)

Select the remaining
Code: [Select]
Press Down key and hold for 0,1 seconds and release
Pause 0,2 seconds
actions
Click "Other >", "Advanced ⯈", "Add a Loop Start ⯈", "Repeat Certain Number of Times (For Loop)"
In the "Number of times" field, enter "trafficMenuItemPos"
Click "OK"

The added loop actions should automatically be placed around your selection.

Click "OK" to close the "Edit a Command" window


Click "New Command" on the top right of the "Edit a Profile" window
In the "When I say" field, enter "Traffic is now menu item [1..20]"

Click "Other >", "Advanced ⯈", "Set an Integer Value"
In the "Variable Name" field, enter "trafficMenuItemPos"
Click the "Convert Text/Token radio button
In the "Convert Text/Token" field, enter "{TXTNUM:"{CMD}"}"
Click "OK"

Click "OK" to close the "Add a Command" window

Click "Done" on the bottom right of the "Edit a Profile" window to save the changes

DNA-Decay

  • Guest
Re: How to repeat a down click, based on a variable in a text file.
« Reply #4 on: October 22, 2018, 05:24:45 AM »
Awesome.
Thanks for the detailed response.
Actually I’d found some of the ways that menus work with a bit of “I wonder what this button does”
I’ll get used to it, as I find more uses for it.

Actually I’ve got some things I can do at work with this if I can pipe information from Outlook Calendars into web booking forms.

So just to understand how this works:
The first statement sets our variable to “not set”
Then there is a text and voice prompt for user input.
The command then pauses until the user calls the Other command to set the variable.
When the variable is set the command proceeds.

Now when I look at how you are writing the command to set the variable, it doesn’t quite match my expectations.
I don’t actually want to talk to the computer, as it wakes up the family, but I’m happy to have the Computer talk to me.
So what I am guessing is that I should:
Create a new command and assign a key.
But then I want to have Voice Attack accept a numerical keyboard input to assign to the variable.
So what GUI choices would I use for that?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: How to repeat a down click, based on a variable in a text file.
« Reply #5 on: October 22, 2018, 06:05:36 AM »
So just to understand how this works:
The first statement sets our variable to “not set”
Then there is a text and voice prompt for user input.
The command then pauses until the user calls the Other command to set the variable.
When the variable is set the command proceeds.
No...

The condition checks whether the provided statement of "integer variable 'trafficMenuItemPos' has a value of 'Not Set'" is true.
If it is true, a message will be written to the log and spoken using text-to-speech, telling the user the value must be set before using the command, and the command will stop without doing anything else.

If the other command is used to set the variable, executing the command again will result in the statement evaluating to false, meaning the command does not stop and the keypresses are sent.


Now when I look at how you are writing the command to set the variable, it doesn’t quite match my expectations.
I don’t actually want to talk to the computer, as it wakes up the family, but I’m happy to have the Computer talk to me.
So what I am guessing is that I should:
Create a new command and assign a key.
But then I want to have Voice Attack accept a numerical keyboard input to assign to the variable.
So what GUI choices would I use for that?

If you want to use keyboard input, you can use a "Get User Input" action to pop up a window into which you can enter a value.

E.G.
Code: [Select]
Get Integer Input [trafficMenuItemPos]
Set integer [trafficMenuItemPos] to [trafficMenuItemPos] minus 1

The first action can be found under "Other >", "Advanced ⯈", "Get User Input ⯈", "Get Integer".

DNA-Decay

  • Guest
Re: How to repeat a down click, based on a variable in a text file.
« Reply #6 on: November 04, 2018, 04:57:56 PM »
Thanks for help so far.

Haven't been able to stay on top of this because of IRL stuff, but I made some progress today.
I'm now at the point where the command asks the user for input to set 3 variables:
The position of the traffic menu.
How many screens full of traffic there will be.
And how many traffic reports to get.
And it seems to be working happily - Yay first macro!

But.

I have two problems now.
1) The pop up window doesn't have focus - So I press the command to go, the pop up window stays on top, but I have to click on it with a mouse before I can enter any data.

2) I want to use saved values, so that for example F6 quizzes the user to define the values for the variables, but F7 reports what the saved values are and just uses them.

Can you brief me on how Voice Attack does a saved variable, you've mentioned it a couple of times - also I'm happy to work from a primer if there is any documentation available.
I kinda feel like I'm humbugging you guys.

Code: [Select]
Say, 'Traffic Menu Item is how many down clicks? '
Get Integer Input [TrafficMenuItemPos]
Say, 'How Many Screengrabs of traffic do you need? '
Get Integer Input [NumScreenGrabs]
Say, 'How many Traffic Reports do you want? '
Get Integer Input [NumTrafficReports]
Start Loop : Repeat [NumTrafficReports] Times
Press Back key and hold for 0.1 seconds and release
Pause 0.2 seconds
Press Back key and hold for 0.1 seconds and release
Pause 2 seconds
Press Space key and hold for 0.1 seconds and release
Pause 10 seconds
Press Right key and hold for 0.1 seconds and release
Pause 0.2 seconds
Start Loop : Repeat [TrafficMenuItemPos] Times
Press Down key and hold for 0.1 seconds and release
Pause 0.2 seconds
End Loop
Press Space key and hold for 0.1 seconds and release
Pause 0.2 seconds
Start Loop : Repeat [NumScreenGrabs] Times
Press F10 key and hold for 0.1 seconds and release
Pause 0.2 seconds
Start Loop : Repeat 3 Times
Press Down key and hold for 0.1 seconds and release
Pause 0.2 seconds
End Loop
End Loop
Pause 0.5 seconds
Press Back key and hold for 0.1 seconds and release
Pause 900 seconds
Pause 900 seconds
End Loop

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: How to repeat a down click, based on a variable in a text file.
« Reply #7 on: November 05, 2018, 01:44:12 PM »
1) The pop up window doesn't have focus - So I press the command to go, the pop up window stays on top, but I have to click on it with a mouse before I can enter any data.
I'm hoping this is covered by one of the workarounds listed here.


2) I want to use saved values, so that for example F6 quizzes the user to define the values for the variables, but F7 reports what the saved values are and just uses them.
Different keys cannot trigger the same command, and having to press two keys every time you run the command(one to trigger, one to select which value to use) doesn't seem ideal either.

I would suggest using a press vs hold system, where pressing the key triggers the command using saved values(if they exist), and holding prompts for new values(which would also happen when pressing without saved values).

Something like this:
Code: [Select]
Set date [~longPressThreshold] to [~longPressThreshold] plus [3] seconds
Set integer [TrafficMenuItemPos] value to [Saved Value]
Set integer [NumScreenGrabs] value to [Saved Value]
Set integer [NumTrafficReports] value to [Saved Value]
Start Loop While :  Keyboard Key 'F6' Is Pressed
    Begin Date Compare : [~longPressThreshold] Is Less Than Or Equals Current Date/Time
        Set integer [TrafficMenuItemPos] value to [Not Set]
        Set integer [NumScreenGrabs] value to [Not Set]
        Set integer [NumTrafficReports] value to [Not Set]
        Loop Break
    End Condition
End Loop
Begin Condition : [TrafficMenuItemPos] Has Not Been Set OR [NumScreenGrabs] Has Not Been Set OR [NumTrafficReports] Has Not Been Set
    Say, 'Traffic Menu Item is how many down clicks?'
    Get Integer Input [TrafficMenuItemPos]
    Set integer [TrafficMenuItemPos] value to the value of [TrafficMenuItemPos] (save value to profile)
    Say, 'How Many Screengrabs of traffic do you need?'
    Get Integer Input [NumScreenGrabs]
    Set integer [NumScreenGrabs] value to the value of [NumScreenGrabs] (save value to profile)
    Say, 'How many Traffic Reports do you want?'
    Get Integer Input [NumTrafficReports]
    Set integer [NumTrafficReports] value to the value of [NumTrafficReports] (save value to profile)
End Condition
Start Loop : Repeat [NumTrafficReports] Times
Press Back key and hold for 0.1 seconds and release
Pause 0.2 seconds
Press Back key and hold for 0.1 seconds and release
Pause 2 seconds
Press Space key and hold for 0.1 seconds and release
Pause 10 seconds
Press Right key and hold for 0.1 seconds and release
Pause 0.2 seconds
Start Loop : Repeat [TrafficMenuItemPos] Times
Press Down key and hold for 0.1 seconds and release
Pause 0.2 seconds
End Loop
Press Space key and hold for 0.1 seconds and release
Pause 0.2 seconds
Start Loop : Repeat [NumScreenGrabs] Times
Press F10 key and hold for 0.1 seconds and release
Pause 0.2 seconds
Start Loop : Repeat 3 Times
Press Down key and hold for 0.1 seconds and release
Pause 0.2 seconds
End Loop
End Loop
Pause 0.5 seconds
Press Back key and hold for 0.1 seconds and release
Pause 900 seconds
Pause 900 seconds
End Loop

The way it's set up:
  • When the command starts, it registers the current time, and adds three seconds to it
  • The relevant saved integer values are retrieved(if they exist, otherwise they remain "Not Set")
  • A loop will check if you hold down F6 ±3 seconds(3 seconds plus the time it takes for the command to start and the actions to run)
  • If F6 was held, the integer values in memory are cleared, however, the saved values are not; This means that if you don't want to overwrite those values, you can stop the command before closing the first "Get User Input - Integer" dialog window and they'll still be there when the command runs again
  • All three value are checked to make sure they're set up(this prevents issues in case  the command is stopped before all three values are set; You could just check the last one, if you prefer, for the same effect)
  • If the values are not set yet(or have been cleared by holding down F6), the command will prompt for them
  • Either after prompting, or immediately if the values were already set, the command proceeds as before.


If you still prefer having separate keys, you can modify the example to something like this:
Clear traffic report parameters
When I press keys : F6
Code: [Select]
Set integer [TrafficMenuItemPos] value to [Not Set] (save value to profile)
Set integer [NumScreenGrabs] value to [Not Set] (save value to profile)
Set integer [NumTrafficReports] value to [Not Set] (save value to profile)
Execute command, 'Get traffic reports'

Get traffic reports
When I press keys : F7
Code: [Select]
Set integer [TrafficMenuItemPos] value to [Saved Value]
Set integer [NumScreenGrabs] value to [Saved Value]
Set integer [NumTrafficReports] value to [Saved Value]
Begin Condition : [TrafficMenuItemPos] Has Not Been Set OR [NumScreenGrabs] Has Not Been Set OR [NumTrafficReports] Has Not Been Set
    Say, 'Traffic Menu Item is how many down clicks?'
    Get Integer Input [TrafficMenuItemPos]
    Set integer [TrafficMenuItemPos] value to the value of [TrafficMenuItemPos] (save value to profile)
    Say, 'How Many Screengrabs of traffic do you need?'
    Get Integer Input [NumScreenGrabs]
    Set integer [NumScreenGrabs] value to the value of [NumScreenGrabs] (save value to profile)
    Say, 'How many Traffic Reports do you want?'
    Get Integer Input [NumTrafficReports]
    Set integer [NumTrafficReports] value to the value of [NumTrafficReports] (save value to profile)
Else
Say, 'Using position {INT:TrafficMenuItemPos}, taking {INT:NumScreenGrabs} screengrabs, getting {INT:NumTrafficReports} reports.'
End Condition
Start Loop : Repeat [NumTrafficReports] Times
Press Back key and hold for 0.1 seconds and release
Pause 0.2 seconds
Press Back key and hold for 0.1 seconds and release
Pause 2 seconds
Press Space key and hold for 0.1 seconds and release
Pause 10 seconds
Press Right key and hold for 0.1 seconds and release
Pause 0.2 seconds
Start Loop : Repeat [TrafficMenuItemPos] Times
Press Down key and hold for 0.1 seconds and release
Pause 0.2 seconds
End Loop
Press Space key and hold for 0.1 seconds and release
Pause 0.2 seconds
Start Loop : Repeat [NumScreenGrabs] Times
Press F10 key and hold for 0.1 seconds and release
Pause 0.2 seconds
Start Loop : Repeat 3 Times
Press Down key and hold for 0.1 seconds and release
Pause 0.2 seconds
End Loop
End Loop
Pause 0.5 seconds
Press Back key and hold for 0.1 seconds and release
Pause 900 seconds
Pause 900 seconds
End Loop

The latter also reports the current parameters.

Note that this structure does necessitate saving the cleared values beforehand, so you can't back out of the setup to retain them.



Can you brief me on how Voice Attack does a saved variable, you've mentioned it a couple of times - also I'm happy to work from a primer if there is any documentation available.
There is no single section on saved values in the manual, but each type has a section like this:
Quote from: VoiceAttackHelp.pdf page 71
If you want your integer variable to be saved with the active profile, select the, 'Save value to profile' option check box at the bottom). This will allow you to access the value between application sessions (VoiceAttack application is closed and then launched again).

If you check that box, the current value is saved to the profile database. You can later retrieve that value using the "Retrieve saved value" option, which will overwrite whatever value that variable currently holds.

The saved value is not automatically synchronized with the "live" value, I.E. if you change the value without having the "Save value to profile" option checked, the actual value will then differ from the saved value(as seen in the first example).

You can clear a specific saved value either by using the "Clear value (set value to Not Set)" option and checking the "Save value to profile" option, or use the "Clear Saved Values from Profile" to clear all values of a certain type(or multiple types).

Note that saved values are not included in exported .vap files, so they will always be "Not Set" after importing that profile.



I would have gotten this to you earlier, but the server hosting VoiceAttack.com started returning error 500 as I wanted to submit the post.

DNA-Decay

  • Guest
Re: How to repeat a down click, based on a variable in a text file.
« Reply #8 on: November 06, 2018, 01:47:05 AM »
THanks heaps for your efforts on this.
i don't mean to leach your time.
For example - if it's in the manual - just point me at the the section.
But I really do appreciate the specific and detailed explanations.

I think I've got this fairly tidy for the minute.
I like the check for "Not Set" and I also added one for "Out of date values" because you don't want to keep using yesterday's menu numbers as they won't work.

This is how it ended up, I haven't run it for extended periods yet, so I don't know if the "out of date" check works.

A few follow up questions - and feel free to direct me to the manual where it's covered -
1) How do I know what commands are running?
2) how do I stop any running commands?
3) If the Elite Dangerous game returns to the main menu - is there a way for Voice Attack to know that? - I believe it's reported to the API, as other commanders can see when you are at he main menu.
4) Is there a way to trigger a command based on an output from a game?

Last two questions relate to restarting the game if it returns to the main menu.
So when Elite Dangerous drops you out to the main menu, Voice Attack can restart the game.
Trying to make the monitoring more robust.


Code: [Select]
Set integer [TrafficMenuItemPos] value to [Saved Value]
Set integer [NumScreenGrabs] value to [Saved Value]
Set integer [NumTrafficReports] value to [Saved Value]
Set date [WhenTrafficMenuWasSet] value to [Saved Value]
Set date [TooLongAgo] value to the current date/time
Pause 0.2 seconds
Set date [TooLongAgo] to [TooLongAgo] plus [-24] hours
Append, '
Traffic menu saved value is {INT:TrafficMenuItemPos}.
Screen Grabs saved value is {INT:NumScreenGrabs}.
Reports saved value is {INT:NumTrafficReports}.
Those ...
Begin Condition : [TrafficMenuItemPos] Has Not Been Set OR [NumScreenGrabs] Has Not Been Set OR [NumTrafficReports] Has Not Been Set OR [WhenTrafficMenuWasSet] Is Less Than Or Equals [TooLongAgo]
    Say, 'Please set up the traffic report menu selection variables in the pop up windows.'
    Get Integer Input [TrafficMenuItemPos]
    Pause 0.2 seconds
    Set integer [TrafficMenuItemPos] value to the value of [TrafficMenuItemPos] (save value to profile)
    Get Integer Input [NumScreenGrabs]
    Pause 0.2 seconds
    Set integer [NumScreenGrabs] value to the value of [NumScreenGrabs] (save value to profile)
    Get Integer Input [NumTrafficReports]
    Pause 0.2 seconds
    Set integer [NumTrafficReports] value to the value of [NumTrafficReports] (save value to profile)
    Pause 0.2 seconds
    Set date [WhenTrafficMenuWasSet] value to the current date/time (save value to profile)
Else
    Say, 'Traffic is menu item number {INT:TrafficMenuItemPos}. Traffic is spread over {INT:NumScreenGrabs} pages. {INT:NumTrafficReports} half-hourly reports will be generated. Press F7 to reset.'
End Condition
Start Loop : Repeat [NumTrafficReports] Times
    Press Back key and hold for 0.1 seconds and release
    Pause 0.2 seconds
    Press Back key and hold for 0.1 seconds and release
    Pause 2 seconds
    Press Space key and hold for 0.1 seconds and release
    Pause 10 seconds
    Press Right key and hold for 0.1 seconds and release
    Pause 0.2 seconds
    Start Loop : Repeat [TrafficMenuItemPos] Times
        Press Down key and hold for 0.1 seconds and release
        Pause 0.2 seconds
    End Loop
    Press Space key and hold for 0.1 seconds and release
    Pause 0.5 seconds
    Start Loop : Repeat [NumScreenGrabs] Times
        Press F10 key and hold for 0.1 seconds and release
        Pause 0.2 seconds
        Start Loop : Repeat 3 Times
            Press Down key and hold for 0.1 seconds and release
            Pause 0.2 seconds
        End Loop
    End Loop
    Pause 0.3 seconds
    Press Back key and hold for 0.1 seconds and release
    Start Loop : Repeat 6 Times
        Pause 300 seconds
        Press Back key and hold for 0.1 seconds and release
        Pause 0.2 seconds
        Press Back key and hold for 0.1 seconds and release
        Pause 0.3 seconds
    End Loop
End Loop

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: How to repeat a down click, based on a variable in a text file.
« Reply #9 on: November 06, 2018, 02:40:15 AM »
1) How do I know what commands are running?
There is no method for obtaining a list of them, as far as I'm aware(when stopping all commands, you do get a list of which ones were stopped in the log, but that defeats the point), however you can check for specific ones using a token:
Quote from: VoiceAttackHelp.pdf page 132
{CMDACTIVE:name} - This provides a way to test if a command is currently active.
Simply provide the command name (spoken phrase), and the rendered value will be, ‘1’ if the command is active, or ‘0’ if not. Ex: {CMDACTIVE:fire weapon} will check to see if the command, ‘fire weapon’ is active.


2) how do I stop any running commands?

Aside from clicking the button on VoiceAttack's main window, or using a hotkey, there are two actions available:

Quote from: VoiceAttackHelp.pdf page 35
'Stop Another Command'
This option will let you specify a certain command that needs to be stopped. You will want to use this in conjunction with commands that loop or commands that have long-running macros. In earlier versions of VoiceAttack, the only way to stop running commands was to hit the, 'Stop Commands' button. Now you can indicate specific commands. NOTE - all instances of a command will be stopped, so, if you have multiple instances of a looping, asynchronous command, calling this will stop ALL instances.

Quote from: VoiceAttackHelp.pdf page 32
'Make VoiceAttack Stop Processing All Commands'
Use this to stop all currently-processing commands. This works the same way as clicking the 'Stop Commands' button on the Main Screen. Note that this command action will only execute if your currently-executing command allows for other commands to run at the same time (see, 'Command Screen' - 'This command allows other commands to run at the same time' option). Note this will also stop any playing sounds or text-to-speech, and any keys that are pressed down will be released.


3) If the Elite Dangerous game returns to the main menu - is there a way for Voice Attack to know that? - I believe it's reported to the API, as other commanders can see when you are at he main menu.
Not natively, but if it's available through an API you could write a plugin to communicate with the game directly(which is how HCS Voice Packs and EDDI work).

Though keep in mind that just because something is synchronized over the network does not mean it's exposed through a user-facing API.


4) Is there a way to trigger a command based on an output from a game?
"An output" is very broad, but if the information is made available, a plugin that uses the "ExecuteCommand()" function could accomplish that.