yashsingh1/xdaforums huggingface dataset:
[Windows Mobile Themes] Sir.John:
Good morning mickael91210,

thanks for "volunteering" ;-) and your kind words

I meant to test "active=true" here:

ElseIf ( alarm_software = 2 ) AND (RegRead("HKCU", nextalarm, "Active") eq "True")

or did you mean something else?

But there is a problem indeed, which you will encounter, if you have no alarm set, you'll encounter "Something went wrong here". I need to seperate these two conditions to prevent that.

John
[Windows Mobile Themes] j101399j:
I think I found it; I'm still editing the code to make it better;

But my variable

reset = 0

is the reset command that resets the phone. I'll post the fixed code soon
[Windows Mobile Themes] chancer63:
Hi,

the last day I thought about the 'copy- the- correct- icon'- thing. It is a very long list of code, especially when you have 1, 2, ...99, 100%.

This is a solution:

1st

you read the batterylevel (bat)

2nd

you put the name of the icon together: batnew = 'battery' & bat & '.png"

3rd

the old batteryxx.png- name is stored in a registry- value (batold)

4th

you read the icons.xml- file and replace batold with batnew

5th

you store the batnew as batold again in the registry and reload iPT

PROBLEM:

The problem is the FIRST start of the script. You have NO registry value for batold and so you cannot replace batold with batnew.

SOLUTION:

You make a new icon in iPT, I suggest battery.png, and run ONLY ONE TIME a little script:

RegWriteString ( "HKLM", "Software\iPhoneToday", "baticon", "battery.png" )

Then you have the first correct value in the registry and the script can do its job. (I think a cab- file can easily do that as well....)

So here is my piece of script:

# read the battery level and find out the fitting icon
bat = BatteryPercentage ()

batnew = "battery" & bat & ".png"
batold = RegRead ("HKLM","Software\iPhoneToday","baticon")

#read if external power
extpow = ExternalPowered ()
If (extpow = 1)
batnew = "batteryc.png"
Endif

#save the old icon.xml as backup
Copy( "\iPhoneToday\icons.xml", "\iPhoneToday\icons.xml.backup", TRUE )

ini = ReadFile("\iPhoneToday\icons.xml")
ini = Replace(ini, batold, batnew)

Writefile("\iPhoneToday\icons.xml", ini)

ShowWaitCursor

#reload iPhoneToday
RegWriteDword ("HKLM","Software\iPhoneToday","reloadIcons",1)

#save the new batterylevel as the old one for the next script- call
batold = batnew
RegWriteString ("HKLM","Software\iPhoneToday","baticon",batold)

ATTENTION:

This is NOT a complete script. I think j101399j/ holdemdogg should check and understand it and insert it in their scripts. There are so many versions out there and I don't want to deliver a new one.... ;) (I know that my idea works, I have a complete script running for a day, always perfectly.)

THINGS FOR FUTURE:

My idea for now only works with 1, 2, .., 99, 100% and NOT with 10, 20, ..90, 100%. I was not able to find a way to to the following:

1st round the bat- value (72 to 70, 89 to 90 and so on...)

2nd then put together the battery- icon- name with the rounded value.

Okay, a lot of text, I hope I could make some things clear.

Have to go to work now...

CU
[Windows Mobile Themes] BigDaddyG:
For rounding to the nearest 10, you could try

Round(bat /10) * 10

For example, if bat was 74, Round(74/10) would equal 7 so multiply it by 10.

Cheers
[Windows Mobile Themes] Sir.John:
Hi chancer

I think an other approach for the first time should work too but with less hassle, and without a second script. Simply by adding a mortscript version of "IF NOT EXIST":

batold = RegRead ("HKLM","Software\iPhoneToday","baticon")

If ( batold = "" )
RegWriteString ( "HKLM", "Software\iPhoneToday", "baticon", "battery.png" )
Endif
[Windows Mobile Themes] chancer63:
I thought about that, too but if I write round(bat/10)*10 I get "unkown command 'round'"- error

and with bat = round(bat/10)*10 it's "Invalid parameter count for 'Round'".

:(

Any ideas?

Thanks for helping.

CU
[Windows Mobile Themes] chancer63:
@Sir.John:

Good idea! I will write that into the code.

Thank you.

CU

Edit:

If ( batold = "" )

gives an error, it must be

If ( batold eq "" )

because I compare two strings.

This is my code:

batold = RegRead ("HKLM","Software\iPhoneToday","baticon")
#if you run this script the very first time this will make sure that the correct starting value
#is in the registry:battery.png
If ( batold eq "" )
batold = "battery.png"
Endif

By the way:

Does it matter which part of the registry I use? HKLM or HKCU?
[Windows Mobile Themes] Sir.John:
For pocketpcs: to the best of my knowledge: no ..I haven't come across any software to login as another user on a PPC yet ;-)

as for: "eq" vs. "="

you're right, of course. I wasn't careful enough to read your code properly, sorry :-)
[Windows Mobile Themes] chancer63:
I hope, the smiley means that you know that I didn't want to proof you were wrong.

Really, I just wanted to tell that I am thankful for your help and that I used your advice and Mortscript came with an error message but you had the right suggestion.

Did it sound too much like a teacher?? Well, then "sorry", I am one :D.

CU
[Windows Mobile Themes] j101399j:
From iPT

I'm sure some of you have seen MiToNiOeS post on this, just in case, here it is. It is important for our scripts and wanted to let you guys know in case you would like another parameter. I asked for face text (like the clock and calender) that would let us create a memory icon that display on the icon, or a Batt % without a bunch of icon. And no need to reload the entire iPT xml file :)
[Windows Mobile Themes] j101399j:
Cool thank you, that will simplify my code a lot, just have to figure how to make it work. I needed that code.

If you don't mind, what subject do you tech/grade level do you teach? Without teachers the world would never learn anything

I have used reg keys in both areas and so far have not had any issues. Also why does eq and = give different results/error? Are they not the same, or is it which version of M.S. you use?
[Windows Mobile Themes] j101399j:
Can you devide the number by 10, then round. Does this look like it would work

# read the battery level and find out the fitting icon
batPer = BatteryPercentage ()

batNum = (batP / 10)

bat = Round( batN )

batnew = "battery" & bat & ".png"
batold = RegRead ("HKLM","Software\iPhoneToday","baticon")

This will round the % to 0 - 10. And since it rounds normally 5% = 10% or 1.png and 4% = 0% or 0.png. That way your % is not 0-10, 11-20, it is more 0%-4% = 0.png (0%), 5%-14% = 1.png (10%) ... 85-94% = 9.png (90%) and so on...

# read the battery level and find out the fitting icon
batPer = BatteryPercentage ()

bat = Floor( batPer )

batnew = "battery" & bat & ".png"
batold = RegRead ("HKLM","Software\iPhoneToday","baticon")

This will round the % down to the cloestest 10. It will post: 0%-9% = 0.png (0%), 10%-19% = 10.png (10%) ... 80-89% = 80.png (80%) and so on...

# read the battery level and find out the fitting icon
batPer = BatteryPercentage ()

bat = Celi( batPer )

batnew = "battery" & bat & ".png"
batold = RegRead ("HKLM","Software\iPhoneToday","baticon")

This will round the % up to the cloestest 10. It will post: 0%-10% = 10.png (10%), 11%-20% = 20.png (20%) ... 81-90% = 90.png (90%) and so on... I don't link this opne since I could be at 1% and still think I am at 10%
[Windows Mobile Themes] j101399j:
@CU

What exactly does

ini = ReadFile("\iPhoneToday\icons.xml")
ini = Replace(ini, batold, batnew)
Writefile("\iPhoneToday\icons.xml", ini)
ShowWaitCursor

do? Well I understand basically what it does, but how does it do it? And how does it know which icon to replace?If I understand it, it copies the entire icons.xml file into ini, then replaces all occurences of batold with batnew and then rewrites the icon file.
[Windows Mobile Themes] Sir.John:
Pleasure :-) "eq" compares alphanumerical values "=" only numerical ones.
[Windows Mobile Themes] Sir.John:
No, not at all. no offense taken at all, rest assured :-) au contrair, actually: I really meant to say I should have been more careful prior to burst out "help". Would have saved time for all of us ;-)

John
[Windows Mobile Themes] Sir.John:
My alarm script is up for grabs in a new version: now it should work for

-> Klaxon 2

-> G-Alarm

-> PocketWakeUp

though G-Alarm is not tested yet. please feel free to do so and left me some feedback on the flaws you encounter.

I changed the name to sjAlarm as it covers more alarm software than only Klaxon now. Find the link in my signature :-)

Enjoy!

John
[Windows Mobile Themes] chancer63:
Well, it's quite simple: ReadFile reads the whole icons.xml and writes it to a new file named ini and Replace searches the whole ini and everywhere where Replace finds a string with the value of batold (and that's the name of the old batterylevel- icon) it replaces this string with the value of batnew (the name of the new batterylevel- icon).

(This would mean, for example, if you have four or more icons, all of them with battery62.png, it would replace all of them with battery61.png.)

Writefile writes ini back and makes it to icons.xml again. And then iPT has to refresh and you have the new batterylevel- icon.

I got this idea from analyzing moesfeld's getweather- script. (THX to him!)

Showwaitcursor is just to "see" something in the whole process but on my Diamond it's so fast that there is no waitcursor to see.

Your suggestion for rounding:

I tried all of your suggestions before: round, ceil, floor. The problem is that every time I get this error: "Invalid parameter count for 'Floor'". :(

CU
[Windows Mobile Themes] chancer63:
When I start your sjAlarm, GAlarm opens and when I close it, the clock icon always changes to aoff.png although I have an alarm. Although a wrote "notify_me = 1", I don't get a message.

CU
[Windows Mobile Themes] j101399j:
I have the same "rounding problem". I may just need to create a few more if's
[Windows Mobile Themes] j101399j:
Neon battery icons
[Windows Mobile Themes] Sir.John:
Thanks for the feedback. If anyone would like to try a corrected version, get the new script from the initial post (delete .beta.txt obviously) and let me know, if that helped.

Thanks,

John
[Windows Mobile Themes] chancer63:
Batterylevel, Rounding Problem

Problem solved!

# read the battery level and find out the fitting icon
bat = BatteryPercentage ()

#if you don't like a step- by- step Countdown (99..98..97....), remove the next # and you'll get 90,80,70,...
#[SIZE="5"]bat = bat - bat mod 10
[/SIZE]
batnew = "battery" & bat & ".png"
batold = RegRead ("HKLM","Software\iPhoneToday","baticon")

Remember: this is NOT a complete script, only a little part...

If you'd like to understand what 'bat = bat - bat mod 10' does, you have to dive deeeep into maths :D:

If you divide two numbers then you often get a remainder: 72/10 = 7 R 2. 'mod' is a mathematical operation that has the remainder as the solution: 72 mod 10 = 2. So I calculate: 72 - 72 mod 10 = 72 - 2 = 70 or 28 - 28 mod 10 = 28 - 8 = 20. It's a kind of always rounding to the floor...

CU
[Windows Mobile Themes] Sir.John:
chancer is right here. I will just add some parenthesis an color to make clearer in which order stuff gets calculated:

a)

72 - (72 mod 10) = 72 - 2 = 70

b)

28 - (28 mod 10) = 28 - 8 = 20
[Windows Mobile Themes] j101399j:
I competly forgot about mod. Makes perfect sence thank you
[Windows Mobile Themes] Sir.John:
Is anyone here using CradleAlarm and is willing to provide me some registry keys for this alarm sw?

John
[Windows Mobile Themes] j101399j:
wierd; alarms and reminders not working when running "RunAt" scripts

Something very wierd, and this was noticed by Sir.John (http://xdaforums.com/showpost.php?p=4291567&postcount=18) with my clock I created. For the past few mornings, my alarms and calender reminders did not go off in the moring until I soft reset my phone. As soon as I do, it goes crazy. Currently I am only running CU's/my battery script (updated every 15 mins during the day and 90 mins at night. When I go to sleep, I put my phone in sleep mode and charge it at night; and when I wake it up in the morning, it takes a while for everything to catch up. Almost like when the phone is turned on, all of the scripts wait and then run at once. Anyone else noticing this?

To test if it is the battery script, I have disabeled the RunAt, and now it only runs when the icon is pressed. I'll let this run for the next few days and see if it continues...
[Windows Mobile Themes] chancer63:
BatteryLevelIndicator

Hi,

how can you see a step-by-step level (99, 98, 97, ...) without having 100 icons?

Here is the answer:

- write the extact percent value in the name of the icon and then

- round the percent value and you only need 10 icons.

Here is a PIECE of code for this:

.............

# read the battery level and find out the fitting icon
bat = BatteryPercentage ()
batround = bat - bat mod 10

# this is the name of the icon
batnew = "battery" & batround & ".png"
batold = RegRead ("HKLM","Software\iPhoneToday","baticon")

# this is the new exact percent value
batstatusnew = bat& "%"
batstatusold = RegRead ("HKLM","Software\iPhoneToday","batstat")

#if you run this script the very first time this will make sure that the correct starting values
#are in the registry:'battery.png' and 'dummy'
If ( batold eq "" )
batold = "battery.png"
Endif
If ( batstatusold eq "" )
batstatusold = "dummy"
Endif

#read if external power
extpow = ExternalPowered ()
If (extpow = 1)
batnew = "batteryc.png"
batstatusnew = "extPow"
Endif

#save the old icon.xml as backup
Copy( "\iPhoneToday\icons.xml", "\iPhoneToday\icons.xml.backup", TRUE )

#replace the values for icon and iconname
ini = ReadFile("\iPhoneToday\icons.xml")
ini = Replace(ini, batold, batnew)
ini = Replace(ini, batstatusold, batstatusnew)

.............

You must start with an icon "battery.png" and the name "dummy". Then you have the right starting values that can be replaced by the present values.

Again, this is only a PIECE of the script.

CU
[Windows Mobile Themes] bbonzz:
there's an error here: the final set state must be 1, otherwise you'll stuck on screen 2
[Windows Mobile Themes] j101399j:
Opps, I see the error, I edited the post and fixed the attachment. YOu may need to delete the reg to get it to start woirking again.
[Windows Mobile Themes] brandonhall517:
im trying to get the battery script to work on my tilt using iphone today theme. nothing shows up on the icon, and if i click it it says, the file battery battery cannot be opened. either it is not signed with a trusted certifiate or one of its componets cant be found. any ideas?
[Windows Mobile Themes] bbonzz:
Same here with version 003: wrong icon, wrong time, no notification
[Windows Mobile Themes] Sir.John:
Thanks for your feedback. One question though: what do you mean when you say: "wrong time"?

John
[Windows Mobile Themes] chancer63:
batterylevelindicator by chancer63, v. 0.9.20090823

#ThankYous go out

#to MiToNiOeS for his wonderful iPhoneToday

#to Mort for his great work (I hope he stays tuned, I LOVE his MortPlayer :)),

#to j101399j and holdemdogg for helping and interesting suggestions,

#to Sir.John, I learnt a lot from his toggle- scripts,

#to moesfeld who set the fire in me with his weather- script

#to Punker for his battery icon template

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

How to install

0) Attention, if you had another version of a batterylevel script running, remove any entries from NotificationQueue.

Use OmapClockRemover.exe, included in the zip- file. (It worked on my VGA- devices, don't know for Q/WVGA...)

1) Unpack the zip- file (if necessary, change *.zip to *.rar).

2) Copy the content of \battery\ to \iPhoneToday\ (...the path to the icons and the script must be \iPhoneToday\battery\

3) Create a new icon (or change the former battery icon) with the following values:

Name: dummy

Image: \iPhoneToday\battery\battery.png

Execute: \iPhoneToday\battery\mybatterylevel.mscr

Attention, the name of the icon 'battery.png' and the name 'dummy' must exactly be the same!

4) Click on the icon and the script should do its work.
[Windows Mobile Themes] chancer63:
...and another one from me: Everything worked the last week (GAlarm).

But on Saturday I had this:

The next alarm is set for Monday, the "Alarm Days" are set to "1" but the clock icon was the one with the red alarm notification.

It seems that no matter how many days the next alarm is away, there is always shown the alarm icon. Only if I have absolutely no next alarm, I have the white no- alarm clock.

(No problem for me, btw, because I have always some alarms ...:).)

CU
[Windows Mobile Themes] bbonzz:
That i see the current clock time (if i select "clock" in icon properties), or nothing at all (if i select "normal").
[Windows Mobile Themes] j101399j:
I am not done with it yet, but I am working on a modified screen switch script. Not only will it swap the icons.xml file; but it will also swap the settings file as well. This will allow me to have really large icons when I access my phonebook page. Does anyone know if RedrawToday () will also cause iPT to reread the settings.xml?

EDIT

I just tried it; and it does. I am blind and when I use my screen swap to pull up mu phone book, I am now able to have hugh icons. And since there are less on a page, it am looking at my phone less when calling and driving :). I'll update my script when I have the last few bugs worked out.
[Windows Mobile Themes] j101399j:
Request

@holdemdogg It looks like we are getting some really cool scripts. Wwould it be possible to have links to each on the 1st post, that way when one gets updated, the creator will update the original post, and anyone looking for it will find it easily?

Just an idea
[Windows Mobile Themes] j101399j:
The cab file is attached to the post
[Windows Mobile Themes] Sir.John:
This is exactly what it was designed to do. I intented it to be a supplement for the running clock icon ion order not to waste "iconspace" Until now there wre no plans to show the alarm-time set...only whether there is one or not, but other than mitos alarm notification (that shows alarms set in 2011 as well as the one set for tomorrow) the number of days can be defined that are checked for set alarms.

For more information, please read my initial post for this script. It's all in there ;-)

John
[Windows Mobile Themes] chancer63:
MemoryLevelIndicator

#ThankYous go out

#to MiToNiOeS for his wonderful iPhoneToday

#to Mort for his great work (I hope he stays tuned, I LOVE his MortPlayer :),

#to j101399j and holdemdogg for helping and interesting suggestions,

#to Sir.John from whom I learnt a lot from his toggle- scripts,

#to moesfeld who set the fire in me with his weather- script,

#to Punker for a psd- template

I really don't know if it's worth showing free available memory in an icon but it's not really different to the batterylevel- script so I did it....

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

How to install

0) Attention, if you had another version of a memorylevel script running, remove any entries from NotificationQueue.

Use OmapClockRemover.exe, included in the zip- file.

1) Unpack the zip- file (if necessary, change *.zip to *.rar).

2) Copy the content of \memory\ to \iPhoneToday\ (...the path to the icons and the script must be \iPhoneToday\memory\

3) Create a new icon with the following values:

Name: dummy

Image: \iPhoneToday\memory\memory.png

Execute: \iPhoneToday\memory\mymemorylevel.mscr

Attention, the name of the icon 'memory.png' and the name 'dummy' must exactly be the same!

4) Click on the icon and the script should do its work.
[Windows Mobile Themes] Sir.John:
I updated the Alarmscript with version 0.0.4 (beta) available for download as .txt. Hopefully the G-Alarm issues have been addressed, as have been multiple other things I wanted to do.

Main new feature is support for MortPlayer's alarm function.

For more infos and download please follow the appropriate link in my sig :-)

Have fun!

John
[Windows Mobile Themes] bbonzz:
As before, John: wrong icon, wrong time. This time i have the notification:

"Script has run successfully! Next alarm set to: :" (but it's blank).

using G-Alarm 2.2

btw, icon has to be set as "clock", isn't it?
[Windows Mobile Themes] Sir.John:
Hi bbonzz,

Would you mind to post an registry export of your G-Alarm branch. This is to be found at "HKCU\Software\ageye\g-alarm" in order for me to check your version settings. (it runs for other g-alarm users, e.g. chancer appearantly)

as for the "wrong time" issue: please read my recent reply to your post. There is no such thing as "wrong time" for this application. And yes, it is intended to run as "type: clock". In case you see a wrong time there, please check your system settings.

John
[Windows Mobile Themes] chancer63:
I'm quite sure that there must be a change in the GAlarm- registry.

I use the last free version 1.5.1 and there was no problem for me.

THX, Sir.John for your new version. I'll try it and will give report. (MortplayerAlarm would be great :)!)

CU
[Windows Mobile Themes] bbonzz:
Here it is, attached

I have understood the icon should display the alarm time, isn't it? Instead, it show my system time (eg: now it's 13.06 and my alarm is tomorrow at 10.15: the icon shows 13.06)

EDIT: ok, i see. But, forgive me, if it's not intended to show next alarm time it's a waste of genius...
[Windows Mobile Themes] Sir.John:
Thanks for the registry output, I'll check that :-)

Icon display: no, you misunderstood it. This script was not designed to show the alarm time, but to make extra use of the clock icon showing the system time. Pretty much as it does all along. As I took it, you wanted to have the set alarm time as well, I implemented that in the notification for now (which is empty, as it does not yet work for you, I'm afraid)

Hope that makes it somewhat clearer :-)

John
[Windows Mobile Themes] bbonzz:
Yes, now i got it, thanks :-)

and i guess the workaround making 3600 icons and chosing the right one is too heavy (should be 72megs of icons, at least)...
[Windows Mobile Themes] Sir.John:
Showing the alarm time would be the easiest part as long as I use MortScript. To display this on an icon, I would like to check the latest development of Mitos iPT. I would consider images for displaying a clock remotely senseless ;-)

as for your version of G-Alarm: strangly enough the system of storing information in the registry was changed since 1.51....and that doesn't make life easier. The string i usually read for G-Alarm is "OneTime". in your version this is:

"OneTime"="2009.3.19.6.41.0"

which reads as 19th March 2009, 6:41 am. This is the reason, why your alarm is OFF: the date is long gone. (in version 1.51 this is the actual date the alarm is set to, not the date the alarm was first created, as it is in your case as I guess)

Whether the alarm is set to ring or not seems to be determined by another registry string reading:

"LastExecution"="20090724"

but this is outdated as well, so frankly said: I'm at a loss here :-(

Questions to lighten up my cluelessness:

-Is your system time set one month back by any chance?

-Is my script starting up your G-Alarm software alright (means: when running the script, does G-Alarm start, too?)

-Do you have any G-Alarm mods or hacks installed?

-Do you have more than one version of G-Alarm installed on your system?

John, clueless atm :-(
[Windows Mobile Themes] bbonzz:
nope, it up to date

yes

nope, only the background image

nope, only version 2.2

now:

-you're right about the OneTime, that now is the creation date.

-LastExecution is already past (20090825, so this morning), so it's useless

-but there's a key that is the solution: inside 0,1,2,3,4,5,6 subkeys, you'll find the string "Active". If TRUE, then the alarm is set, if FALSE is not set

-PluginAlarmLine gives you the time
[Windows Mobile Themes] bbonzz:
About icon showing time, if only we had a command line sw that merges 2 .png's this should be done (blank clock+overlay hours+overlay minutes=85 icons total, less than the battery). I've given a quick look but seems such an app doesn't exist...