Author Topic: VA response based on time of day  (Read 2536 times)

digitalcleaner

  • Guest
VA response based on time of day
« on: January 03, 2019, 06:34:21 AM »
Hi there, I am new as I just picked up VA 2 days ago.

How do I set it up so VA's response is checking the time of day?

An example would be, if I say "hello" in the morning VA looks to see if it is between 12am and 12pm and responds accordingly "good morning". 12pm to 6pm "good afternoon"... 6pm to 12am evening..

I would like to be able to use windows components (task scheduler) for the time checking aspect as I saw gary (admin) answer in another thread (see link below) but haven't a clue how to write that and could not find documentation I could comprehend in the help file. Please answer as you would someone brand new to coding. I cut and paste but I don't know how to write it.

https://forum.voiceattack.com/smf/index.php?topic=1945.0

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: VA response based on time of day
« Reply #1 on: January 03, 2019, 09:15:40 AM »
The VA Help Document is found in the root directory of your VA installation. You can also right-click on the top of the main VA user interface and select 'Help Document.' As a new user I strongly encourage you to read through the manual. Yes it's long, but Gary does a good job keeping things light with his humor.

The native time-based functionality of VA is often sufficient for most people, though perhaps you have some mission-critical stuff that you really need to run through the scheduler. Here is a small example for the time-based output you're looking for using the native VA functionality:

Code: [Select]
// Store the current hour (based on 24 hour clock) in an integer variable
Set integer [~~CurrentHour] value to the converted value of {TIMEHOUR24}

// Check if current hour is between 12am-11am
Begin Integer Compare : [~~CurrentHour] Is Less Than Or Equals 11
    // Say something with text-to-speech
    Say, 'good morning'  (and wait until it completes)
// Check if current hour is between 12pm-5pm
Else If : ([~~CurrentHour] Is Greater Than Or Equals 12 AND [~~CurrentHour] Is Less Than Or Equals 17)
    // Say something with text-to-speech
    Say, 'good afternoon'  (and wait until it completes)
// Otherwise...
Else
    // Say something with text-to-speech
    Say, 'good evening'  (and wait until it completes)
End Condition

// Say something with text-to-speech
Say, 'The time is {time}.'  (and wait until it completes)

Note that you can't just copy-paste the above directly into VA. You'll need to generate the actions yourself using the above as a roadmap. Also note that the above actions use the tokens {TIMEHOUR24} and {time}, which you can read about in the manual.
« Last Edit: January 30, 2019, 07:08:19 PM by Exergist »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: VA response based on time of day
« Reply #2 on: January 03, 2019, 10:17:54 AM »
Gary was referring to regarding Task Scheduler in the context of starting VoiceAttack at a given time and executing a specific command.

If you're looking to have VoiceAttack respond differently depending on the current time while it is already running, using Task Scheduler is not necessary at all.


The example Exergist provided is a good way to accomplish what you're looking for.

digitalcleaner

  • Guest
Re: VA response based on time of day
« Reply #3 on: January 27, 2019, 04:07:45 AM »
The response you gave did not show up in my profile notifications area. Nevermind.

digitalcleaner

  • Guest
Re: VA response based on time of day
« Reply #4 on: January 27, 2019, 04:24:44 AM »
Gary was referring to regarding Task Scheduler in the context of starting VoiceAttack at a given time and executing a specific command.

If you're looking to have VoiceAttack respond differently depending on the current time while it is already running, using Task Scheduler is not necessary at all.


The example Exergist provided is a good way to accomplish what you're looking for.

Where do I "paste it into VA"?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: VA response based on time of day
« Reply #5 on: January 27, 2019, 01:48:53 PM »
Note that you can't just copy-paste the above directly into VA. You'll need to generate the actions yourself using the above as a roadmap.