Author Topic: Want to use vox as an alarm clock need explanation of (A)Contains(B)  (Read 10182 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: 7715
  • 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: 7715
  • 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: 7715
  • 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: 7715
  • 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: 7715
  • 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: 7715
  • 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".

MrWolf

  • $upporter
  • Sr. Member
  • *****
  • Posts: 209
  • Karma: 4
    • View Profile
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #15 on: April 20, 2012, 02:59:06 PM »
Did anyone ever get this working in its entirety or thereabouts?

It would be cool to be able to say "Set an alarm for 18:30" and it play music at that point.

If you did then can I have the XML?

-P
Home automation guides for idiots like me by an idiot (me)...
https://www.youtube.com/user/wolfsweb

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #16 on: April 20, 2012, 03:03:47 PM »
yes, I explain how to do it in this very thread...

http://voxcommando.com/forum/index.php?topic=653.msg4655#msg4655

MrWolf

  • $upporter
  • Sr. Member
  • *****
  • Posts: 209
  • Karma: 4
    • View Profile
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #17 on: April 20, 2012, 03:32:40 PM »
I could be being thick (fairly usual).  But this would only work for a static alarm clock, or one that I intended to update on a minimal basis.

The scenario I'm thinking is if me and my good lady decide to take a nap, but we want to get up in an hour, I would say "Chloe, set an alarm for 18:30".

Since I posted I started fiddling, and have so far managed to get her to set an alarm for in 15 seconds time by using SetEventTimer and then having a payload range of 10,15,20,25,30,35,40,45,50,55.  She then puts the lights on dim and plays a playlist in XBMC

I can obviously say to her, "Chloe set an alarm for 900" and she would wake me up in 900 seconds/15 minutes, but what's the easiest way to tell her 15 minutes and her understand me?

Sorry to ask, I can guarantee this is covered somewhere in the Wiki, but whilst I've got your attention :)

-P
Home automation guides for idiots like me by an idiot (me)...
https://www.youtube.com/user/wolfsweb

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #18 on: April 20, 2012, 03:48:36 PM »
there is currently no great way to set an alarm on the fly for a specific time.  You could probably do something with EG fairly easily (if you know how to use EG).

but if you want to be able to say:

do something in:
-5 minutes
-10 minutes
-15 minutes
...
- an hour

then you can do this with a custom payloadXML file.  exactly what you are already doing really, but with a payloadXML file instead of a payloadList which you are currently using.  You would put the phrase(s) in the right column and the equivalent time in seconds in the left column.

MrWolf

  • $upporter
  • Sr. Member
  • *****
  • Posts: 209
  • Karma: 4
    • View Profile
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #19 on: April 20, 2012, 04:44:01 PM »
Mate this is perfect.

I already had a static alarm with Eventghost and I'm a 9-5 guy so I only really wanted a nap timer and now I have one.

No worries if not, but if I set an alarm for an hours time but then wake up after 30 minutes and decide to watch TV is there any way to stop the countdown so that it doesn't trigger the alarm?

Your software truly is genius brother.

-P
Home automation guides for idiots like me by an idiot (me)...
https://www.youtube.com/user/wolfsweb

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #20 on: April 20, 2012, 04:49:58 PM »
there is no way (currently) to kill an event timer once it has been started.  In theory I should be able to make a command that could clear ALL created event timers.  Killing them by name would require more work.

However, what you can do quite easily is set a variable when you start the timer.  Let's say that when you first create the timer you also make a variable called DoWakeEvent and set the value to true.  then when the event triggers the wake action you can check to see if this variable is set to true.  If you want to cancel the timer before it goes off, you just need to set this variable again to anything other than true.

You'll need the latest version of VC for this since I added the ability to set user variables quite recently.

edit:
You can create the var like this:
Code: [Select]
Results.SetVar      DoWakeEvent      True
and you can access your variable later (like in an if then else block) using {Var.DoWakeEvent }  assuming that you named it "DoWakeEvent ".
« Last Edit: April 20, 2012, 04:58:26 PM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Want to use vox as an alarm clock need explanation of (A)Contains(B)
« Reply #21 on: April 20, 2012, 04:53:13 PM »
you might also be able to check if the computer is already doing certain activities before executing the wakeup actions.  That's a vague statement because I don't know enough about what "watch TV" really means on your system or if there is a way for VC to know about it.