Macros and Variables

Forum to discuss Cinemar's USBIR6 IR hardware and plugin
bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Macros and Variables

Postby bigDvette » Mon Sep 03, 2007 11:19 pm

I'm trying to write a MLUSBIR6 Macro to execute a series of commands.

I can get it to work fine if I make all the calls using literals like

SendIR|Theater~TV Power
Delay
SendIR|Theater~Receiver Power

But if I use variables, they seem to be treated as literals

SendIR|{{{{clientname}}_currentcontrol}}~TV Power
Delay
SendIR|{{{{clientname}}_currentcontrol}}~Receiver Power

where {{{{clientname}}_currentcontrol}} equals Theater

It doesn't resolve and the log says it is trying to execute the command with the variable as a literal string.

Is this a limitation or is there anothe way to use variables? I can't find this in the manual

User avatar
mcascio
Founder
Founder
Posts: 8270
Joined: Tue Jan 28, 2003 4:03 pm
Location: Kenosha, Wi
Contact:

Postby mcascio » Tue Sep 04, 2007 8:48 am

Looks like your delay command is incomplete and missing the time delay in seconds:
Delay~1

or use a decimal for less.
Mario Cascio
Cinemar, Inc.
http://www.cinemaronline.com

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Postby bigDvette » Tue Sep 04, 2007 10:34 am

Thanks Mario, that was just an incomplete example. My question was about resolving the variables in the macro and those not working. That is what it is complaining about.

Here is the log. It isn't resolving the variable. Delay isn't the issue.

Macro: SendIR~{{{{clientname}}_currentcontrol}}~TV Off
Got: [SendIR~{{{{clientname}}_currentcontrol}}~TV Off]
SendIR: Device[{{{{clientname}}_currentcontrol}}] Funct[TV Off]
ERROR: Invalid Device/Command combination. [{{{{clientname}}_currentcontrol}}/TV Off]
Macro: Delay~2
Got: [Delay~2]
Macro: SendIR~{{{{clientname}}_currentcontrol}}~Receiver Off
Got: [SendIR~{{{{clientname}}_currentcontrol}}~Receiver Off]
SendIR: Device[{{{{clientname}}_currentcontrol}}] Funct[Receiver Off]
ERROR: Invalid Device/Command combination. [{{{{clientname}}_currentcontrol}}/Receiver Off]

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Postby bigDvette » Wed Sep 05, 2007 5:52 pm

bump since previous response didn't really address my question.

User avatar
lathanm
Intermediate
Intermediate
Posts: 372
Joined: Mon Feb 27, 2006 2:27 pm
Location: Aurora, IL
Contact:

Postby lathanm » Wed Sep 05, 2007 7:14 pm

Probably an issue with nested variables and the order they are created/read. Try creating a separate helper variable and using it in the final command.
Hacker /n./ One who enjoys the intellectual challenge of creatively overcoming or circumventing limitations.

Pass the popcorn, the movie is starting!

http://project2501.tzo.com/gallery/automation
http://project2501.tumblr.com

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Postby bigDvette » Wed Sep 05, 2007 8:28 pm

I will try it just to see if it works.

However, I have a strict design philosophy for this system so that I can use it for my automation business as I move forward and that is minimize hard coding or long trees of logic that are hard to follow. I've stayed very close to that so far.

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Postby bigDvette » Fri Sep 07, 2007 3:05 pm

Nope, doesn't work with single variables either. Can someone confirm this is the desired behavior of the plugin?

User avatar
mcascio
Founder
Founder
Posts: 8270
Joined: Tue Jan 28, 2003 4:03 pm
Location: Kenosha, Wi
Contact:

Postby mcascio » Fri Sep 07, 2007 3:10 pm

It's best to build the command using the MLServer internal Macros rather than The USBIR6 which will most likely be depricated at some point (This was created before macros existed in MLSErver).

SendIR|{{{{clientname}}_currentcontrol}}~TV Power
Delay
SendIR|{{{{clientname}}_currentcontrol}}~Receiver Power

Converts to:
MLServeCmd.Macro|MLUSBIR6|SendIR|{{{{clientname}}_currentcontrol}}~TV Power!MLPause|.15!MLUSBIR6|SendIR|{{{{clientname}}_currentcontrol}}~Receiver Power

This can all be put into a single Macro that can then be called by a simple name like: PowerOnEverything
Mario Cascio

Cinemar, Inc.

http://www.cinemaronline.com

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Postby bigDvette » Fri Sep 07, 2007 6:05 pm

That is where I was headed next. When I did that for Insteon Devices the message was "Hey, that is what groups are for" so I was trying to keep everything related to the USBIR6 in the USBIR6 plugin if possible which makes it a bit more portable as well.


Return to “USBIR6”

Who is online

Users browsing this forum: No registered users and 1 guest