Author Topic: How do I create a voice controlled stop watch?  (Read 9212 times)

jzar

  • Guest
How do I create a voice controlled stop watch?
« on: April 26, 2017, 02:56:43 PM »
I play Star Citizen and do a lot of racing.  The practice area for single player has no stop watch function to mark your lap times. There is timer running but I've got zero time to look at it or record it. So I thought it would be great to be able to use a simple voice attack stopwatch and then output the laps times for each lap.

What I think might work.


Say, Start stopwatch

Start stopwatch with sound, timer is running.

As you pass the start line be able to use a verbal command to mark the end of Lap 1,
then continue up to Lap 100 or a stop  stopwatch command.

Lap times should be presented in 00:00.000 time format. That format is how the data is recorded for Multiplayer laps on the leader boards.

A write to log or buffer, buffer is most likely better as the times could be pasted into a notepad doc and saved.

I'd also like to compare the best lap times from the session and be able to list and output the top 3 fastest lap times.

Even if all it did was write one lap to the event log that would be fine.

Simple form

Start Stopwatch

Call out lap, time is written to event log
call out lap, time is written to event log..etc

Program loops and runs until told to cancel stopwatch.


Any ideas you have would be appreciated.  ;D

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How do I create a voice controlled stop watch?
« Reply #1 on: April 26, 2017, 06:03:52 PM »
I think it's all there:
Start stopwatch
Code: [Select]
Set small int (condition) [intervalcount] value to 0
Set decimal [interval0] value to the converted value of {DATETICKS}

Interval
Code: [Select]
Set small int (condition) [intervalcount] value as incremented by 1
Set decimal [interval{SMALL:intervalcount}] value to the converted value of {DATETICKS}
Set decimal [intervaltoprocess] value to the converted value of {EXP: {DEC:interval{SMALL:intervalcount}} - {DEC:interval{EXP:{SMALL:intervalcount} - 1}}}
Inline C# Function: Ticks to Human Readable Time
Write '[Blue] Lap {SMALL:intervalcount}: {TXT:intervalprocessed}' to log

Stop stopwatch
Code: [Select]
Set the path to the output text file here:
Set Text [OutputFile] to 'D:\LapTimes {DATEYEAR}-{DATEMONTHNUMERIC}-{DATEDAY} {TIMEHOUR24}h{TIMEMINUTE}m{TIMESECOND}s.txt'

Begin Small Integer Compare : [intervalcount] Equals 0
    Write '[Red] Error: No lap times to process' to log
End Condition - Exit when condition met
Set decimal [bestlaptime] value to the converted value of {DATETICKS}
Set decimal [secondbestlaptime] value to the converted value of {DATETICKS}
Set decimal [thirdbestlaptime] value to the converted value of {DATETICKS}
Set integer [bestlap] value to 0
Set integer [secondbestlap] value to 0
Set integer [thirdbestlap] value to 0
Start Loop : Repeat From 1 to [{SMALL:intervalcount}]
    Set decimal [intervaltoprocess] value to the converted value of {EXP: {DEC:interval{INT:i}} - {DEC:interval{EXP:{INT:i} - 1}}}
    Inline C# Function: Ticks to Human Readable Time
    Write '[Blue] Lap {INT:i}: {TXT:intervalprocessed}' to log
    Append, 'Lap {INT:i}: {TXT:intervalprocessed}
' to file '{TXT:OutputFile}'
   
    Begin Decimal Compare : [intervaltoprocess] Is Less Than [bestlaptime]
        Set decimal [thirdbestlaptime] value to the value of [secondbestlaptime]
        Set decimal [secondbestlaptime] value to the value of [bestlaptime]
        Set decimal [bestlaptime] value to the value of [intervaltoprocess]
        Set integer [thirdbestlap] value to the value of [secondbestlap]
        Set integer [secondbestlap] value to the value of [bestlap]
        Set integer [bestlap] value to the value of [i]
    Else If Decimal Compare : [intervaltoprocess] Is Less Than [secondbestlaptime]
        Set decimal [thirdbestlaptime] value to the value of [secondbestlaptime]
        Set decimal [secondbestlaptime] value to the value of [intervaltoprocess]
        Set integer [thirdbestlap] value to the value of [secondbestlap]
        Set integer [secondbestlap] value to the value of [i]
    Else If Decimal Compare : [intervaltoprocess] Is Less Than [thirdbestlaptime]
        Set decimal [thirdbestlaptime] value to the value of [intervaltoprocess]
        Set integer [thirdbestlap] value to the value of [i]
    End Condition
End Loop
Set decimal [intervaltoprocess] value to the value of [bestlaptime]
Inline C# Function: Ticks to Human Readable Time
Write '[Blue] Best lap {INT:bestlap}: {TXT:intervalprocessed}' to log
Append, '
Best lap {INT:bestlap}: {TXT:intervalprocessed}
' to file '{TXT:OutputFile}'

Set decimal [intervaltoprocess] value to the value of [secondbestlaptime]
Inline C# Function: Ticks to Human Readable Time
Write '[Blue] Second best lap {INT:secondbestlap}: {TXT:intervalprocessed}' to log
Append, 'Second best lap {INT:secondbestlap}: {TXT:intervalprocessed}
' to file '{TXT:OutputFile}'

Set decimal [intervaltoprocess] value to the value of [thirdbestlaptime]
Inline C# Function: Ticks to Human Readable Time
Write '[Blue] Third best lap {INT:thirdbestlap}: {TXT:intervalprocessed}' to log
Append, 'Third best lap {INT:thirdbestlap}: {TXT:intervalprocessed}
' to file '{TXT:OutputFile}'

"Ticks to Human Readable Time"
Code: [Select]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

public class VAInline
{
public void main()
{

            TimeSpan interval = TimeSpan.FromTicks(Convert.ToInt64(VA.GetDecimal("intervaltoprocess")));
            VA.SetText("intervalprocessed", String.Format("{0:mm}:{0:ss}.{0:fff}", interval));
}
}


Basic operation:
  • Say "Start stopwatch" to register the starting time
  • Say "Interval" for each lap; This will display the last laptime
  • Say "Stop stopwatch" to process all laptimes; This will display each laptime in the log, and at the end the three fastest times. A .txt file will also be generated containing the same information

Make sure to set your preferred path for the output file in the "Stop stopwatch" command.

Because this is epoch-based, there are no loops or timers required to keep track of time, so there is no real need to call "Stop stopwatch" unless you want the output from that. Nothing runs in the background.

I have purposely left out resetting the system when the "Stop stopwatch" command is called, so you can show and store all laptimes and fastest times without ending your run if you'd like.

I didn't compile the C# function(well, I didn't have it produce build output, anyway), but if that bothers you, you can of course do so and use it that way.


All commands are attached so you can import them to your profile.



EDIT:

Two other features you wanted:

Start stopwatch with sound
You can add a "Play a Sound" action to the "Start stopwatch" command if you wish.

continue up to Lap 100 or a stop  stopwatch command.

Easily done with a modification of the Interval command:
Code: [Select]
Set small int (condition) [intervalcount] value as incremented by 1
Set decimal [interval{SMALL:intervalcount}] value to the converted value of {DATETICKS}
Set decimal [intervaltoprocess] value to the converted value of {EXP: {DEC:interval{SMALL:intervalcount}} - {DEC:interval{EXP:{SMALL:intervalcount} - 1}}}
Inline C# Function: Ticks to Human Readable Time
Begin Small Integer Compare : [intervalcount] Equals 100
    Write '[Black] Lap 100 reached, stopping.' to log
    Execute command, 'Stop stopwatch'
End Condition - Exit when condition met
Write '[Blue] Lap {SMALL:intervalcount}: {TXT:intervalprocessed}' to log
« Last Edit: April 26, 2017, 06:14:47 PM by Pfeil »

jzar

  • Guest
Re: How do I create a voice controlled stop watch?
« Reply #2 on: April 26, 2017, 07:22:48 PM »
Holy wow!
Pfeil thank you so much.

I'm getting to work on this now. I'll let you know if (when) I screw it up :)

Looks fantastic!

I hope to learn more of how to do these kinds of things. I'm only getting there slowly and this much is beyond what I know how to do.

This is going to be very good. I'll let you know when I hit the top ten !

j

added the 100 lap count
« Last Edit: April 26, 2017, 08:08:03 PM by jzar »

jzar

  • Guest
Re: How do I create a voice controlled stop watch?
« Reply #3 on: April 26, 2017, 08:36:20 PM »
Things are working, still we've got a bug perhaps.

Voice Attack has now crashed x2 while running the program.

I think I need to be able to use the C code and that's causing the problem.

When I imported the interval command it wasn't happy about it and gave me a warning.

The start stopwatch and interval worked as expected! wonderful! printed to log, haven't been able to test the .txt file write yet.

v1.6.1.34 Voice Attack Version
System Spec;

Windows 7

Samsung Solid State Drives,

disk C; primary, [3] 900 GB
disk D; Data Drive, [2] 250 G
disk F; Animation 01, [1] 1,863 GB
disk G; Project Drive 01, 3,725 GB

Motherboard;  Gigabytye ATX
--Intel LGZ 1151 Sta E , 6 Gbit/s,  DDR4, [Ga-Z170X -Gaming 7]

Intel Core i7 6700K 4.00 GHz Unlocked Quad Core Skylake Desktop Processor, LGA 1151 with a Water Cooler fan; Cooler Master Hyper 212 EVO

RAM: Corsair Vengenance LPX [4 x 8GB] 32 GB,  DDR4 SDram, 2666 MHz, PC4-21300, C16 memory kit DDR4 Sstem

Graphics Card; Geforce GTX 1080, $589.99
-Gaming  -8GD Video Graphics Card
-Driver; 376.53
Display Memory: 4095 MB
Dedicated Memory: 3072 MB

-Gigabyte GeForce GTX 1080 Windforce 3X, active fan
 Integrated with 8GB gddr5x 256bit Memory
Boost: 1860 MHz / base: 1721 MHz in OC mode
Boost: 1835 MHz / base: 1695 MHz in gaming mode
Support up to 8K Display @60Hz (Requires 2*dp1.3 connectors)

other;
Control fan active with MSI After Burner

Events
Code: [Select]
Faulting application name: VoiceAttack.exe, version: 1.6.1.34, time stamp: 0x58b85605
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc0000005
Fault offset: 0x07953dc9
Faulting process id: 0x1210
Faulting application start time: 0x01d2bed27415b921
Faulting application path: C:\Program Files (x86)\VoiceAttack\VoiceAttack.exe
Code: [Select]
Application: VoiceAttack.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.

Code: [Select]
System.NullReferenceException: Object reference not set to an instance of an object.
   at VoiceAttack.frmMain.(String , Command )
   at VoiceAttack.frmMain.(String , Command )
   at VoiceAttack.frmMain.(Command , CommandAction )
   at VoiceAttack.frmMain.(Command , Process , Boolean , Boolean , Int32 , Boolean , Nullable`1 , Guid , Guid , List`1 )
   at VoiceAttack.frmMain.”.()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
« Last Edit: April 26, 2017, 08:42:03 PM by jzar »

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: How do I create a voice controlled stop watch?
« Reply #4 on: April 26, 2017, 09:23:55 PM »
Quote
Holy wow!

No kidding o_O

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How do I create a voice controlled stop watch?
« Reply #5 on: April 27, 2017, 11:04:32 AM »
Voice Attack has now crashed x2 while running the program.
Strange. The C# snippet is pretty simple, not sure how it would make VoiceAttack itself crash.

Try checking the "Wait for the inline function to finish before continuing" option for all of the "Inline Function" actions, and see if it still crashes.

When I imported the interval command it wasn't happy about it and gave me a warning.
Which warning?

jzar

  • Guest
Re: How do I create a voice controlled stop watch?
« Reply #6 on: April 27, 2017, 12:46:46 PM »
Quote
Which warning?

This is the warning;

Quote
The command you are trying to copy to another profile contains 'Execute Another Command' actions(subcommands) that reference commands by their internal id. This is not currently supported. In order to copy a command that contains subcommands, the 'Execute Another Command' action must execute the subcommand by name only. Otherwise, you will need to recreate the command in the destinatino profile, Sorry!

I suppose I should have read it better but the first time I saw this I had hit ok by accident and couldn't figure out how to bring it up again.

Seem a likely suspect.


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How do I create a voice controlled stop watch?
« Reply #7 on: April 27, 2017, 01:15:18 PM »
The file I attached does not contain any "Execute Another Command" actions.

Was this the first message you saw?:
Quote
Your command selection contains actions that execute applications and/or kill processes and/or have compiled inline functions. This is potentially dangerous to your system. Import anyways?


If you added the check for 100 laps to the Interval command afterwards, that's what's generating the message you posted. You can temporarily(or permanently) set the "Execute Another Command" action to the "Execute by name (Advanced)" option and type "Stop stopwatch" into the textbox, to allow the command to be copied to to another profile.

jzar

  • Guest
Re: How do I create a voice controlled stop watch?
« Reply #8 on: April 27, 2017, 01:21:49 PM »


Quote
Your command selection contains actions that execute applications and/or kill processes and/or have compiled inline functions. This is potentially dangerous to your system. Import anyways?

Yes, you have it right. That indeed was the first message.

jzar

  • Guest
Re: How do I create a voice controlled stop watch?
« Reply #9 on: April 27, 2017, 01:35:24 PM »
Quote
If you added the check for 100 laps to the Interval command afterwards, that's what's generating the message you posted. You can temporarily(or permanently) set the "Execute Another Command" action to the "Execute by name (Advanced)" option and type "Stop stopwatch" into the textbox, to allow the command to be copied to to another profile.

Ok, did that, check.

I cause VA to crash to desktop when running Stop stopwatch

I see a problem there: The loop is different from your posted code, I'll make changes to match the posted code and try it out.

The start of loop reads this:

Code: [Select]
Start Loop While : []Equals 0
I'll change it.
Code: [Select]
Set the path to the output text file here:
Set Text [OutputFile] to 'D:\Voice Attack Files\Lap Times {DATEYEAR}-{DATEMONTHNUMERIC}-{DATEDAY} {TIMEHOUR24}h{TIMEMINUTE}m{TIMESECOND}s.txt'

Begin Small Integer Compare : [intervalcount] Equals 0
    Write '[Red] Error: No lap times to process' to log
    Say, 'Error! no lap times to process'
End Condition - Exit when condition met
Set decimal [bestlaptime] value to the converted value of {DATETICKS}
Set decimal [secondbestlaptime] value to the converted value of {DATETICKS}
Set decimal [thirdbestlaptime] value to the converted value of {DATETICKS}
Set integer [bestlap] value to 0
Set integer [secondbestlap] value to 0
Set integer [thirdbestlap] value to 0
Start Loop While : [{SMALL:intervalcount}] Equals '1'
    Set decimal [intervaltoprocess] value to the converted value of {EXP: {DEC:interval{INT:i}} - {DEC:interval{EXP:{INT:i} - 1}}}
    Inline C# Function: Ticks to Human Readable Time, wait until execution finishes
    Write '[Blue] Lap {INT:i}: {TXT:intervalprocessed}' to log
    Append, 'Lap {INT:i}: {TXT:intervalprocessed}
' to file '{TXT:OutputFile}'
   
    Begin Decimal Compare : [intervaltoprocess] Is Less Than [bestlaptime]
        Set decimal [thirdbestlaptime] value to the value of [secondbestlaptime]
        Set decimal [secondbestlaptime] value to the value of [bestlaptime]
        Set decimal [bestlaptime] value to the value of [intervaltoprocess]
        Set integer [thirdbestlap] value to the value of [secondbestlap]
        Set integer [secondbestlap] value to the value of [bestlap]
        Set integer [bestlap] value to the value of [i]
    Else If Decimal Compare : [intervaltoprocess] Is Less Than [secondbestlaptime]
        Set decimal [thirdbestlaptime] value to the value of [secondbestlaptime]
        Set decimal [secondbestlaptime] value to the value of [intervaltoprocess]
        Set integer [thirdbestlap] value to the value of [secondbestlap]
        Set integer [secondbestlap] value to the value of [i]
    Else If Decimal Compare : [intervaltoprocess] Is Less Than [thirdbestlaptime]
        Set decimal [thirdbestlaptime] value to the value of [intervaltoprocess]
        Set integer [thirdbestlap] value to the value of [i]
    End Condition
End Loop
Set decimal [intervaltoprocess] value to the value of [bestlaptime]
Inline C# Function: Ticks to Human Readable Time, wait until execution finishes
Write '[Blue] Best lap {INT:bestlap}: {TXT:intervalprocessed}' to log
Append, '
Best lap {INT:bestlap}: {TXT:intervalprocessed}
' to file '{TXT:OutputFile}'

Set decimal [intervaltoprocess] value to the value of [secondbestlaptime]
Inline C# Function: Ticks to Human Readable Time, wait until execution finishes
Write '[Blue] Second best lap {INT:secondbestlap}: {TXT:intervalprocessed}' to log
Append, 'Second best lap {INT:secondbestlap}: {TXT:intervalprocessed}
' to file '{TXT:OutputFile}'

Set decimal [intervaltoprocess] value to the value of [thirdbestlaptime]
Inline C# Function: Ticks to Human Readable Time, wait until execution finishes
Write '[Blue] Third best lap {INT:thirdbestlap}: {TXT:intervalprocessed}' to log
Append, 'Third best lap {INT:thirdbestlap}: {TXT:intervalprocessed}
' to file '{TXT:OutputFile}'
Say, 'Stopwatch has been stopped'


I can't seem to match the posted conditions for the loop start, I might just be missing the obvious.

you show

Code: [Select]
Start Loop : Repeat From 1 to [{SMALL:intervalcount}]

« Last Edit: April 27, 2017, 01:54:07 PM by jzar »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How do I create a voice controlled stop watch?
« Reply #10 on: April 27, 2017, 02:08:16 PM »
Aha! That clears things up: You're running a VoiceAttack version older than v1.6.4.2, in which For loops were implemented.

Because that option literally doesn't exist in your version, it's displaying as blank.


Here's the backwards compatible version:
Code: [Select]
Set the path to the output text file here:
Set Text [OutputFile] to 'D:\LapTimes {DATEYEAR}-{DATEMONTHNUMERIC}-{DATEDAY} {TIMEHOUR24}h{TIMEMINUTE}m{TIMESECOND}s.txt'

Begin Small Integer Compare : [intervalcount] Equals 0
    Write '[Red] Error: No lap times to process' to log
End Condition - Exit when condition met
Set decimal [bestlaptime] value to the converted value of {DATETICKS}
Set decimal [secondbestlaptime] value to the converted value of {DATETICKS}
Set decimal [thirdbestlaptime] value to the converted value of {DATETICKS}
Set integer [bestlap] value to 0
Set integer [secondbestlap] value to 0
Set integer [thirdbestlap] value to 0
Set integer [i] value to 0
Start Loop While : [{EXP: {SMALL:intervalcount} = {INT:i}}] Does Not Equal '1'
    Set integer [i] to [i] plus 1
    Set decimal [intervaltoprocess] value to the converted value of {EXP: {DEC:interval{INT:i}} - {DEC:interval{EXP:{INT:i} - 1}}}
    Inline C# Function: Ticks to Human Readable Time
    Write '[Blue] Lap {INT:i}: {TXT:intervalprocessed}' to log
    Append, 'Lap {INT:i}: {TXT:intervalprocessed}
' to file '{TXT:OutputFile}'
   
    Begin Decimal Compare : [intervaltoprocess] Is Less Than [bestlaptime]
        Set decimal [thirdbestlaptime] value to the value of [secondbestlaptime]
        Set decimal [secondbestlaptime] value to the value of [bestlaptime]
        Set decimal [bestlaptime] value to the value of [intervaltoprocess]
        Set integer [thirdbestlap] value to the value of [secondbestlap]
        Set integer [secondbestlap] value to the value of [bestlap]
        Set integer [bestlap] value to the value of [i]
    Else If Decimal Compare : [intervaltoprocess] Is Less Than [secondbestlaptime]
        Set decimal [thirdbestlaptime] value to the value of [secondbestlaptime]
        Set decimal [secondbestlaptime] value to the value of [intervaltoprocess]
        Set integer [thirdbestlap] value to the value of [secondbestlap]
        Set integer [secondbestlap] value to the value of [i]
    Else If Decimal Compare : [intervaltoprocess] Is Less Than [thirdbestlaptime]
        Set decimal [thirdbestlaptime] value to the value of [intervaltoprocess]
        Set integer [thirdbestlap] value to the value of [i]
    End Condition
End Loop
Set decimal [intervaltoprocess] value to the value of [bestlaptime]
Inline C# Function: Ticks to Human Readable Time
Write '[Blue] Best lap {INT:bestlap}: {TXT:intervalprocessed}' to log
Append, '
Best lap {INT:bestlap}: {TXT:intervalprocessed}
' to file '{TXT:OutputFile}'

Set decimal [intervaltoprocess] value to the value of [secondbestlaptime]
Inline C# Function: Ticks to Human Readable Time
Write '[Blue] Second best lap {INT:secondbestlap}: {TXT:intervalprocessed}' to log
Append, 'Second best lap {INT:secondbestlap}: {TXT:intervalprocessed}
' to file '{TXT:OutputFile}'

Set decimal [intervaltoprocess] value to the value of [thirdbestlaptime]
Inline C# Function: Ticks to Human Readable Time
Write '[Blue] Third best lap {INT:thirdbestlap}: {TXT:intervalprocessed}' to log
Append, 'Third best lap {INT:thirdbestlap}: {TXT:intervalprocessed}
' to file '{TXT:OutputFile}'

Also attached.
« Last Edit: April 27, 2017, 02:16:26 PM by Pfeil »

jzar

  • Guest
Re: How do I create a voice controlled stop watch?
« Reply #11 on: April 27, 2017, 02:23:03 PM »
 :-* Yes, well then.

It now all works and no crash.....

my quick test gave me log and this text file:

Quote
Lap 1: 00:06.273
Lap 2: 00:03.242
Lap 3: 00:03.246
Lap 4: 00:03.054

Best lap 4: 00:03.054
Second best lap 2: 00:03.242
Third best lap 3: 00:03.246

wonderful, thanks again!

jzar

  • Guest
Re: How do I create a voice controlled stop watch?
« Reply #12 on: April 27, 2017, 02:24:31 PM »
I already had the beta VA but for some reason it  didn't overwrite and load properly. It now reads version 1.6.4.3

FireSammy

  • Newbie
  • *
  • Posts: 43
Re: How do I create a voice controlled stop watch?
« Reply #13 on: April 08, 2018, 09:40:31 AM »
Hello.

Quote
"Ticks to Human Readable Time"
Code: [Select]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

public class VAInline
{
   public void main()
   {

            TimeSpan interval = TimeSpan.FromTicks(Convert.ToInt64(VA.GetDecimal("intervaltoprocess")));
            VA.SetText("intervalprocessed", String.Format("{0:mm}:{0:ss}.{0:fff}", interval));
   }
}

Been playing around with this a bit and works really well (of course), but been alo wondering is it possible to add Hours to the string format, if one would want to take longer "lap times" or route times. Days even?? "String.Format("???{0:mm}:{0:ss}.{0:fff}", interval"

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How do I create a voice controlled stop watch?
« Reply #14 on: April 08, 2018, 01:14:10 PM »
String.Format takes standardized values for timespan, scroll to the "Format specifier" table on this page to see the options.

FireSammy

  • Newbie
  • *
  • Posts: 43
Re: How do I create a voice controlled stop watch?
« Reply #15 on: April 12, 2018, 04:45:38 AM »
Wohoo, i think i got it :)

Code: [Select]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

public class VAInline
{
public void main()
{

            TimeSpan interval = TimeSpan.FromTicks(Convert.ToInt64(VA.GetDecimal("intervaltoprocess")));
            VA.SetText("intervalprocessed", String.Format("{0:dd}:{0:hh}:{0:mm}:{0:ss}.{0:fff}", interval));
}
}

Seems to actually work, and gives correct results. HUGE THANKS!!! :)