Author Topic: Force quick input to use num pad keyboard  (Read 980 times)

mnf1980

  • Newbie
  • *
  • Posts: 15
Force quick input to use num pad keyboard
« on: April 23, 2020, 06:04:01 PM »
Hi
this is my first post here,
I want to use quick input to put some numbers in my game.
how can I force quick input to use numeric keypad rather than the regular one?

for example, I add "123" in "Quick Input" and it return 1..2..3, but I want it to use numeric keypad NUM1..NUM2..NUM3 ....

regards

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Force quick input to use num pad keyboard
« Reply #1 on: April 23, 2020, 06:11:32 PM »
Press F1 while VoiceAttack has focus to open VoiceAttackHelp.pdf in your default PDF viewer.

Use the search function of your PDF reader to find the "'Quick Input'" section, and the "Quick Input, Variable Keypress and Hotkey Key Indicators" section it references.

mnf1980

  • Newbie
  • *
  • Posts: 15
Re: Force quick input to use num pad keyboard
« Reply #2 on: April 23, 2020, 06:24:17 PM »
Thanks, Pfeil for your prompt response,

unfortunately, I spend around 8 hours till now to figure out how this will work but with no chance.

I'm trying to use dictation mode to store my numbers and then I want AV to write this numbers in BMS game.
BMS only accept the numbers from Numpad.

example: I'm using this command :
425
Code: [Select]
Quick Input, '{DICTATION}'
the output is 4,2,5
I want to output to pe NUM4,NUM2,NUM5

thanks again.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Force quick input to use num pad keyboard
« Reply #3 on: April 23, 2020, 06:28:33 PM »
Ah, you're using dictation. That's an important detail you initially left out.

In that case, you'd have to run a for loop over the dictation output to add the prefix "[NUM" and the suffix "]" to every character. To make sure you only get numbers, run the dictation output through the "{TXTNUM:}" token before parsing it with the loop.


This inline function will do that:
Code: [Select]
using System;
using System.Text;

public class VAInline
{
public void main()
{
char[] characters = VA.GetText("~input").ToCharArray();
if (characters.Length == 0)
{
VA.WriteToLog("Parsing error: No input provided", "red");
return;
}

StringBuilder sb = new StringBuilder();
foreach (char c in characters)
{
sb.Append("[NUM");
sb.Append(c);
sb.Append("]");
}

VA.SetText("~output", sb.ToString());
}
}

Set a text variable named "~input" to the characters you want to wrap, run the inline function (making sure "Wait for the inline function to finish before continuing" is checked), and use the "~output" variable in the "Quick Input" action (by wrapping it in the appropriate token for a text variable.

mnf1980

  • Newbie
  • *
  • Posts: 15
Re: Force quick input to use num pad keyboard
« Reply #4 on: April 23, 2020, 07:05:17 PM »
Thanks, it works finally using your code :D

Code: [Select]
Set text [~DIC] to '{DICTATION}'
Set text [~input] to '{TXTNUM:~DIC}'
Inline C# Function: , wait until execution finishes
Quick Input, '{TXT:~output}'
Write [Blue] '{TXT:~output}' to log