Author |
|
nadler Super User
Joined: February 25 2006 Location: United States
Online Status: Offline Posts: 354
|
Posted: March 02 2009 at 19:18 | IP Logged
|
|
|
I thought I'd share the code listed below. It creates a macro called 'Alarm Clock'. When you run the macro a new Control Center tab is created with a name of your choosing. From the new control center tab you can set the time and date for an alarm and then Set the Alarm. When the alarm rings big ben chimes.
- Copy the code below
- In PH, open the multi-editor and make sure it is set to sql (Maintenance>Multi-Editor)
- Paste the code you copied from this board into the multi-editor
- Execute the script (Click on the execute icon on the tool bar menu)
- The multi-editor bottom dialog box should say OK (if there is an error make sure there are no extraneous spaces in the code inadvertently added by the Forum formatting)
- Close the multi-editor and open up the list of macros. You should see a new macro called Alarm Clock
- Play the Alarm Clock macro
- Enter the name of your Alarm Control Center tab when asked (six characters max)
- Open the Control Center (If it was already open, close it and reopen it to see the new tab)
- Play with the Alarm Clock
Alarm Clock Macro Code:
Code:
insert into macroheader values ('ALARM CLOCK','test of concept',0,0,1);
insert into macrodetail values ('ALARM CLOCK',1,25,'No TTS',NULL,'"Name Your Alarm (6 Characters Max.)"
',0,'');
insert into macrodetail values ('ALARM CLOCK',2,15,'[LOCAL4]',NULL,'"[INPUTRET]"
',0,'');
insert into macrodetail values ('ALARM CLOCK',3,37,'',NULL,'Make global variable for this alarm',0,'');
insert into macrodetail values ('ALARM CLOCK',4,10,'ALARM NAME',NULL,'"[LOCAL4]"',0,'');
insert into macrodetail values ('ALARM CLOCK',5,37,'',NULL,'Read number of rows from global variable table',0,'');
insert into macrodetail values ('ALARM CLOCK',6,38,'',0,'ph_sqlselect(1,"select id from global_variables") ',0,'');
insert into macrodetail values ('ALARM CLOCK',7,15,'[LOCAL1]',NULL,'ph_getsqlrows(1)',0,'');
insert into macrodetail values ('ALARM CLOCK',8,15,'[LOCAL2]',NULL,'ph_getvar_s(1,4)',0,'');
insert into macrodetail values ('ALARM CLOCK',9,37,'',NULL,'Add 6 to the number of rows',0,'');
insert into macrodetail values ('ALARM CLOCK',10,38,'',0,'ph_addtovar(1,1,8)',0,'');
insert into macrodetail values ('ALARM CLOCK',11,38,'',0,'ph_sqlselect(1,"INSERT INTO global_variables (Id, Value) VALUES (''[LOCAL2]ALARM NAME'',''[LOCAL4]'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',12,38,'',0,'ph_sqlselect(1,"INSERT INTO global_variables (Id, Value) VALUES (''[LOCAL2]H1'',''0'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',13,38,'',0,'ph_sqlselect(1,"INSERT INTO global_variables (Id, Value) VALUES (''[LOCAL2]M1'',''0'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',14,38,'',0,'ph_sqlselect(1,"INSERT INTO global_variables (Id, Value) VALUES (''[LOCAL2]M2'',''0'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',15,38,'',0,'ph_sqlselect(1,"INSERT INTO global_variables (Id, Value) VALUES (''[LOCAL2]AMPM'',''--'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',16,38,'',0,'ph_sqlselect(1,"INSERT INTO global_variables (Id, Value) VALUES (''[LOCAL2]AS'',''(ph_playsound(''''C:\Program Files\powerhome\web\grandfatherclock.wav'''',1))'')")',0,'') ;
insert into macrodetail values ('ALARM CLOCK',17,15,'[LOCAL5]',NULL,'today()',0,'');
insert into macrodetail values ('ALARM CLOCK',18,38,'',0,'ph_sqlselect(1,"INSERT INTO global_variables (Id, Value) VALUES (''[LOCAL2]DATE'',''0'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',19,38,'',0,'ph_setglobal_a(''[LOCAL2]DATE'',today())',0,'');
insert into macrodetail values ('ALARM CLOCK',20,38,'',0,'ph_sqlselect(1,"INSERT INTO global_variables (Id, Value) VALUES (''[LOCAL2]DAY'',dayname(today()))")',0,'');
insert into macrodetail values ('ALARM CLOCK',21,37,'',NULL,'Read number of tabs from cctabs table',0,'');
insert into macrodetail values ('ALARM CLOCK',22,38,'',0,'ph_sqlselect(2,"select id from cctabs") ',0,'');
insert into macrodetail values ('ALARM CLOCK',23,15,'[LOCAL3]',NULL,'ph_getsqlrows(2)',0,'');
insert into macrodetail values ('ALARM CLOCK',24,37,'',NULL,'Add one to the number of tabs',0,'');
insert into macrodetail values ('ALARM CLOCK',25,38,'',0,'ph_addtovar(1,3,1)',0,'');
insert into macrodetail values ('ALARM CLOCK',26,37,'',NULL,'Insert New tab into cctabs',0,'');
insert into macrodetail values ('ALARM CLOCK',27,15,'[LOCAL10]',NULL,'"[LOCAL2]"',0,'');
insert into macrodetail values ('ALARM CLOCK',28,38,'',0,'ph_sqlselect(2,"INSERT INTO cctabs (Id, Tab_Order, Bkgrnd_Color, H_Scrollbar,V_Scrollbar,Bmp_Width, Bmp_Height) VALUES (''[LOCAL10]'',''[LOCAL3]'',''12632256'',''Y'',''Y'',''0'',''0'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',29,37,'',NULL,'Create Arrows and boxes',1,'');
insert into macrodetail values ('ALARM CLOCK',30,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''1'',''1'','''',''0 '','''',''197'',''80'',''1070'',''804'',''0'',''0'',''0'','' 255'',''0'',''Times New Roman'',''26'',''400'',''0'',''0'',''2'',''8'','' '','' '',''6'',''255'',''0'',''4'',''109'',''126'',''RR1'')")',0,' ');
insert into macrodetail values ('ALARM CLOCK',31,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''2'',''5'',''if (ph_getglobal_n(''''[LOCAL10]M2'''')<1,(ph_setglobal_a(''''[LOCAL10]M2'''',9)),(ph_setglobal_a(''''[LOCAL10]M2'''',ph_getglobal_n(''''[LOCAL10]M2'''')-1)))'',''0'','' '',''800'',''200'',''91'',''64'',''0'',''0'',''0'',''1263225 6'',''0'',''Arial'',''8'',''400'',''0'',''0'',''2'',''4'','' C:\Program Files\powerhome\web\graphics\buttons\b10brown_50.gif'','''', ''6'',''0'',''0'',''1'',''50'',''50'',''AGM2D'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',32,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''3'',''5'',''if(ph_getglobal_s(''''[LOCAL10]AMPM'''')=''''AM'''',ph_setglobal_s(''''[LOCAL10]AMPM'''',''''PM''''),ph_setglobal_s(''''[LOCAL10]AMPM'''',''''AM''''))'',''0'','' '',''974'',''104'',''91'',''64'',''0'',''0'',''0'',''1263225 6'',''0'',''Arial'',''8'',''700'',''0'',''0'',''2'',''4'','' C:\Program Files\powerhome\web\graphics\buttons\b10brown_50.gif'','''', ''6'',''0'',''0'',''1'',''50'',''50'',''AGAM'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',33,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''4'',''1'','''',''0'','' '',''320'',''696'',''823'',''112'',''0'',''0'',''10789024'', ''12632256'',''0'',''Ariel'',''8'',''400'',''0'',''0'',''2'' ,''8'','''','''',''6'',''16777215'',''0'',''4'',''91'',''90' ',''RR2'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',34,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''6'',''5'',''ph_createtimedevent1((''''[LOCAL10]''''),1,0,0,0,0,datetime(ph_getglobal_d(''''[LOCAL10]DATE''''),time(string((ph_getglobal_s(''''[LOCAL10]H1'''')+'''':''''+ph_getglobal_s(''''[LOCAL10]M1'''')+ph_getglobal_s(''''[LOCAL10]M2'''')+ph_getglobal_s(''''[LOCAL10]AMPM''''))))),2,ph_getglobal_s(''''[LOCAL10]AS''''),''''1'''')'',''0'',''Alarm Set'',''393'',''716'',''316'',''68'',''0'',''0'',''0'',''126 32256'',''10'',''Arial'',''8'',''400'',''0'',''0'',''2'',''0 '','''','''',''6'',''0'',''0'',''1'',''50'',''50'',''TB1'')" )',0,'');
insert into macrodetail values ('ALARM CLOCK',35,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''7'',''5'',''ph_modifytimedevent(''''[LOCAL10]'''',0,today(),2)'',''0'',''Alarm Disable '',''773'',''716'',''316'',''68'',''0'',''0'',''0'',''255'', ''10'',''Arial'',''8'',''400'',''0'',''0'',''2'',''0'','''', '''',''6'',''0'',''0'',''1'',''50'',''50'',''TB2'')")
',0,'');
insert into macrodetail values ('ALARM CLOCK',36,38,'',0,' ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''8'',''5'',''if (ph_getglobal_n(''''[LOCAL10]H1'''')<2,(ph_setglobal_a(''''[LOCAL10]H1'''',12)),(ph_setglobal_a(''''[LOCAL10]H1'''',ph_getglobal_n(''''[LOCAL10] H1'''')-1)))'',''0'','''',''402'',''200'',''91'',''64'',''0' ',''0'',''0'',''12632256'',''0'',''Arial'',''8'',''400'',''0 '',''0'',''2'',''4'',''C:\Program Files\powerhome\web\graphics\buttons\b10brown_50.gif'','''', ''6'',''0'',''0'',''1'',''50'',''50'',''HGH1D'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',37,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''9'',''5'',''if (ph_getglobal_n(''''[LOCAL10]M1'''')>4,(ph_setglobal_a(''''[LOCAL10]M1'''',0)),(ph_setglobal_a(''''[LOCAL10]M1'''',ph_getglobal_n(''''[LOCAL10] M1'''')+1)))'',''0'','''',''654'',''104'',''91'',''64'',''0' ',''0'',''0'',''12632256'',''0'',''Arial'',''8'',''400'',''0 '',''0'',''2'',''4'',''C:\Program Files\powerhome\web\graphics\buttons\b10brown_50.gif'','''', ''6'',''0'',''0'',''1'',''50'',''50'',''AGM1U'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',38,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''10'',''5'',''if (ph_getglobal_n(''''[LOCAL10]M1'''')<1,(ph_setglobal_a(''''[LOCAL10]M1'''',5)),(ph_setglobal_a(''''[LOCAL10]M1'''',ph_getglobal_n(''''[LOCAL10]M1'''')-1)))'',''0'','' '',''654'',''200'',''91'',''64'',''0'',''0'',''0'',''1263225 6'',''0'',''Arial'','''',''400'',''0'',''0'',''2'',''4'',''C :\Program Files\powerhome\web\graphics\buttons\b10brown_50.gif'','''', ''6'',''0'',''0'',''1'',''50'',''50'',''AGM1D'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',39,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''11'',''5'',''if (ph_getglobal_n(''''[LOCAL10]M2'''')>8,(ph_setglobal_a(''''[LOCAL10]M2'''',0)),(ph_setglobal_a(''''[LOCAL10]M2'''',ph_getglobal_n(''''[LOCAL10] M2'''')+1)))'',''0'','''',''809'',''104'',''91'',''64'',''0' ',''0'',''0'',''12632256'',''0'',''Arial'',''8'',''400'',''0 '',''0'',''2'',''4'',''C:\Program Files\powerhome\web\graphics\buttons\b10brown_50.gif'','''', ''6'',''0'',''0'',''1'',''50'',''50'',''AGM2U'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',40,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''12'',''5'',''if (ph_getglobal_n(''''[LOCAL10]H1'''')>11,(ph_setglobal_a(''''[LOCAL10]H1'''',1)),(ph_setglobal_a(''''[LOCAL10]H1'''',ph_getglobal_n(''''[LOCAL10] H1'''')+1)))'',''0'','''',''407'',''104'',''91'',''64'',''0' ',''0'',''0'',''12632256'',''0'',''Arial'',''8'',''400'',''0 '',''0'',''2'',''4'',''C:\Program Files\powerhome\web\graphics\buttons\b10brown_50.gif'','''', ''6'',''0'',''0'',''1'',''50'',''50'',''AGH1U'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',41,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10] '',''13'',''1'','''',''0'','''',''210'',''276'',''1038'',''1 60'',''0'',''0'',''15793151'',''12632256'',''0'',''Arial'',' '8'',''400'',''0'',''0'',''2'',''8'','''','''',''6'',''0'',' '0'',''1'',''50'',''50'',''RR3'')")
',0,'');
insert into macrodetail values ('ALARM CLOCK',42,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''14'',''1'','''',''0'',''[LOCAL10] H1'',''247'',''308'',''274'',''100'',''0'',''0'',''0'',''553 648127'',''0'',''Comic Sans MS'',''14'',''400'',''0'',''0'',''1'',''11'','''','''',''6'' ,''0'',''0'',''1'',''50'',''50'',''H1A'')")
',0,'');
insert into macrodetail values ('ALARM CLOCK',43,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''15'',''1'','''',''0'',''[LOCAL10] AMPM'',''937'',''308'',''151'',''104'',''0'',''0'',''0'',''5 53648127'',''0'',''Comic Sans MS'',''11'',''700'',''0'',''0'',''2'',''11'','''','''',''6'' ,''0'',''0'',''1'',''50'',''50'',''ATAMPMA'')")
',0,'');
insert into macrodetail values ('ALARM CLOCK',44,37,'',NULL,'Seq 16 Minute2A',0,'');
insert into macrodetail values ('ALARM CLOCK',45,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''16'',''1'','''',''0'',''[LOCAL10] M2'',''777'',''308'',''119'',''100'',''0'',''0'',''0'',''553 648127'',''0'',''Comic Sans MS'',''14'',''400'',''0'',''0'',''2'',''11'','''','''',''6'' ,''0'',''0'',''1'',''50'',''50'',''M2A'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',46,37,'',NULL,'Seq 17 M1A',0,'');
insert into macrodetail values ('ALARM CLOCK',47,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''17'',''1'','''',''0'',''[LOCAL10] M1'',''635'',''308'',''119'',''100'',''0'',''0'',''0'',''553 648127'',''0'',''Comic Sans MS'',''14'',''400'',''0'',''0'',''2'',''11'','''','''',''6'' ,''0'',''0'',''1'',''50'',''50'',''M1A'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',48,37,'',NULL,'Seq 18 ST1',0,'');
insert into macrodetail values ('ALARM CLOCK',49,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10] '',''18'',''1'','''',''0'','':'',''539'',''312'',''73'',''96 '',''0'',''0'',''255'',''553648127'',''0'',''Arial'',''14'', ''700'',''0'',''0'',''2'',''2'','''','''',''6'',''0'',''0'', ''1'',''50'',''50'',''ST1'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',50,37,'',NULL,'Seq 19 DATE1',0,'');
insert into macrodetail values ('ALARM CLOCK',51,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''19'',''5'',''ph_setglobal_a(''''[LOCAL10]DATE'''',TODAY())+ ph_setglobal_a(''''[LOCAL10]DAY'''',dayname(ph_getglobal_d(''''[LOCAL10]DATE'''')))'',''0'', ''[LOCAL10] DATE'',''768'',''560'',''288'',''44'',''0'',''0'',''0'',''15 793151'',''10'',''Comic Sans MS'',''7'',''700'',''0'',''0'',''0'',''9'','''','' '',''6'',''0'',''0'',''1'',''50'',''50'',''DATE1'')")
',0,'');
insert into macrodetail values ('ALARM CLOCK',52,37,'',NULL,'Seq 20 GB1',0,'');
insert into macrodetail values ('ALARM CLOCK',53,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''20'',''5'',''ph_setglobal_a(''''[LOCAL10]DATE'''',ph_relativedatetime (ph_getglobal_d(''''[LOCAL10]DATE''''),(1440)))+ ph_setglobal_a(''''[LOCAL10]DAY'''',dayname(ph_getglobal_d(''''[LOCAL10] DATE'''')))'',''0'','''',''1074'',''524'',''146'',''120'','' 0'',''0'',''0'',''12632256'',''0'',''Arial'',''8'',''400'',' '0'',''0'',''2'',''3'',''C:\Program Files\powerhome\web\graphics\buttons\b16_65.gif'','' '',''6'',''0'',''0'',''1'',''50'',''50'',''GB1'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',54,37,'',NULL,'Seq 21 GB2',0,'');
insert into macrodetail values ('ALARM CLOCK',55,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''21'',''5'',''ph_setglobal_a(''''[LOCAL10]DATE'''',ph_relativedatetime (ph_getglobal_d(''''[LOCAL10]DATE''''),(-1440)))+ ph_setglobal_a(''''[LOCAL10]DAY'''',dayname(ph_getglobal_d(''''[LOCAL10]DATE'''')))'',''0 '','''',''256'',''524'',''146'',''120'',''0'',''0'',''0'','' 12632256'',''0'',''Arial'',''8'',''400'',''0'',''0'',''2'',' '3'',''C:\Program Files\powerhome\web\graphics\buttons\b15_65.gif'','' '',''6'',''0'',''0'',''1'',''50'',''50'',''GB2'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',56,37,'',NULL,'Seq 22 DAY1',0,'');
insert into macrodetail values ('ALARM CLOCK',57,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''22'',''5'',''ph_setglobal_a''''[LOCAL10]DAY'''',dayname(ph_getglobal_d(''''[LOCAL10]DATE'''')))'',''0 '',''[LOCAL10] DAY'',''443'',''560'',''288'',''44'',''0'',''0'',''0'',''157 93151'',''10'',''Comic Sans MS'',''7'',''700'',''0'',''0'',''2'',''9'','''','' '',''6'',''0'',''0'',''1'',''50'',''50'',''DAY1'')")',0,'');
insert into macrodetail values ('ALARM CLOCK',58,37,'',NULL,'Seq 23 ALARM_NAME',0,'');
insert into macrodetail values ('ALARM CLOCK',59,38,'',0,'ph_sqlselect(3,"INSERT INTO ccbuttons (tab_id, sequence,button_type,button_key1,button_key2,key_desc,key_x, key_y,key_width,key_height,key_code,key_flag,key_text,key_bk grnd,key_border,fontface,fontsize,fontweight,fontitalic,font uline,fontalign,itemtype,filepath_up,filepath_down,brush_hat ch,pen_color,pen_style,pen_width,ellipse_height,ellipse_widt h,id) VALUES (''[LOCAL10]'',''23'',''1'','''',''0 '','' [LOCAL10] '',''343'',''948'',''818'',''96'',''0'',''0'',''0'',''126322 56'',''0'',''Arial'',''8'',''400'',''0'',''0'',''2'',''2'',' ''','' '',''6'',''0'',''0'',''1'',''50'',''50'',''ALARM_NAME'')")', 0,'');
insert into macrodetail values ('ALARM CLOCK',60,38,'',0,'ph_getglobal_t(''1111TIMESET'')',1,'');
|
|
|
In addition to the macro, in order hear the big ben chime you have to download the granddfatherclock.wav file and place it in your C:\Program Files\powerhome\web\ directory. If you rather play a different sound or even a macro or formula, leave an email here and I'll let you know what you have to modify. It's an easy change. Here is the zipped wav file. Download, unzip and make sure to put it in the correct directory 2009-03-02_181032_Noelswav.zip
How It Works:
When the Alarm Clock macro is played, using SQL, it checks certain PH data tables and adds rows of information to each table as appropriate. In this manner it actually builds the new tab and each control center graphic. It also automatically adds the necessary global variables in the global variable table.
The Alarm Clock macro is only played once. It is not used to set or play the alarm. It's used only to create a control center tab and the necessary global variables. If you play the Alarm Clock macro a second time it will create a second tab and a second alarm clock with its own global variables. This is useful if you want to have each member of the family have their own alarm clock.
All the logic of the alarm clock is built into the graphic buttons on the control center screen. The buttons use raw formulas and global variables to change the time and date and set and disable the alarm. In this version of the Alarm Clock the logic sets(or disables) a One Shot timed event. Only one alarm can be set per Alarm tab, although after the alarm has fired another alarm can be set since PH automatically deletes a Timed Event after it is executed.
Why do you want an Alarm Clock in PH?
Well, other than to play around with and to see how sql interfaces with PH and to see a clever use of global variables, you probably don't. In its present form its usefulness is limited. But with your help, perhaps it can be enhanced. There are many possible enhancements - including setting multi alarms from one CC tab. Giving each alarm a different name - listing the alarms that belong just to this tab and being able to set or disable each alarm. I'm working on this now by setting up a virtual keyboard to enter each alarm name on the tab (Dave gave me the idea). This can also be expanded so that the alarm is not one shot but has all the options of any timed event including days of the week, weekend, sunrise, sunset, offsets etc. Also, the alarm should be able to run anything - a macro, raw formula etc - just like any timed event.
So, if a timed event can perform all these things what is the purpose of this Alarm Clock? Well, in its ultimate form, it will be a graphical way to set a full fledged timed event and thus will be available for everyone in your household to use. Each person can have their own tab and set their own alarms. They won't have to know anything about PH or the PowerHome Explorer. It could be accessed remotely as well. So eventually, I think it will have a purpose. Right now I use it to set a one shot alarm from my iTouch.
If you have any suggests, would like to help improve the macro, have any graphic ideas (I am obviously graphically challenged) let me know. All ideas and suggestions are welcome.
Noel
|
Back to Top |
|
|
mustangcoupe Super User
Joined: August 08 2003 Location: United States
Online Status: Offline Posts: 308
|
Posted: May 09 2009 at 18:46 | IP Logged
|
|
|
I received the following error when I ran this in the multi editor
Invalid Direct SQL Code -131
SQLSTATE = 37000
[Sybase][ODBC Driver][Adaptive Server Anywhere]Syntax error or access violation: near ';' in ...of concept',0,0,1)[;] ...
__________________ Todd Hannemann
HA newbie
PowerHome - UPB - ELK
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: May 09 2009 at 19:33 | IP Logged
|
|
|
When I checked it out it appears the forum bit again with quotes.
insert into macrodetail values ('ALARM CLOCK',20,38,'',0,'ph_sqlselect(1,"INSERT INTO global_variables (Id, Value) VALUES (''[LOCAL2]DAY'',dayname(today()))")',0,'');
Edited by BeachBum - May 09 2009 at 19:34
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: May 11 2009 at 11:00 | IP Logged
|
|
|
Is the downloaded file now OK?
Peter
|
Back to Top |
|
|
reighnman Newbie
Joined: October 04 2010
Online Status: Offline Posts: 26
|
Posted: December 28 2010 at 19:35 | IP Logged
|
|
|
so how do u make this work???
|
Back to Top |
|
|
mertfg Newbie
Joined: January 25 2011 Location: United States
Online Status: Offline Posts: 5
|
Posted: February 03 2011 at 03:42 | IP Logged
|
|
|
Hey, I am also very much interested in this alarm project. I just found out that it has some errors popping up when I try to run it. I think I may be at the wrong end. Is there any one who can help me out? I know this has been posted a little earlier way back in 2009, but I would appreciate any help in this regards. Thanks in advance for any help offered.
__________________ magnetic messenger
|
Back to Top |
|
|
|
|