[Q] Random Bitmap display In Widget - Zooper Widget General

I have a widget with a few items in it. 1 is a bitmap.
What I would like to do is know if I can randomly show a different one, based on a set timeframe (or even time of day)
I have see the following in advanced parameters, however, it does not seem to change the bitmap... so I'm not sure what to do...
Maybe if you can explain some of the params in it, it would help:
Code:
[ b ]/sdcard/walls/$#Dm#>0?(int((random())*10))$.jpg[ /b ]
I get the math part of it... but I guess what I'm wondering is, what is #Dm#, and what is ? mean...
Does it mean, that every 1 minute, the next random .jpg in the series will show?

kevp75 said:
I have a widget with a few items in it. 1 is a bitmap.
What I would like to do is know if I can randomly show a different one, based on a set timeframe (or even time of day)
I have see the following in advanced parameters, however, it does not seem to change the bitmap... so I'm not sure what to do...
Maybe if you can explain some of the params in it, it would help:
Code:
[ b ]/sdcard/walls/$#Dm#>0?(int((random())*10))$.jpg[ /b ]
I get the math part of it... but I guess what I'm wondering is, what is #Dm#, and what is ? mean...
Does it mean, that every 1 minute, the next random .jpg in the series will show?
Click to expand...
Click to collapse
I have changed the code to be:
Code:
[ b ]/sdcard/walls/$#Dm#%30>0?(int((random())*10))$.jpg[ /b ]
and have verified that there are 1 - 10.jpg's in the location specified, but everytime I unlock the screen the image changes... and a popup happens... stating "No wallpapers added"
I think I can figure out the "No wallpapers" part, but why does the image change on every unlock? I can't sit and watch my screen for an hour to verify that they change every 30 minutes... but I assume that they would...

Related

Programatically update today screen image

Hi all,
First a little background into what I'm attempting...
On my PC, I have a self created program which swaps the desktop image to one selected at random from a predetermined directory. There's lots of nifty features, such as image resizing to fit desktop, support for different images on different monitors in a multi monitor setup. etc.
But enough about that, as it's not really windows mobile related. What is related is the fact i'm trying to implement something similar on my Xperia X1.
Obviously I want it so I can have different images for the today screen when it's in landscape and portrait mode - like the built in themes do. I have to admit i'm fairly miffed that this feature isn't supported nativly in a nice easy non-theme related way. it's nigh-on impossible to find an image that looks good in both aspects.
Anyway, I did have something working. A small program which creates a stwater_480_800.bmp and stwater_800_480.bmp by selecting a random image from one of two predetermined directories, and then plonking said images in the windows directory. (Replacing the two bmp images put there by the theme i was using) No resizing of images or anything fancy, just a straight file copy.
This line of code:
SendMessage(HWND_BROADCAST, WM_WININICHANGE, 242, 0)
forces the today screen to update to the lovely new images after the files have been replaced.
All was well until I installed gtrab's excellent pure windows mobile 6.5 update (http://forum.xda-developers.com/showthread.php?t=588882). And although the app still works for the main part, i.e. it picks an image, and changes the background for the today screen, i have encountered a bug.
The image behind the updated start menu doesn't get refreshed - it stays as whatever the image was when the phone was last reset (Think it's specifically a hard reset? i.e. holding power button down the rebooting with sony ericsson logo etc).
Here's the code i'm currently using (Apologies for lack of comments, despite being employed as a vb.net programmer, i'm self taught and not commenting is a bad habit i've never gotten out of.)
Code:
Public Shared Sub SwitchBG()
Randomize()
Dim curdir As New IO.DirectoryInfo(SharedVars.LandscapeDir)
Dim imagefiles As IO.FileInfo() = curdir.GetFiles("*.bmp")
If imagefiles.Length > 0 Then
IO.File.Delete("Windows\stwater_800_480.bmp")
IO.File.Copy(imagefiles(Math.Floor(Rnd() * imagefiles.Length)).FullName, "Windows\stwater_800_480.bmp")
Else
MessageBox.Show("No Landscape Images!", "BGSwitcherPPC", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
End If
curdir = New IO.DirectoryInfo(SharedVars.PortraitDir)
imagefiles = curdir.GetFiles("*.bmp")
If imagefiles.Length > 0 Then
IO.File.Delete("Windows\stwater_480_800.bmp")
IO.File.Copy(imagefiles(Math.Floor(Rnd() * imagefiles.Length)).FullName, "Windows\stwater_480_800.bmp")
Else
MessageBox.Show("No Portrait Images!", "BGSwitcherPPC", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
End If
SendMessage(HWND_BROADCAST, WM_WININICHANGE, 242, 0)
End Sub
I'd love to know what I have to do to force the start menu image to refresh. I've googled for a while with no joys.
Incidentally, I did discover that i can use .jpgs for the background (makes sense really). Not sure if that will have any bearing, but i'll be changing the code to accept both bmp, jpgs, and probably gifs. Can't see that it will affect my specific problem, but thought it would be worth mentioning.
Once i've got this sorted, i'll be ready to tackle the next stage, which is implementing some form of schedule so i can wake up to a new today screen image every day.
Thanks in advance to anyone with any pointers.
Matt.
Sorry, just realised I should have posted this in the windows specific forum.
Still, any help much appreciated!
Okay, I've managed to do this. Via a hacky work-around.
Basically, I realised after a bit of playing, that if you set a "normal" wallpaper, all it does is create a registry key. But, rather handily, the start menu and lock screens (lock was also affected by this bug) would see this change, and update their pic.
Also, rather handily, if you set the registry to an image that doesn't exist, the image then defaults back to the appropriate stwater
so the workaround is as follows...
Every time i run the switch code, I write an incrementing value to the HKCU\software\windows\today\wall registy value. This can be anything, providing it's not a "real image"
when you next open the start menu, it looks for this "new" image, can't find it, so loads the appropriate stwater image.
I'm gona stick the program in an Xperia forum for some feedback/suggestions.
edit: link to app: http://forum.xda-developers.com/showthread.php?t=594763

[Q] How to use multiple "IF"

hello i wanted to know how exactly should i write it down so that i can make different situations for example
if its x=1 new address else if x=2 new address else if x=3 new address and etc
i think im having problem with the $ placement, i wrote
$x=0?*b*/sdcard/*/b*:x=2?*b*/sdcard/*/b*:x=30?*b*/sdcard*/b*$
the /sdcard/ was just example i did include the real address on the code
where ever you see * i meant [ or ] it just xda forum changes it to BOLD so i couldnt write and after [/b
vitalero said:
hello i wanted to know how exactly should i write it down so that i can make different situations for example
if its x=1 new address else if x=2 new address else if x=3 new address and etc
i think im having problem with the $ placement, i wrote
$x=0?*b*/sdcard/*/b*:x=2?*b*/sdcard/*/b*:x=30?*b*/sdcard*/b*$
the /sdcard/ was just example i did include the real address on the code
where ever you see * i meant [ or ] it just xda forum changes it to BOLD so i couldnt write and after [/b
Click to expand...
Click to collapse
Zooper doesn't support nested conditions, so you can't to if-else conditionals. As long as your situations are not overlapping and only one condition is true at the same time, you can just write them as multiple single conditionals to work around this.
could you give me an example? i made 10 different situations and only 1 can be true at each time
and each time that it changes it takes a different file with the [/b command
vitalero said:
could you give me an example? i made 10 different situations and only 1 can be true at each time
and each time that it changes it takes a different file with the [/b command
Click to expand...
Click to collapse
Something like this:
Code:
$#situation#=1?<whatever you want for that condition>$
$#situation#=2?<whatever you want for that condition>$
$#situation#=3?<whatever you want for that condition>$
$#situation#=4?<whatever you want for that condition>$
...
This is obviously just an example to give you the general idea. I'm sure you are able to work your conditions and output into it
Thanks mate works just fine

[Q] Time Remaining on Track Progress Bar?

So I'm using the #TMU_TRACK_PERC# line in the progress bar and I want a way to display how much time is left in the song.
This is what I've come up with:
Code:
$((TMU_TRACK_LENGTH#-#TMU_PLAYTIME#)/100)$
Of course, this returns the result in the format m.ss instead of m:ss (where m = minutes and ss = seconds), but oh well.
Now the problem I run into is that when the song is paused, instead of showing me the track length, it shows me "Unknown". So I thought I could solve this with conditionals like so:
Code:
$#TMU_TRACK_LENGTH#=Unknown?:$((TMU_TRACK_LENGTH#-#TMU_PLAYTIME#)/100)$
But all it gives me is $.
How do I fix this?
Just delte the $ in the middle.
CopKiller76 said:
Just delte the $ in the middle.
Click to expand...
Click to collapse
But now when the song plays it just gives me this:
-((TMU_TRACK_LENGTH#-#TMU_PLAYTIME#)/100)
minions301 said:
So I'm using the #TMU_TRACK_PERC# line in the progress bar and I want a way to display how much time is left in the song.
This is what I've come up with:
Code:
$((TMU_TRACK_LENGTH#-#TMU_PLAYTIME#)/100)$
Of course, this returns the result in the format m.ss instead of m:ss (where m = minutes and ss = seconds), but oh well.
Now the problem I run into is that when the song is paused, instead of showing me the track length, it shows me "Unknown". So I thought I could solve this with conditionals like so:
Code:
$#TMU_TRACK_LENGTH#=Unknown?:$((TMU_TRACK_LENGTH#-#TMU_PLAYTIME#)/100)$
But all it gives me is $.
How do I fix this?
Click to expand...
Click to collapse
Easier solution is to just use #TMU_REMAINING_TIME#. No need to do complicated math and way easier to handle in conditionals
kwerdenker said:
Easier solution is to just use #TMU_REMAINING_TIME#. No need to do complicated math and way easier to handle in conditionals
Click to expand...
Click to collapse
Haha. Oh. Yeah, that would be easier. I didn't know that existed! I searched for something like that but didn't find it. Thanks!
minions301 said:
Haha. Oh. Yeah, that would be easier. I didn't know that existed! I searched for something like that but didn't find it. Thanks!
Click to expand...
Click to collapse
Sure, no problem. Here is a dump of all available variables for future reference. You might find it useful
MU_PLAYTIME - Pretty string indicating how long current track is playing
MU_PLAYTIME_MILLIS - Total playing time in milliseconds
MU_TRACK_PERC - Total track percent played
MU_REMAINING_TIME - Pretty string indicating how track remaining time
MU_REMAINING_MILLIS - Total remaining time in milliseconds
MU_TRACK_NUM - Track number on album
MU_TRACK_LENGTH - Pretty string indicating track length
MU_TRACK_LENGTH_MILLIS - Total track length in milliseconds
MU_ALBUM - Album name
MU_ARTIST - Artist name
MU_TRACK - Track name
kwerdenker said:
Sure, no problem. Here is a dump of all available variables for future reference. You might find it useful
MU_PLAYTIME - Pretty string indicating how long current track is playing
MU_PLAYTIME_MILLIS - Total playing time in milliseconds
MU_TRACK_PERC - Total track percent played
MU_REMAINING_TIME - Pretty string indicating how track remaining time
MU_REMAINING_MILLIS - Total remaining time in milliseconds
MU_TRACK_NUM - Track number on album
MU_TRACK_LENGTH - Pretty string indicating track length
MU_TRACK_LENGTH_MILLIS - Total track length in milliseconds
MU_ALBUM - Album name
MU_ARTIST - Artist name
MU_TRACK - Track name
Click to expand...
Click to collapse
Awesome, thanks!

Easy way to get really cool animations on Watchmaker

Ok first of all im not good in english, do'nt:silly: blame me
Since i got the moto 360 i was looking for any watchface with cool animations. There was difficult to find what i was looking for. But, I found watchmaker and i got really good looking watchfaces on face repo. I read some of the Lua Watchmaker wiki and try to aply animations. No luck. But i asked a few times in Google+ community and i got the understanding. Now i will try to post what i think is one of the most beautiful and simple animation i've had on my mind since smartwatches appeared on the market. I would recommend you to do this in a copy of your watch face because if you are not too experienced you can modify a misunderstood value and you have to download the entire watch face again.
EDIT: Corrected error on "on_display_bright()"
Instructions:
1 - Find a watchface you can edit, go to the script and write this code because it makes the magic:
Code:
tweens.rotate_sec=1
tweens.rotate_min=1
tweens.rotate_hour=1
function on_display_bright()
wm_schedule {action='tween', tween='rotate_sec', from=0, to=1, duration=1.5, easing=inOutCirc}
wm_schedule {action='tween', tween='rotate_min', from=0, to=1, duration=1.3, easing=inOutCirc}
wm_schedule {action='tween', tween='rotate_hour', from=0, to=1, duration=1, easing=inOutCirc}
end
(*You can change all the values of duration and easing, but you will find more easing functions on the Watchmaker Lua Wiki
2 - Now you have to find the 3 gauge layers and edit the "Rotation" parameter. In most of cases you will find:
{drs} on seconds
{drm} on minutes
{drh} on hours
(*this can vary in many cases like {drss} simulating automatic watches but the important thing is the layer (parenthesis in a parenthesis (i really like {drss}))) -> ok pls staph!
you have to change "Rotation" parameters in each layer to this:
on seconds
Code:
tweens.rotate_sec*{drs}
on minutes
Code:
tweens.rotate_min*{drm}
on hours
Code:
tweens.rotate_hour*{drh}
3 - Send to the watch.
I recommend to set the "Display" parameter of this 3 layers to Bright only if you don't use it in ambient mode. The main reason is unless you do it, if you wake up the watch a lag occurs between last position of gauges before slept and the animation, and it looks weird. You can try it.
I hope you enjoy it, because it is easy to implement it to your watches and I think it's really cool.
Tell me if it works for you and if you like it. Post any variation of this code if you want to share it.
I can't post any watches due to commercial or non-commercial terms of use so i just post a video.
I can' post links because i'm new here but you can copy and paste in your browser and it works.
Regards
EDIT: here's a video of one of the examples:
dropbox.com/s/if7qa0z9mcv3sf8/VID_20150602_021553.mp4?dl=0
I'm getting an error on the script...also getting an error on the rotation values. I just copy/paste them in there...didn't free write them at all. you sure the code is correct? I know nothing about scripting so I can't find whats wrong.
it says 5: '(expected near'_display_bright' as the error code
any thoughts? running the beta app
There was a mistake on "function"
Hi, sorry about it, there was a mistake on the next lines:
A space between "on" and "_display". It should be written "on_diaplay". thats all
function on _display_bright()
function on_display_bright()
You know green is the correct way forget the red marked line because is the error, everything seems to be correct now.
moracabanas said:
Hi, sorry about it, there was a mistake on the next lines:
A space between "on" and "_display". It should be written "on_diaplay". thats all
function on _display_bright()
function on_display_bright()
You know green is the correct way forget the red marked line because is the error, everything seems to be correct now.
Click to expand...
Click to collapse
that did it...looks fantastic!

Help... total newbie question...

All I need to know is in Zooper... can I display an image instead of the text displaying the day of the week... so for example... if I want to display a draw of a camel on Wednesday instead of the text 'Wednesday' or 'Wed' etc. can I do do this? I am sure it is possible... I just cannot figure out HOW Thanks for any help!
As you can tell from the below sample you can see that you should me able to write an expression that would allow you to not only change the date and time but to do exactly what you want. If you need any help please pm me and I'll help you out any way I can.
Cheers!
If I've been of help please hit the thanks button.
I$#BLEVN#>10?Good!:Look for a charger!$ will render “Good!” if battery level is greater than 10 or “Look for a charger!” otherwise
Rich Text [c=$#BLEVN# 10 && #BLEVN < 25 ? #FFFF00$$#BLEVN# >= 25 ? #00FF00$]#BLEVN#%[/c] will write battery level (es 10%) in RED if battery is 1) ? #C0EEEE$ will write first calendar entry day name writing “Today” if its today, “Tomorrow” if tomorrow, the name of the day otherwise
$#C0SHH:mm#!=00:00$ will render the starting HH:mm of first calendar event only if it is different than “00:00″
Is it August $#DM#=8?Yes:No$ will render “Is it August: Yes” during August, “Is it August: No” otherwise
$#LCN#!=Germany$ will render the Country name only if its not Germany (nothing otherwise)
$#C0D#=1?#C0Shh\:mm#$ will show the time of first calendar event start in 12 h format only if the entry is not an all day event (please remember to*escape*the “:” into “\:” otherwise it will be considered an “else” block!)
KiRyah said:
As you can tell from the below sample you can see that you should me able to write an expression that would allow you to not only change the date and time but to do exactly what you want. If you need any help please pm me and I'll help you out any way I can.
Cheers!
If I've been of help please hit the thanks button.
I$#BLEVN#>10?Good!:Look for a charger!$ will render “Good!” if battery level is greater than 10 or “Look for a charger!” otherwise
Rich Text [c=$#BLEVN# 10 && #BLEVN < 25 ? #FFFF00$$#BLEVN# >= 25 ? #00FF00$]#BLEVN#%[/c] will write battery level (es 10%) in RED if battery is 1) ? #C0EEEE$ will write first calendar entry day name writing “Today” if its today, “Tomorrow” if tomorrow, the name of the day otherwise
$#C0SHH:mm#!=00:00$ will render the starting HH:mm of first calendar event only if it is different than “00:00″
Is it August $#DM#=8?Yes:No$ will render “Is it August: Yes” during August, “Is it August: No” otherwise
$#LCN#!=Germany$ will render the Country name only if its not Germany (nothing otherwise)
$#C0D#=1?#C0Shh\:mm#$ will show the time of first calendar event start in 12 h format only if the entry is not an all day event (please remember to*escape*the “:” into “\:” otherwise it will be considered an “else” block!)
Click to expand...
Click to collapse
Hi! I saw this post of yours, I know it is late but I am trying to edit my calendar widget so that it displays the event in this format: *Month* *Day* *Day of the Week* *Time (if not an all day event)* *Event Title*
For example my first upcoming event is: Suits Season 5 Return @ January 27 at 6PM.
So the only way I could tweak it as closely to my preference displays as "Wed Jan 27 6:00PM Suits Season 5 Return". This is REALLY close to how I am trying to get it but the rich text is a bit complicated for me.
As of right now my current rich text is: #C0SEEE MMM d hh:mma# #C0TITLE#
I am trying to have it say, "Jan 27 - Wed - 6:00PM Suits Season 5 Return" AS well as for the time to disappear if it were an all day event instead. Do you think you can help me out with this? I tried to copy and paste in some of your code it wasn't really working for me.

Categories

Resources