FORUMS

[CHTwidget]CHTw Reminder

2,920 posts
Thanks Meter: 771
 
By RoryB, Inactive Recognized Developer on 22nd June 2011, 02:02 PM
Post Reply Email Thread
I decided to pull my Reminder widget information out of How-To-Make-A-CHT-Widget and continue developing. I'll start this thread by pulling relevant posts from the original location.

************************************************

My latest release. See the snapshots.

Change log:

19 Jan 2012: Added Alarms to show on Reminder widget. Added slide to unlock feature to respond to alarm quicker. Also, added some registry tweaks to monitor changes to call reminder just like the task widget does to catch changes to tasks.
04 Jan 2012: Some tweaks trying to get it to update quicker and clean up the code based on things I have learned since the last issue.
19 Sep 2011: Updated since it stopped letting me switch pages or lock the phone properly
03 Sep 2011: Updated since it stopped working for me with the latest ROM flash
30 Jun 2011: Fixed unread event count and improved exclude newline feed if any line in the appointment or task is empty.
24 Jun 2011: Exclude newline feed if a line in the appointment or task is empty.
23 Jun 2011: It has the ability to include date and/or time at the top of the sticky note. I added this feature for my lockscreen to have the date somewhere on the screen and I thought it would be easier than adding date to the clock widget. It uses the date and time settings of CHT.

Modes:

0) Blank - no date or time
1) Date and time in one line
2) Date and time on two lines
3) Date only
4) Time only

Mode 4 looks the same as the fourth picture, but with the time instead of the date.

****************************************
Uploaded the kitchen files
Attached Thumbnails
Click image for larger version

Name:	Screenshot0.jpeg
Views:	596
Size:	55.7 KB
ID:	634286   Click image for larger version

Name:	Screenshot1.jpeg
Views:	259
Size:	56.8 KB
ID:	634287   Click image for larger version

Name:	Screenshot2.jpeg
Views:	233
Size:	56.8 KB
ID:	634288   Click image for larger version

Name:	Screenshot3.jpeg
Views:	422
Size:	44.3 KB
ID:	634289  
Attached Files
File Type: cab Rory_CHTwReminder1.cab - [Click for QR Code] (62.6 KB, 70 views)
File Type: zip CHTW_Reminder1.zip - [Click for QR Code] (255.5 KB, 32 views)
The Following 5 Users Say Thank You to RoryB For This Useful Post: [ View ] Gift RoryB Ad-Free
22nd June 2011, 02:04 PM |#2  
RoryB's Avatar
OP Inactive Recognized Developer
Flag Lexington
Thanks Meter: 771
 
Donate to Me
More
The beginnings of the idea:
Quote:
Originally Posted by RoryB

@poyensa: How can I force a linefeed or <cr> in your Note widget?
I would like to force line breaks, but \n or <br> or ^LF^ or ^CR^ do not work.

I am thinking of taking your work and creating a sticky note that shows the most current active reminder or notification, but it would look better if it had line breaks.

22nd June 2011, 02:05 PM |#3  
RoryB's Avatar
OP Inactive Recognized Developer
Flag Lexington
Thanks Meter: 771
 
Donate to Me
More
My hopes for the functionality:
Quote:
Originally Posted by RoryB

That is where I am heading. I am thinking of using MortScript to read three registry values and place them into the note registry value with the linebreak so I get

PHP Code:
Time 
Name 
Location 
for an appointment.

22nd June 2011, 02:06 PM |#4  
RoryB's Avatar
OP Inactive Recognized Developer
Flag Lexington
Thanks Meter: 771
 
Donate to Me
More
Getting it figured out:
Quote:
Originally Posted by RoryB

What I have done is added to your note widget and it does give me three lines.

Code:
CHTWNotes1_Text1.String = GetCHTSettingString("Notes1.Text", "Time") .. "\n" .. GetCHTSettingString("Notes2.Text", "Meeting") .. "\n" .. GetCHTSettingString("Notes3.Text", "Location")
I also changed the angle of the text to 5 degrees and the default font size to 14. Now to work out how to:
  1. check if any notifications exist for meetings or tasks
  2. figure out how to get the data of the current active one
  3. and transfer it to the widget
I know the registry keys to check, but the ones for the current active one changes based on a few factors.

22nd June 2011, 02:09 PM |#5  
RoryB's Avatar
OP Inactive Recognized Developer
Flag Lexington
Thanks Meter: 771
 
Donate to Me
More
One of my tries for automatic updating:
Quote:
Originally Posted by RoryB

What I have working so far is a Reminder1.mscr and the autorun.exe renamed to Reminder1.exe so I can call it in Handle_CHTWNotes1 = function() . Currently if any of the three CHT registry values change this function runs and updates the sticky. I am trying to use

PHP Code:
_application.Store:GetValueChangedEvent(Lifetime_Permanent"CHT.Misc.System.UpTimeExact"):connect(Handle_CHTWNotes1
to get it to update the sticky note and it seems to work, but not always. It would be much nicer if I could have the widget polling these registry values outside manila and then getting the value of the registry key to know where to find the other registries. I could keep the script and exe if I needed, but it would be nice to have a way to watch for "HKCU", "System\State\Shell\Reminders", "Active" to exist and have a value.

================

It seems the registry key CHT.Misc.System.UpTimeExact does not update every minute even though it is in minutes. I am going to search the base applications in CHT to see if there is a way I can add a system status check for reminders.

22nd June 2011, 02:11 PM |#6  
RoryB's Avatar
OP Inactive Recognized Developer
Flag Lexington
Thanks Meter: 771
 
Donate to Me
More
Some information from:
Quote:
Originally Posted by rat_2665

Two examples for reading and setting

Code:
MusicHelper_GetRegDWORDValue(0, "Software\\HTC\\Manila\\", "HomeShortcutNum")
MusicHelper_SetRegDWORDValue(0, "Software\\HTC\\Manila\\", "HomeShortcutNum", totalCount)

MusicHelper_GetRegDWORDValue(2, "ControlPanel\\Backlight", "LightDetectOn")
MusicHelper_SetRegDWORDValue(2, "ControlPanel\\Backlight", "LightDetectOn", 1)
where the first argument is:

2 = HKCU
0 = HKLM

Didn't find the ValueChangedEvent yet. Workaround would be to read the value every second (with timer), save the value and in the next cycle compare the saved value with the new value.

22nd June 2011, 02:12 PM |#7  
RoryB's Avatar
OP Inactive Recognized Developer
Flag Lexington
Thanks Meter: 771
 
Donate to Me
More
Some head banging against the wall:
Quote:
Originally Posted by RoryB

Okay, I do tend to use If, Then, etc. I changed to if, then, etc.

Here are my tries:

Code:
Handle_Reminder1 = function() 

if Reminder1_GetRegStringValue(2, "System\\State\\Shell\\Reminders", "Active") = null then
else
RunProgram("\\windows\\Reminder1.exe")
end
end
I get error LuaC: ..\Workspace\_lua\CHTWReminder1.lua:50: 'then' expected near '='Source: .. and line fifty is the if statement.Then
Code:
Handle_Reminder1 = function() 

if Reminder1_GetRegStringValue(2, "System\\State\\Shell\\Reminders", "Active") = nil then
else
RunProgram("\\windows\\Reminder1.exe")
end
end
same error. Then
Code:
Handle_Reminder1 = function(self) 

self.Reminder1 = Reminder1_GetRegStringValue(2, "System\\State\\Shell\\Reminders", "Active")
if self.Reminder1 = nil then
else
RunProgram("\\windows\\Reminder1.exe")
end
end
still same error.


The value does not exist at all if there are no reminders, and it varies if there are more than one depending on which one is active.

Another try
Code:
Handle_Reminder1 = function(self) 

self.Reminder1 = "test"
if self.Reminder1 = "" then
else
RunProgram("\\windows\\Reminder1.exe")
end
end
still the same error

My brain must be dead. I should be using == for the if statement and not just =

-----------------------------
Still not working

22nd June 2011, 02:13 PM |#8  
RoryB's Avatar
OP Inactive Recognized Developer
Flag Lexington
Thanks Meter: 771
 
Donate to Me
More
Getting closer:
Quote:
Originally Posted by RoryB

Currently tried

Code:
Handle_Reminder1 = function()
    x = MusicHelper_GetRegDWORDValue(0, "System\\State\\Reminder\\Count", "APPT")
    if x == nil then
    else
        RunProgram( "\\windows\\Reminder.exe")
    end
end
The else is to run the exe if there is a value. This still does not work. Same for
Code:
Handle_Reminder1 = function()
    local loc1 = MusicHelper_GetRegDWORDValue(0, "System\\State\\Reminder\\Count", "APPT")
    if loc1 == nil then
    else
        RunProgram( "\\windows\\Reminder.exe")
    end
end
----------------

I can use this and it works
Code:
Handle_Reminder1 = function()
RunProgram( "\\windows\\Reminder.exe")
end

Handle_Reminder1_Timer = timer(1) -- time in seconds
Handle_Reminder1_Timer:Stop()
Handle_Reminder1_Timer.OnElapsed:connect(Handle_Reminder1)
Handle_Reminder1_Timer:Start()

22nd June 2011, 02:15 PM |#9  
RoryB's Avatar
OP Inactive Recognized Developer
Flag Lexington
Thanks Meter: 771
 
Donate to Me
More
Frustration:
Quote:
Originally Posted by RoryB

That would work as well. I am about to post an update. It seems lua code did not like the tabs in the code file. Without them I think it might be working. I need a couple reminders to come through to verify.

----------------------

Forgot to comment out a run command so it still is not working.

--------------------------------------------

Started trying to clean it up and broke it *&^%$##@#@[email protected]

22nd June 2011, 02:15 PM |#10  
RoryB's Avatar
OP Inactive Recognized Developer
Flag Lexington
Thanks Meter: 771
 
Donate to Me
More
Got tit working again:
Quote:
Originally Posted by RoryB

Just to let you guys know I have it working again. Currently using the timer method. I accidentally deleted a character from the name of the exe file and was calling runprogram("\\windows\\reminder.exe") instead of runprogram("\\windows\\reminder1.exe"). It is terrible that it took me the whole day to realize this mistake.

Now I am going to keep trying to figure out how to track a change event outside manila registry keys for activation instead of the time. This would avoid running a script to copy the registry values for the sticky note.

Also I want to figure out how to use long press to start the settings for font size and color so I can keep tapping for bringing up the notification. Right now it runs a script that if there are no reminders it brings up settings and if there are it does as described below.

Or maybe I can have the stick pin as a tap point for settings and the note as the tap point for bringing up the notification.

Of course I have not figured out how to bring up the poom dialog, but just run a script that has a mouseclick at the top center of the screen to bring up the notification page that shows status, emails, reminders, etc.

22nd June 2011, 02:16 PM |#11  
RoryB's Avatar
OP Inactive Recognized Developer
Flag Lexington
Thanks Meter: 771
 
Donate to Me
More
Moving forward:
Quote:
Originally Posted by RoryB

I have this working

Code:
Handle_Reminder1 = function() 
-- 0 = HKLM
-- 2 = HKCU
  x = MusicHelper_GetRegDWORDValue(0, "System\\State\\Reminder\\Count", "APPT") + MusicHelper_GetRegDWORDValue(0, "System\\State\\Reminder\\Count", "APPTALLDAY") + MusicHelper_GetRegDWORDValue(0, "System\\State\\Reminder\\Count", "TASK") + 1
    if x == 1 then
        CHTWReminder1_Text1.String = "No Active" .. "\n" .. "Reminders" .. "\n" .. "at this Time"
    else
        Shell_NavigateTo("\\windows\\MortScript.exe","\\windows\\Reminder1.mscr")
    end
end

Handle_Reminder1()

Handle_Reminder1_Timer = timer(1) -- time in seconds
Handle_Reminder1_Timer:Stop()
Handle_Reminder1_Timer.OnElapsed:connect(Handle_Reminder1)
Handle_Reminder1_Timer:Start()
Made an adjustment to get the registry to update to no reminders.
Code:
Handle_Reminder1 = function() 
-- 0 = HKLM
-- 2 = HKCU
  x = MusicHelper_GetRegDWORDValue(0, "System\\State\\Reminder\\Count", "APPT") + MusicHelper_GetRegDWORDValue(0, "System\\State\\Reminder\\Count", "APPTALLDAY") + MusicHelper_GetRegDWORDValue(0, "System\\State\\Reminder\\Count", "TASK") + 1
    if x == 1 then
        _application.Store:SetStringValue(Lifetime_Permanent, "CHT.Reminder1.Text", "No Active")
        _application.Store:SetStringValue(Lifetime_Permanent, "CHT.Reminder2.Text", "Reminders")
        _application.Store:SetStringValue(Lifetime_Permanent, "CHT.Reminder3.Text", "at this Time")
    else
        Shell_NavigateTo("\\windows\\MortScript.exe","\\windows\\Reminder1.mscr")
    end
end
Now to figure out how to read string values outside the manila registry and I will not need the script.

Post Reply Subscribe to Thread

Tags
cht, manila, sense, widgets

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes