Author Topic: Want to use vox as an alarm clock need explanation of (A)Contains(B)  (Read 10159 times)

0 Members and 1 Guest are viewing this topic.

SexGecko

  • Jr. Member
  • **
  • Posts: 15
  • Karma: 0
    • View Profile
Hi, I'm not quite sure how to get a statement using your "contains" keyword to work, I'd like to use {Longtime}Contains{7:00am} or something of the like, depending on how that operates and what longtime returns

Think you can give me a quite syntax tutorial on how to rig up one of those statements with the time?

This is so i can wake up to some mediamonkey stuff fyi.

Thanks

EDIT: Maybe this is more complicated than I'm thinking, the event would actually have to fire based on the time, not just "use conditional logic"... let me know if this is even possible

EDIT2: One more quick question, I'm trying to use "prefix only" (as in yellow standby mode) so that my music doesn't set off commands, is it possible to have it "start on windows" directly into yellow mode?
« Last Edit: November 18, 2011, 09:10:01 PM by SexGecko »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #1 on: November 18, 2011, 09:56:31 PM »
if a contains b you should put something into a and something into b

if a contains b it will be true. and it will execute the then actions, otherwise it will execute the else actions.

the first box is A and the second box is B.

the conditional logic is very dumbed down compared to what would be available in a real programming language.  There is no way to compare dates except to treat them as strings.  If you use A less than B it will assume they are both integers.

you can use something like :  if          AcontainsB       {ShortTime}        8:

to find out if it is 8 something, but if your system is on a 12 hour clock you won't know if it is AM or PM

if you want Vox to always start in standby mode, you can add the VC.Loaded event to the standby command.  This event is generated when VC finishes loading and you can just drag it from the history window onto the standby command in the command editor.  Or you can add it manually, as you would a new phrase etc.

or you can start VC with the command line parameter -standby but this is not possible by just clicking "start with windows" in the options menu.  To do this you would have to create your own startup item.  Put a shortcut into: "Start > All Programs > Startup"

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #2 on: November 18, 2011, 10:30:37 PM »
I am just thinking about what you actually want to do here.  ::hmm

if you want to trigger a voxCommand at a certain time of day the best way (currently) to do it is probably to create an item in windows task scheduler. 

In windows 7 do the following:

-Open windows task scheduler
-Create a basic task, give it a name, click next
-choose daily, click next
-choose a time, click next
-choose "start a program"
-enter the path (browse) to udpsender.exe (* see below)
-where it says "add arguments" type this:   33000 "event&&testevent"
  33000 is the default port that VC listens on.
  You can replace testevent with another name but you must keep the "event&&"
  example: 33000 "event&&timer.wakeup"

* udpsender is included in the "extras" download which you can get here: http://voxcommando.com/downloads.asp

Now just create a command and assign it a matching event (in this case it would be called "testevent" or whatever you called it in your udpsender parameter.

This is pretty cool.  ::wiggle  I will probably make a wiki guide at some point with images, or maybe a video tutorial.

Another way to do this would be to use timers in eventGhost and send a command to VC using the broadcaster plugin.  I am planning on adding a timer plugin to VC but it will probably be quite a while before I get around to it.

SexGecko

  • Jr. Member
  • **
  • Posts: 15
  • Karma: 0
    • View Profile
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #3 on: November 18, 2011, 10:59:32 PM »
Wow, thanks for the great response so late in the evening, it's very helpful and I'm most of the way through your suggestions.

can you clarify the standby thing a bit more? where is the event I'm adding to exactly?

Thanks!

EDIT: nevermind, your instructions are actually great! I'll let you know how the alarm clock turns out(and whether I can cut halfway through "I've got you Babe" in media monkey
« Last Edit: November 18, 2011, 11:01:43 PM by SexGecko »

SexGecko

  • Jr. Member
  • **
  • Posts: 15
  • Karma: 0
    • View Profile
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #4 on: November 19, 2011, 04:08:20 AM »
You may be interested to note that i was also able to use "({LongTime})Contains(i )" with i=0 through 9 to provide a bit more random personality to my British TTS voice (note the space!)

Like so: http://i.imgur.com/cIVmC.png

Is there an easier way to do this than 10 conditional statements? You haven't got some kind of "give me 10 arguments and i'll choose randomly between them" eh?

EDIT: One more quickly if you have time, I'm trying to tie the weather into my morning alarm clock, i see you have a 'weather' option, but i have yet to have anything returned from it (says it returns text, but to where?) If at all possible i'd like to nest part or all of it into a TTS.Speak so I can have the voice read me the weather report... Is this asking too much? It would certainly go well with the alarm clock idea..
« Last Edit: November 19, 2011, 04:35:49 AM by SexGecko »

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #5 on: November 19, 2011, 07:30:22 AM »

Is there an easier way to do this than 10 conditional statements? You haven't got some kind of "give me 10 arguments and i'll choose randomly between them" eh?

Yes, there is a easy way to use random answer, here is a example command:

TTS.SpeakSync - Thanks | You're welcome | no problem

It is important among these words is a vertical dividing line |

Kalle
« Last Edit: November 19, 2011, 08:23:11 AM by Kalle »
***********  get excited and make things  **********

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #6 on: November 19, 2011, 08:20:43 AM »

EDIT: One more quickly if you have time, I'm trying to tie the weather into my morning alarm clock, i see you have a 'weather' option, but i have yet to have anything returned from it (says it returns text, but to where?) If at all possible i'd like to nest part or all of it into a TTS.Speak so I can have the voice read me the weather report... Is this asking too much? It would certainly go well with the alarm clock idea..

show the attachement png - this is a example how it work  ;)

Kalle
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #7 on: November 19, 2011, 09:18:00 AM »
Pretty much any time an action returns a result it gets stored in {LastResult} which you can use almost anywhere, as you would use {1} for payload 1.

one exception is when you use Results.RegEx to get values from {LastResult}.  In this case the multiple matches if found are stored in {match.1} {match.2} etc.

SexGecko

  • Jr. Member
  • **
  • Posts: 15
  • Karma: 0
    • View Profile
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #8 on: November 19, 2011, 05:21:51 PM »
This is great stuff! thanks for all your help(s)!

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #9 on: November 19, 2011, 05:34:24 PM »
happy to help  :bignod

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #10 on: November 19, 2011, 06:04:57 PM »
This is great stuff! thanks for all your help(s)!
Me too ;)
***********  get excited and make things  **********

SexGecko

  • Jr. Member
  • **
  • Posts: 15
  • Karma: 0
    • View Profile
Getting back on this bandwagon
« Reply #11 on: December 22, 2011, 07:58:39 PM »
Ok, I'd had this set up for a while now (just hadn't gotten around to posting) It works great! wakes me up nice and early every morning to a message from my British TTS voice and cuts about halfway into "I've Got You Babe".

So, now I'd like to expand this idea a little more, I'd like to:

1. Make it able to be turned off and on by way of voice (not the music itself, but "Enable alarm for tomorrow" or "Disable alarm" options)

2. Make the time adjustable by voice (i.e. "Set alarm for 6:30 AM")


Here's how I'm going about #1(so that's a start at least!):

my scheduled task is called "AlarmClock"

Disable Alarm Clock command:
Launch.Hidden      SchTasks&&/Change /TN AlarmClock /DISABLE

Enable Alarm Clock command:
Launch.Hidden      SchTasks&&/Change /TN AlarmClock /ENABLE


Now for #2 I'm thinking something along the lines of:

Launch.Hidden      SchTasks&&/Change /TN AlarmClock /ST {1}
(needs to be 00:00 formatting)
Changing the time on a scheduled event requires the username and password etc. I am still looking into that bit of it.
The real issue is getting Vox to interpret the military time correctly (something like {1}:{2}??) tough call.

If I get past the authentication stuff I may try just setting up one command (or batch file) for each time I'd like (6,7,8am etc.) then I can just hardcode the times (this is almost as good)

Let me know if you have any ideas.

Cheers

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #12 on: December 22, 2011, 08:44:03 PM »
using the {1}:{2} concept should be relatively easy.  Just let me know how you want to say the various times.  I'm not that familiar with the military method and I don't know if there is more than one way of saying the same time.  Give me a few examples.

SexGecko

  • Jr. Member
  • **
  • Posts: 15
  • Karma: 0
    • View Profile
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #13 on: December 23, 2011, 09:37:40 AM »
Military time is just a 24 hour clock so that you can omit AM and PM.

So 08:00 would be 8:00AM, whereas 13:00 would be 1:00PM.

So You'd basically just have to use {1}:{2} and then add some conditionals (0<={1}<=12) and (if (0<={1}<=9) then {1} = 0{1}) or what have you (this last one might apply to {2} as well depending on how you say the time)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #14 on: December 23, 2011, 09:53:30 AM »
I know what military time is in essence, but the question is how would you say various times, which is why I wanted some examples.

For example, I believe that for 8AM would be said "oh eight hundred", or possibly "zero eight hundred" etc.  I don't know if there would be others.

22:15 would just be "twenty two fifteen" ?  I'm trying to figure out if there are other exceptions.

Anyway, here's something that might work.  You don't need any conditional stuff for it.

You need to put "militarytimepart2.xml" into your payloads folder and then import the other xml.

I've only included the general rounded off minutes (0,10,15,20,30,40,45,50) to improve recognition since I figured you don't really need to set an alarm for 2:13, but maybe you do, in which case you could just use a payload range, but then you need to figure out something to deal with "hundred" meaning ":00".