Scenario:
I have a Macro setup that my 3 year old can activate by saying "I want to watch Micky Mouse."
The macro goes through the process of powering on TV > Receiver > Setting correct inputs > Opening Windows Media Center > Starting most recently recorded Micky Mouse TV show.
I want to build in some logic to the equation so that If the receiver is already powered on then a different macro runs that only starts the appropriate show instead of running all the beginning power on tasks.
My Onkyo receiver uses ISCP so I can run PWRQSTN via ISCP and determine the Powered On state. How can I build this into a variable of sorts and then execute the appropriate Macro based in the results of PWRQSTN?
If anyone could help me with the starting points of a script it would be most helpful as my programming experience is pretty limited.
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
How to go about writing an If Then Script
Re: How to go about writing an If Then Script
I'm sure there are much better examples, but here is a post of how I figured it out.
Re: How to go about writing an If Then Script
Ok this is helpful. I am still a bit confused how I would call the ISCP command "PWRQSTN" and then set the variable via script. I can call the PWRQSTN now using the ISCP plugin but not sure how I write out the result to a variable.
Re: How to go about writing an If Then Script
I'm not familiar with Onkyo. I assume that you would use the OnkyoISCP plugin.
Re: How to go about writing an If Then Script
This sort of thing should do the trick:
- Attachments
-
- Mickey.xml
- (1.76 KiB) Downloaded 117 times
Re: How to go about writing an If Then Script
Thanks so much for taking the time to put that together. I understand what I need to do now. Thanks for your help. 
Re: How to go about writing an If Then Script
You're welcome. I was intrigued by kkl's method, so here's another way. I thought I may as well share my fiddling. 
I'm not sure which is the cleanest, but both seem to work.
I'm not sure which is the cleanest, but both seem to work.
- Attachments
-
- Mickey2.xml
- (1.74 KiB) Downloaded 124 times
Re: How to go about writing an If Then Script
blaher:
REALLY good stuff. Thanks for sharing.
REALLY good stuff. Thanks for sharing.
Re: How to go about writing an If Then Script
Thanks a million to you both. You have really helped boost my knowledge on how I can work with a variable. I will be using this across many different scenarios. Much thanks.
