Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Speak a Global Variable Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Tomcat7194
Newbie
Newbie


Joined: November 05 2006
Online Status: Offline
Posts: 24
Posted: November 05 2006 at 14:45 | IP Logged Quote Tomcat7194

Hello, I am new to Powerhome, and I am trying to make a macro that will speak a global variable. I already set up TTS, and I installed the macro GetWeather.

Now, when I run a macro called Speak, I want the computer to say the current temperature, which is stored in the global variable CURTEMP. So far, I have it set up with the code:

ph_tts({CURTEMP})

But this does not do anything. What would be the code to get the computer to speak the global variable CURTEMP when I trigger the macro?

Thanks
Tom

Back to Top View Tomcat7194's Profile Search for other posts by Tomcat7194
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: November 05 2006 at 15:23 | IP Logged Quote smarty

Try this:

ph_tts("{CURTEMP}")

You need to add the quotes   

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
Tomcat7194
Newbie
Newbie


Joined: November 05 2006
Online Status: Offline
Posts: 24
Posted: November 05 2006 at 15:28 | IP Logged Quote Tomcat7194

I tried that, but it just says " C U R T E M P", then "ZERO" rather than saying the value of {CURTEMP}

Any idea how to correct that?
Tom
Back to Top View Tomcat7194's Profile Search for other posts by Tomcat7194
 
Tomcat7194
Newbie
Newbie


Joined: November 05 2006
Online Status: Offline
Posts: 24
Posted: November 05 2006 at 15:30 | IP Logged Quote Tomcat7194

Wait, I think I got it. I hadn't actually set up a Global Variable in the category in Setup. Once I added one there, it read the value.

Thanks!
Tom
Back to Top View Tomcat7194's Profile Search for other posts by Tomcat7194
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: November 06 2006 at 13:03 | IP Logged Quote dhoward

Tom,

Yep, you got it! I was just going to post to make sure you have declared the GV.

The way PowerHome works, during formula evaluation, variable substitution is performed first. PowerHome searches for all occurrences of text between {} and []. In the case of {}, it looks up in the global variable table for a matching value. If it's found, then the value of the GV is substituted for the {} and the ID between them. If the ID isnt found in the GV table, then no substitution is performed. It works the same for the System variables and the [] tags.

Anyways, glad to see you got it figured out and let me know if you have any other questions or problems.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum