dynamic calendar icon [fixed version]
dynamic calendar icon [fixed version]
Now with the ability to show the day or the month.
I posted time ago this script, but somebody asked for it, and with the new updates (and because it was wrong) I updated it.
The instructions are: (watch the video for better understanding)
– Change in the script the label of the item, by default it is ‘Calendar’
– By default it shows the day, change the ‘month’ variable to true to show the month
– Open the icon picker (just choose an icon of an item), then search for the item you want. If it support a dynamic calendar, you will find 31 icon, all the same but with different numbers. Just long press the one with the number 1 a toast will say that the data was copied. You can press back now to cancel.
– In the script, where it says, paste that data.
– Set the script in the resumed event of the container with the item.
It is now ready to use.
Note: if it don’t work, paste that data I mentioned here in a comment. Due to the long variety of icon packs I couldn’t test all.
Another note: it only updates the icon when the day/month change, if you want to force it (because you changed the icon or whatever) run the script from the item.
I hope it works, any error just comment.
]]>
< ![CDATA[
//go to the icon picker and search the 31 items. Long click the first one (it will be copied) and paste it here between the brackets
var link = [ ]
//This is the label of the item to put the icon to
var labelName = “Calendar”;
//write true to set the calendar based on the month. By default it’s false: based on the day
var month=false;
//end of config
if(link.length==0){alert(“follow the instructions and paste the icon properties in the script”);return;}
LL.bindClass(“java.util.Calendar”);
var now=Calendar.getInstance().get(month?Calendar.MONTH:Calendar.DAY_OF_MONTH);
if(month)now++;
//only when change, or run from item
if(now.toString()==LL.getScriptTag()&&LL.getEvent().getSource()!=”MENU_ITEM”)return;
LL.setScriptTag(now);
var iconPackName = link[0];
var prefixName = link[1].substring(0,link[1].length-1);
var item=LL.getEvent().getContainer().getItemByLabel(labelName);
if(item==null){alert(“no item found, make sure the label is the same as in the script”); return;}
var icon=LL.createImage(iconPackName,prefixName+now);
if(icon==null){alert(“no icon found, make sure the pasted data is right and the icon pack have it”);return;}
item.setCustomIcon(icon);
]]>
< ![CDATA[
funny 🙂 and it’s great with your video tutorial 😉
]]>
< ![CDATA[
Brilliant, sir. Amazing work
]]>
< ![CDATA[
This is great.
]]>
< ![CDATA[
Cool
I’ll check the script and let you know
Thanks
Video is a great help
]]>
< ![CDATA[
TrianguloY
I have the alert “no item found”
My app is Agenda in French
]]>
< ![CDATA[
Bruno-Isa LAMOUR-ARNOULD in the script, there is a line at the beginning where it says
var labelName = “Calendar”
Just edit it and write the label of the app, for example
var labelName = “Agenda”
]]>
< ![CDATA[
TrianguloY it’s what I’ve done. Not working 🙁
]]>
< ![CDATA[
Do I simply copy and paste the script in the first comment and make the changes required? Also if I’m on the right track where do I copy it to?
]]>
< ![CDATA[
Adam Caine to the script editor.
Then set the script in the resumed event of the container (or of the item itself)
Make sure you followed all steps
]]>
< ![CDATA[
Thanks for all your help TrianguloY one last question on this subject 😁, is it possible to set more than one dynamic calendar in the app drawer? I have today settings which is basically a calendar widget pack, which I have set to today’s app icon, is it now possible to add a second dynamic calendar to Google calendar or is it only possible to have one dynamic calendar in the app drawer or on the desktop at a time?
]]>
< ![CDATA[
The easiest for you is to make a new script and paste this script twice, one after another.
Then modify each subscript with the necessary settings (make sure the label is different) and set it in the resumed event.
]]>
< ![CDATA[
Awesome! Thanks again.. 👍😎
]]>
< ![CDATA[
Having a problem setting this up again, I’ve tried a few different packs but no joy. I keep getting label not found. This is the icon pack would the label be “google_calander” from this pack?
https://lh3.googleusercontent.com/x6rZ6BuVWM9YEvYhTqu4eetG7V0jKakjB8wqftIkBJSS5PsViSt8OCVLskLg1j36VqClUM_9cUM
]]>
< ![CDATA[
The variable labelName should be the label your item has. The variable link should be [“com.maxpatchs.ango” , “google_calander_1”]
If still you have an error, write the exact message you are getting.
This script was made for a previous lightning version, and maybe it is broken. I’ll try to fix it if this is the case.
]]>
< ![CDATA[
TrianguloY I have “com.maxpatchs.ango/google_calander_1” set for the variable and “google_calander” set as the label. The error message reads “no item found, make sure the label is the same as in the script”
]]>
< ![CDATA[
That error is because you item have a different label.
Long tap the item, click the pencil to edit, click ‘edit label’.
Write something, for example
itemlabel
Then in the script set
var labelName = “itemlabel”;
(You can set the name you want, but both need to be the same)
Then, for the other variable, you need to simply paste. When you long tap in the icon picker, the toast shows both names separated with a slash, but the clipboard takes the “package”,”name” format, simply paste between the [ ]. Your exact line should be:
var link = [ “com.maxpatchs.ango” , “google_calander_1” ]
]]>
< ![CDATA[
TrianguloY I renamed the label which was “calendar” so that’s why I got the error. I thought I was supposed to take the actual icons name. I renamed it to “GCal” just to experiment, I don’t get the error message but the icon hasn’t changed either.
Edit: Icon changed when midnight struck 😃 Thanks for your help again.
]]>