Author Topic: Nested Macros?  (Read 5153 times)

0 Members and 1 Guest are viewing this topic.

vulcanjedi

  • $upporter
  • Sr. Member
  • *****
  • Posts: 213
  • Karma: 8
    • View Profile
Nested Macros?
« on: April 15, 2014, 01:05:01 AM »
Honestly I've been familiarizing about phrases, commands, macros  and events...etc. I've watched some vids and streamed to tv while configuring, which helped with an event trigger today. VC continues to amaze.
I've tried to google search and search the forums and wiki. I've trolled the Action Selection Tree and the LCB Tried to get the semantics straight, but maybe I'm not searching right, but I'll risk asking anyways  :-[
As I interpret it, Macros as VC refers to them are a stored procedure of 1 or more commands.

What I'm curious is and couldn't find was can you call a custom command(macro) from in a macro?
I know I could brute force it but what I was curious is.
This is not what I want to do, but heres a example scenario to hopefully better suggest what I mean.
Such as with XBMC there is commands such as:
Generate XML
Play Movie "Sintel"
Get Subtitles...etc.

Those are separate custom Macros built on the native commands provided by VC.
is it possible to make one Macro that calls all those?
Macro1
  • Generate XML
  • Play Movie "Sintel"
  • What movie is this...etc.

So you could say SuperMacro, and it would do all 3? I know you could obviously make a macro w/ all the commands of each but just curious if you could call an existing macro from within another one?
Sorry I hope  this is clear and I did effort to find the solution, if possible, myself but was unsuccessful. Using VC2v1.9.2.1
I was actually thinking this could make VC useful for repeatable tests/ configuring scenarios in other programs.
« Last Edit: April 15, 2014, 01:16:08 AM by vulcanjedi »

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Nested Macros?
« Reply #1 on: April 15, 2014, 07:22:48 AM »
Hi vulcanjedi, you can call a other command with the VC.TriggerEvent action.  ::hmm
***********  get excited and make things  **********

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Nested Macros?
« Reply #2 on: April 15, 2014, 09:32:00 AM »
As I interpret it, Macros as VC refers to them are a stored procedure of 1 or more commands.

Since you're working hard to get the semantics right, as you mention above, I'll just clarify:

A "command" in VC consists of:
1. a sequence of actions (methods)--a sequence of actions, in regular computerspeak, constitutes a macro (http://en.wikipedia.org/wiki/Macro_(computer_science), and the logical command builder where we can construct that sequence of actions is basically the macro editor.
2. the input required to trigger the execution of that macro (a voice command or an event), and any information that we need to pass it for it to work correctly (payloads). http://voxcommando.com/mediawiki/index.php?title=Customizing_Commands

So when we refer to a "command" in our tutorials or here on the forum, we mean a given item in your command tree that has a lightning bolt next to it.

----

A common tendency of VC users is to think that it is bad or "amateur" to break up a task that they're trying to accomplish into smaller tasks, with each small task in its own command. Sometimes this is absolutely the right way to solve the problem.

So, you can have a command group that is made of up several commands each accomplishing one task. One command executes and then calls on the next command, etc., and this command group is then your "super macro". (That said, the commands don't actually have to be in the same group; it's just a convenient way to organize things sometimes.)

As Kalle mentioned, one way to get one command to trigger a second command is using the VC.EventTrigger action. This requires that the command you want to trigger has an event assigned to it. Another option is the VC.TellVox action. I think there are probably multiple examples of these in use on the forum, if that helps.
« Last Edit: April 15, 2014, 10:59:29 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

vulcanjedi

  • $upporter
  • Sr. Member
  • *****
  • Posts: 213
  • Karma: 8
    • View Profile
Re: Nested Macros?
« Reply #3 on: April 15, 2014, 11:16:23 AM »
Thanks kalle and nime5ter for the prompt response/clarification. I looked into events and originally wasn't sure that would be the most prudent method
I must have went down a bad wiki rabbit hole and never made it out :)
I strangely don't recall hitting the anchor point to the wiki that seems to explicitly suggest it.  Saw some xmls, but hard to see if you weren't quite sure what you were looking for.
As kalle suggested reevaluating and I see you can make custom events, so I'm optimistic this will work just nicely.
This is going to make some work much more modular/convenient.

I've made some good progress (relative to me of course) making custom commands, which usually everything I have done was so easily provided by VC or the forums.
I have something I think is a (non VC) bug and then some more regex hell I need to try to get past (and have been avoiding)...but I'll share when its more complete.

But I'm starting to see more potential for some other scenarios now too. Many thanks again friends.

« Last Edit: April 15, 2014, 11:28:06 AM by vulcanjedi »

vulcanjedi

  • $upporter
  • Sr. Member
  • *****
  • Posts: 213
  • Karma: 8
    • View Profile
Re: Nested Macros?
« Reply #4 on: April 15, 2014, 09:12:45 PM »
May I suggest the aspect of custom events be added to the wiki stub for events?
Quote
However, it is also possible to create an event from scratch by selecting the event icon from the command part menu and labeling it.
Commands that have events associated with them will have a modified command icon that looks like this: Eventcommand.png
http://voxcommando.com/mediawiki/index.php?title=Command_Tree_Editor#Events
http://voxcommando.com/mediawiki/index.php?title=Events