yashsingh1/xdaforums huggingface dataset:
[Windows Mobile Software Development] poyensa:
JMLH has released JMLMenuSense v1.60 :D THANKS A LOT !!! so we can finish our CHTWNotes1

JMLH has created a very powerfull tool -at the same time very simple to use- for creating menus with Sense UI looking. Just install JMLMenuSense v1.60.cab (or higher) from here, then CHTWNotes1.cab -and enjoy!

JMLMenuSense allow you to create menus -Sense looking- via an XML file. It is really very easy and no need to know any program languange (see example inside JMLMenuSense folder & oficial thread). The XML has to be .xmu extension. So I have made a simple xml file (following the examples and with the help of Freezy1982, mkucuksari & specially JMLH) that save some values in the registry, just what we want for CHTWNotes1 to display :) the file CHTWnotes1.xmu is located in the kitchen \workspace\CHTS, then inside the cab set to be copied to windows folder

The only left to finish our widget is to link CHTWNotes1.lua to CHTWNotes1.xmu. So when the widget is pressed then the menu is open where we can write the note and some setting -text colour & font size.

This is done just adding the following code in the function CHTWNotes1Class.OnTimeReleased = function(self, object, complete)

CHTWNotes1Class.OnTimeReleased = function(self, object, complete)
self.hitFeedback:Release()
RunProgram("\\windows\\CHTWnotes1.xmu")
end

This should be enough, final test running _Deploy_to_device_in_dev_mode.bat press the widget and play a bit with the JMLMenuSense (this JMLMenuSense v1.60.cab -or higher- has to be installed previously) and then lets do the widget cab for share with XDA friends :)

Run _Generate_files_for_cab.bat (be sure this file has been edited correctly adding the file names of CHTWNotes1.lua & 56752DB4_manila) then the recompiled & renamed files will be found now in \cab\_final_file ready to be put inside the cab.

You can use the cab done for PoyTEST and addapt it to this new widget. All the files to be copied in windows folder. Also add the Setup.DLL. Then in Cabinet - Properties write your name as creator and the widget name as application name. Then in installation directory e sure t put the new folder under CHTAddons with the same name as the widget name. Save as CAB format and test it. BEFORE INSTALL THE NEW CAB DISSABLE DEVMODE

WARINING I have made CHTWNotes1, if you are doing your own widget do not use the same names! it will produce conflict. You can do CHTWNotes2, or CHTW_YourName_WidgetName.

continues here
[Windows Mobile Software Development] jdpl@:
Hi Poyensa,

My godness, I have been a little complicate my self doing a new icon set that I'm missing this good workshop....

No way, I going to stop my work rigth now and start to follow you in this one my firend :D

Thank you so much teacher, great work amigo.
[Windows Mobile Software Development] PMoto:
Hi Poyensa:

Where is the CHTWNotes1.cab link?... in the 21# post?

I wanna try that!

Thanks.
[Windows Mobile Software Development] poyensa:
Into chtwnotes1.rar. But do not forget to install JMLMenuSense.v1.60.cab previously ....
[Windows Mobile Software Development] MichelDiamond:
Outstanding work, Poy!

Thanx that you've made this excellent manual and I'm looking forward to enjoy much more nice widgets because of this sharing (and switching it by CHTS :) )

Also it's really good, that the widget will become cleaner and won't mess up Sense, if each dev sticks to the informations of this thread.

Micha
[Windows Mobile Software Development] meltwater:
Hi Guys,

Having problems with creating a suitable cab file to install a new switch.

I've been using the "CHTAddon_DevModeSwitch.cab" as my template but when I try to change the names I get a blank icon and a switch still named "DevMode Switch".

However, I have noticed that the Setup.dll in the cab differs from the one given in the Kitchen, so what gives here? Is the setup.dll supposed to be different?

How do I get the setup.dll to correctly name the CHTlua_manila file and refer to the CHT_switch_VolDPad.png instead of the CHT_switch_DevMode.png?

(I get an image if I add CHT_switch_DevMode.png to windows).

PS. VolDPad is a slightly adjusted version of the app made by Beemer Software (beemerTPPC), which thankfully had the source available.

This is my lauc code for CHTlua_manila:

Co0kieSwitchLink("VolDPad Switch", "\\Windows\\CHT_switch_VolDPad.png", _application.Store:GetValueChangedEvent(Lifetime_Permanent, "VolDPad.Active"), function(l_1_0)
Shell_NavigateTo("\\Windows\\VolDPad.exe", "")
end
, function(l_2_0)
if _application.Store:GetIntValue(Lifetime_Permanent, "VolDPad.Active") == 0 then
return false
else
return true
end
end
)

I've not renamed any files or worked out what manila name I need since I don't quite know how that bit fits together for toggle switches. Using the setup.dll from the kitchen I don't get any new switch available.
[Windows Mobile Software Development] Dunc001:
OK, there is a seperate kitchen for addon links and the Setup dll is different to the one in the widget kitchen. Give me a couple of minutes and I'll upload it for you. I'll take a quick look at the script too...
[Windows Mobile Software Development] Dunc001:
Addon Links Kitchen

@Meltwater - Addon Links Kitchen attached below. For the script where is the VolDpad.Active registry key located in the registry? Also, as VolDpad is an exe how are you exiting the app when you toggle the switch to off? If it helps here is the uncompiled script for the dev mode switch:

-- File name: 6ADCC943_manila -- \windows\htc\home\scripts\home\chtlinksdev.luac

-- switch links - parameters: display_name, icon_path, event_change_notifier, function_to_execute_on_tap, get_current_state_function
Co0kieSwitchLink("DevMode Switch", "\\Windows\\CHT_switch_DevMode.png", _application.Store:GetValueChangedEvent(Lifetime_Permanent, "CHTI.AddonWidgets.DevMode")
,function(self)
if _application.Store:GetIntValue(Lifetime_Permanent, "CHTI.AddonWidgets.DevMode") == 0 then
_application.Store:SetIntValue(Lifetime_Permanent, "CHTI.AddonWidgets.DevMode", 1)
else
_application.Store:SetIntValue(Lifetime_Permanent, "CHTI.AddonWidgets.DevMode", 0)
end
end
,function(self)
if _application.Store:GetIntValue(Lifetime_Permanent, "CHTI.AddonWidgets.DevMode") == 0 then
return false
else
return true
end
end)
[Windows Mobile Software Development] meltwater:
The registry is set in the usual htc/manila location. 1st time you run VolDPad it sets it to 1, then the next time it detects it is running, set it to 0 and terminates itself.

Perhaps the kitchen I had was out of date (had a bit of both in I think), will try the one you posted. Many thanks.

UPDATE:

OK, I end up with the same cab file as I did using the other one as a template. Although, I have a feeling that the lua file didn't get replaced correctly (which would explain what happens)...so retrying!

Yep that was it after all! Will re-make the icon (just used the spanner one for test), but here's the cab for now (I'll remove the duff one).

Thanks for your help!
[Windows Mobile Software Development] Dunc001:
Glad you got it working :cool: First of many addons from you we hope... ;)
[Windows Mobile Software Development] meltwater:
Was so close! :) Thanks for the help, was just what I needed.
[Windows Mobile Software Development] kalhimeo:
I investigated this a little bit more during the last days, and I am facing a problem with the functions and variables names.

I successfully edited the mode9 and the lua files replacing PoyTEST with kalTEST ( updated the .bat and qtc with the correct manila hash, etc) but as soon I replace PoyTEST with a name which has not 7 characters (ie. kalhimeoWidget), it will make sense to crash. For the mode9 variable names (PoyText1, PoyGraphic1) I was able to change those to anything I want, that's ok.

I was not able to find any reason for this, is it a CHT limitation ? Am I missing something ?
[Windows Mobile Software Development] 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.
[Windows Mobile Software Development] Dunc001:
I would have thought \n should work if the rest of the syntax is correct. Have you tried \r (return) instead? Post a code snippet and I'll see if I can help...
[Windows Mobile Software Development] Dunc001:
OK, so when you rename the widget script to kalhimeoWidget you need to get the new hashed name for the script (\windows\htc\home\scripts\home\kalhimeoWidget.luac = 5C390092_manila). This is the name you need to replace in the bat files along with the new script name - kalhimeoWidget.lua

The qtc filename doesn't go in the bat files, just make sure you rename the file in the qtc folder.
[Windows Mobile Software Development] kalhimeo:
Thanks for your reply.

That's exactly what I am doing, I successfully replaced PoyTEST with kalTEST (and modified the corresponding hashed name for luac and qtc) in that way. But for some reason, if I replace PoyTEST with something other than 7 characters, it crash.

To reproduce that, I took the sample kitchen of Poyensa, edited mode9 file replacing all "PoyTEST" with "kalhimeoWidget". Then used text editor to replace all "PoyTEST" with "kalhimeoWidget" in the CHTWidgetDev.lua and PoyTEST.lua files. I also modified the .bat file to compile the PoyTEST.lua to 5C390092_manila as you said. That makes sense to crash :/
[Windows Mobile Software Development] RoryB:
Thank you for being there. Right now I am just typing into poyensa's widget and trying to get line breaks. BTW \r did not work.
[Windows Mobile Software Development] poyensa:
You can look into CHTWNotes1, I have done this widget starting from PoyTEST and it has names with more than 7 characters. If it does not help you can also upload your kitchen and we will have a look ...
[Windows Mobile Software Development] poyensa:
I added the property multiline to the text (in mode9) to be displayed in the note (CHTWNotes1_Text1), so should be no problem there. A good example for that is the RSS widget ...

But the problem (for me) is how to input the line break. The way that Widget Notes works is reading from the registry, and the way i do write in the registry is usin JMLMenuSense. I really do not know much about program languages, so i dont know how to force the new line in xml language. Maybe there is an easier way to write in the registry with mortscrip.
[Windows Mobile Software Development] 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

Time
Name
Location

for an appointment.
[Windows Mobile Software Development] poyensa:
I would try something like ...

If this gets complicated then I will try to define 3 variables <GlesText> in mode9 and play with them in the lua file.
[Windows Mobile Software Development] RoryB:
What I have done is added to your note widget and it does give me three lines.

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:

check if any notifications exist for meetings or tasks

figure out how to get the data of the current active one

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.
[Windows Mobile Software Development] RoryB:
Okay, for S and Gs I tweaked my script that lists my active reminders to also change the values of CHT.Notes1.txt, CHT.Notes2.txt and CHT.Notes3.txt to be the information for the most current active reminder. The sticky note updates automatically to match.

Now to do some reading on how to do IF statements in luac.

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

Okay, I see if statements in the manual.

Currently we use GetCHTSettingString to get registry value of Text. How do I get registry values outside HKCU\Software\HTC\Manila registry location?
[Windows Mobile Software Development] RoryB:
My contribution to the kitchens. Place Dev_off.mscr.txt Dev_on.mscr.txt and MortAutoRun.exe in the Tools folder.

Place z_stop_dev.bat in the kitchen main folder and edit z_init.bat to include this

@echo off
pushd tools

rapicopy -e .\RestartManila.exe \windows\RestartManila.exe
rapicopy -e .\Dev_On.mscr.txt \windows\Dev_On.mscr
rapicopy -e .\Dev_Off.mscr.txt \windows\Dev_Off.mscr
rapicopy -e .\MortAutoRun.exe \windows\Dev_On.exe
rapicopy -e .\MortAutoRun.exe \windows\Dev_Off.exe

rapistart \windows\Dev_On.exe
echo.
echo.
echo.
echo.
echo.
echo.
echo When done you can run Dev_Off.exe from root of phone
echo or run z_stop_dev.bat from this directory
echo.
echo.
pause

This lets you be sure the DEVMode is activated during initialization and lets you deactivate it from your PC too. I also rewrote the batch files to get rid of the message when a sub-folder is empty.
[Windows Mobile Software Development] poyensa:
thats a god question. the answer is in cht source but i still havent found it :) something related to music_helper and others. I shall tell u more when get back to my pc
[Windows Mobile Software Development] 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

_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.
[Windows Mobile Software Development] poyensa:
You can use then

machineStatus.CurrentTime.OnValueChanged:connect(Handle_CHTWNotes1)
[Windows Mobile Software Development] RoryB:
Would this make it run Handle_CHTWNotes every second as the time changes?
[Windows Mobile Software Development] rat_2665:
No, for an update every second you have to use the timer function:

Handle_CHTWNotes_Timer = timer(1) -- time in seconds
Handle_CHTWNotes_Timer:Stop()
Handle_CHTWNotes_Timer.OnElapsed:connect(Handle_CHTWNotes)
Handle_CHTWNotes_Timer:Start()
[Windows Mobile Software Development] RoryB:
How often would it run with

machineStatus.CurrentTime.OnValueChanged:connect(Handle_CHTWNotes1)
[Windows Mobile Software Development] rat_2665:
every minute (at full minute).
[Windows Mobile Software Development] RoryB:
Thank you. What I would really like to figure out is how to monitor a registry key outside HKCU\Software\HTC\Manila and if it exists run the script or by then maybe I will have written the lua code to do it.
[Windows Mobile Software Development] rat_2665:
Two examples for reading and setting

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.
[Windows Mobile Software Development] RoryB:
Thank you again. I wish I did not have to run off. Can't wait to try some of this out.
[Windows Mobile Software Development] RoryB:
Currently I have the 1 second timer run a mortscript. I have not been able to get the registry read method to work. What I want to do is read the registry to see if the value exists and only run the script if it does. Otherwise I think I am using more power than I should.

I have tried

Handle_Reminder1 = function()
x = MusicHelper_GetRegDWORDValue(2, "ControlPanel\\Backlight", "LightDetectOn")
If x ~= nil Then
Run( "Reminder.exe") I forgot the actual code I used here
End
End

It keeps saying error in lua compile of missing "=" near x.

I have tried other things I have fonud on line, but they give a similar error.
[Windows Mobile Software Development] rat_2665:
Did you use "If" , "Then" and "End" instead of "if", "then" and "end" in the real code? And which line is missing the "="?
[Windows Mobile Software Development] poyensa:
Also would add 'else' just before first 'end'
[Windows Mobile Software Development] poyensa:
Final touches for CHT Notes Widget

comming from here

I am going to add 2 layouts in the CHTWidgetDev.lua:

wCHTWNotes1.layoutName[0] = "layout1"
wCHTWNotes1.SetLayout[0] = function()
CHTWNotes1_Graphic1:SetTexture("\\windows\\CHTWNotes1.png")
end

wCHTWNotes1.layoutName[1] = "layout2"
wCHTWNotes1.SetLayout[1] = function()
CHTWNotes1_Graphic1:SetTexture("\\windows\\CHTWNotes2.png")
end

Also must change line 8 wCHTWNotes1.layoutCount = 2

With this change I am adding 2 layouts to the widget, in each will be used a diferent texture for the Note (CHTWNotes1.png & CHTWNotes2.png). Each layout will be selected by traditional way in Edit Mode >> keep pressing over the widget >> next layout

Many other layout can be set by this method, the 6 layouts of the flip & analogic clock in home as example. Into the SetLayout function you can place position, opacity, width, textures, and many other properties. Again use CHT source (and other CHTwidget kitchens) to find what your need.

Now that the texture for the note is assigned in CHTwidgetDev, it has to be deleted from CHTWNotes1.lua (just adding double -- at the begining). You have noted that I have changed also the path and format from .qtc to .png, as it is much easier for later graphic edition to use png files instead manila qtc files. With this change we have to delete the file 1F88A376_manila in \locales (no more use of it) and add CHTWNotes1.png & CHTWNotes2.png in \png folder of the kitchen.

Then find some nice & free files for the CHTWNotes.png in the web, fix some small bugs .... and my baby is dressed for the dance :) it earned own thread, so keep this for others.

:D

continues here
[Windows Mobile Software Development] RoryB:
Okay, I do tend to use If, Then, etc. I changed to if, then, etc.

Here are my tries:

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

Handle_Reminder1 = function()

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

same error. Then

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

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
[Windows Mobile Software Development] poyensa:
I liked the first option, just small corrections:

Handle_Reminder1 = function()
x = MusicHelper_GetRegDWORDValue(2, "ControlPanel\\Backlight", "LightDetectOn")
if x == nil then
RunProgram( "\\windows\\Reminder.exe")
else
end
end
[Windows Mobile Software Development] rat_2665:
Can you check out:

Handle_Reminder1 = function()

local loc1 = MusicHelper_GetRegStringValue(2, "System\\State\\Shell\\Reminders", "Active")

if loc1 == nil then

RunProgram("\\windows\\Reminder1.exe")
end
end

But the term "MusicHelper_GetRegStringValue" is an analogy. I didn't find any MusicHelper term with StringValue or IntValue in the Manila lua scripts, only DWORDValue. Once I also tried an analogy with the "GetValueChangedEvent". That didn't work.

Don't know if the syntax of RunProgram("\\windows\\Reminder1.exe") is correct. You have to try.

Edit: Hi, poyensa, same thought :) (didn't see your post before writing). But why the else before the ends?
[Windows Mobile Software Development] poyensa:
I am very "square-head" :D
[Windows Mobile Software Development] RoryB:
Currently tried

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

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

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()
[Windows Mobile Software Development] poyensa:
Hi RoryB, I am sorry I think I didnt help so much with the 'else' :(

if condition

then do whatever if condition is true

else do whatever if condition is false

end

" .... to run the exe if there is a value ...." have you tried this?

Handle_Reminder1 = function()
x = MusicHelper_GetRegDWORDValue(2, "ControlPanel\\Backlight", "LightDetectOn")
if x ~= nil then
RunProgram( "\\windows\\Reminder.exe")
end
end
[Windows Mobile Software Development] 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 *&^%$##@#@!$@
[Windows Mobile Software Development] 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.