Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
Simple alarm clock
This thread has 6 replies. Displaying all posts.
Post 1 made on Monday March 11, 2024 at 03:54
mpg7321
Regular Member
Joined:
Posts:
June 2020
111
This does not see to work for me,

var alarm = System.getGlobal("alarm_set.Initialised");
var time = GUI.getDisplayTime();
CF.widget("time").label = time;
CF.widget("time_alarm").label = alarm;

if (alarm == time) {
CF.widget("alarm_set").label = "exicute";
}else{}

got it working, needed to use ===

Last edited by mpg7321 on March 12, 2024 17:59.
Post 2 made on Wednesday March 20, 2024 at 19:02
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,997
Your statement that you had to use === makes no sense. Something else in your code must be wrong.

System.getGlobal 'Purpose' from DEV Guide

Retrieve a string value stored in the global variables list.

Return
String
The value of the global variable, or null if the name is not found.

In your case, either the value returned was null or maybe had some extra characters on it.

null == 'hello' => false
null === 'hello' => false

The double equal does type coercion and null and a string are not the same.

Sounds like the first time you did this, maybe the global was not set prior to your executing the script but sometime after, it was.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 3 made on Wednesday March 20, 2024 at 20:58
mpg7321
Regular Member
Joined:
Posts:
June 2020
111
But the alarm clock only works with ===, I have been using it for over a week and works every time, never locks up the remote and or mis launches. That is the entire script the repeats every 50 seconds when that page is displayed. I will go back and try it with == and see if it works now, maybe I made changes after the fact and never changed it back, either way it works.

Last edited by mpg7321 on March 20, 2024 21:14.
Post 4 made on Friday March 22, 2024 at 09:04
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,997
All I was saying is that === vs == was not the real fix in case someone reads your first response. If you prefer, I can delete the whole thread.

Lyndel
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 5 made on Friday March 22, 2024 at 13:21
mpg7321
Regular Member
Joined:
Posts:
June 2020
111
On March 22, 2024 at 09:04, Lyndel McGee said...
All I was saying is that === vs == was not the real fix in case someone reads your first response. If you prefer, I can delete the whole thread.

Lyndel

I'm sure your right, I shouldn't be doing this at 2am anymore. LOL I did change it back to == and it works, like you said I must have changed something else. I also just realized that the Variable "alarm_set.Initialised" is Null when the page first loads, and stays Null till I interact with the page, so not sure if === vs == would make a difference there. Eiter way I fixed the Null factor, changed it to == and all is working.

Thanks for all your help you always know best.
Mike
Post 6 made on Friday March 22, 2024 at 21:03
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,997
On March 20, 2024 at 19:02, Lyndel McGee said...
null == 'hello' => false
null === 'hello' => false

The double equal does type coercion and null and a string are not the same.

The === means that the left and right hand sides must be the same value AND the same type.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 7 made on Friday March 22, 2024 at 21:08
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,997
On March 22, 2024 at 13:21, mpg7321 said...
Thanks for all your help you always know best.
Mike

Not Always!!!!! Just ask my wife!
Lyndel McGee
Philips Pronto Addict/Beta Tester


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse