I made for myself Calendar script, which I found useful, if you use Freeplane for project managing, maybe it can somebody else helps. And also I am not very experienced programmer, espetially in Groovy/Java (I spent last few years by "holiday" programming in Python only :) ), so maybe somebody should have an idea, how to improve/rewrite them in clearer way.
Calendar script asks for year, for which should be calendar generated, create a new node with calendar and split all days of generated calendars to structure in week order. For better overview it colors months. It could be useful for diary, or workflow tracking, or for settings reminders etc.
I tested it for few years, seems everything works as expected.
Installation:
- Installation is common: Copy & paste script below, paste it in new file, called e.g. Calendar.groovy, put the file into freeplane_dir/scripts and restart Freeplane. Script will appear in Tools->Scripts.
Features:
- You can use your own translations to generate localized calendar. Days are named according to your localization of Freeplane automatically
- You can pick your own favorit color to colorize calendar :)
Known problems:
- Few days, which can belong to previous week (last week of previous year) is not neccessary on their right spot (monday over monday grid).
- Translations should be solved in better way: If you use translations with diacritics (ěščřžřý...), it will be broken during create calendar from "external" script - means installed script. If you put these script straight into some node of your map, everything seems well.
Possible improvement: Split nodes also in accordance to month.
Hope it helps :)
Testing, reporting, improvement, some feedback, will be welcome.
// "Universal calendar"
// ====================
//
// Generates node structure, divided by weeks of year, with one node per day.
// It is suggested for example for create journal of work - in other words
// to manage your day schedule.
//
// If you wish to change colors of calendar, or comments, change lines above in your own.
//
// Created by: (c) Ferdinand Mravenec, 2017
//
// If the localization dont work properly, load script into node in Freeplane. Then it
// will work correctly. Problems are caused only during run this script external.
//Translations
def input_year = "Input year" //en_EN
//def input_year = "Zadej rok" //cs_CZ
def valid_year = "Input is not valid (probably letter?)" // en_EN
//def valid_year = "Chyba v zadání (možná písmeno?)" // cs_CZ
def calendar_name = "Calendar" //en_EN
//def calendar_name = "Kalendář" //cs_CZ
def week_name = "Week" //en_EN
//def week_name = "Týden" //cs_CZ
// Color
def clr = "#F0E68C" // default is khaki - "#F0E68C"
// Ask user for year
def user_input = ui.showInputDialog(node.delegate, input_year, "")
def year
try {
year = user_input.toInteger() // if it is not year...
} catch (Exception ex) {
ui.informationMessage(valid_year) //... then stop
return
} finally {
}
//Node with calendar
def outnode = node.map.root.createChild(calendar_name + " " + year.toString())
def childnode = outnode
def monthnode = outnode
def first_week = true
// Iterating through whole year (note, year can be irregulate)
for (i = 0; i <= 366; i++){
def caldate = new Date().copyWith(year: year, month: Calendar.JANUARY, dayOfMonth: 1) + i //init calendar for first day of year
if (caldate.format("yyyy") == year + 1) break // Stop when year changes
// Week numbering
def week = round(i / 7) + 1 // first week is really first
if (week > 52) week -= 52 // if it goes over week 52, normalize it
// Initial conditions for rests of previous year
// (First week of year begins with first monday in year. It means, that if 1.1. is Sunday, first week will begin at Monday 2.1.)
if (i <= 7 && first_week)
{
childnode = outnode.createChild(week_name + " 52") // create node for rests of previous year
first_week = false // do it only for once
}
// For each new monday create new week
if (caldate[Calendar.DAY_OF_WEEK] == Calendar.MONDAY){
childnode = outnode.createChild(week_name + " " + week.toString())
}
// Create node for each day...
childnode = childnode.createChild(caldate.format("EEEE dd.MM."))
//... and add some eye-candy
if (caldate.format("MM").toInteger() % 2 == 0) childnode.style.backgroundColorCode = "#F0E68C"
}
outnode.setFolded(true) // set it folded ...
c.select(outnode) // ... and set focus on results node
Last edit: Ferdinand Mravenec 2017-06-21
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I didnt post it to incubator scripts page, because I expected, that exists better way, how to solve similar issue (whenever I see yours "xxx.each{...}" stuff :) ), maybe there is some problem, what I overview and, of course, I havent access yet :) So maybe a bit later :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'd like to try out both of these calendar scripts simultaneously for comparison purposes, (and heck, I might like both and have a use case for both of them on different occasions) but they both have to be named "calendar.groovy" in my scripts folder, which is problematic.
Do you guys have a suggested solution?
Last edit: Leo Staley 2018-01-25
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Seems calendars as mind maps are not very popular. But I do use mine to put some things like vacations, sick days for me and other people I work with or things to do at a specific date sometimes.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I created the Calendar.groovy file in my scripts folder, I restarted freeplane, and then, in my map, I right clicked on my node, "Test Calendar," and freeplane gave me an error:
Error executing the script:
No such property: JANUARY for class: Calendar at line -1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Looking at the scripts you've developed I think freeplane is a very interesting tool for a diary + calendar.
With a template system, you can imagine keeping a diary that includes meeting notes, references (readings, sites) but also events (calendar). However, I see a major obstacle: export. Would some of you have ideas on the best solutions for a possible export. An export in .ics would obviously be ideal but it would surely require standardizing attributes like for calendar events ("date", "location", "description", etc).
Does this inspire you?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can you check again the calendar script, I think I needed to
explicitly declare some variables with def. It worked on my comp but it
seems to give an error on yours.
About what you suggested. I do that already I keep notes, references to
sites (all my bookmarks), todo lists, etc.
It is possible to export using scripts, so to select the data you need and
create a csv file.
Looking at the scripts you've developed I think freeplane is a very
interesting tool for a diary + calendar.
With a template system, you can imagine keeping a diary that includes
meeting notes, references (readings, sites) but also events (calendar).
However, I see a major obstacle: export. Would some of you have ideas on
the best solutions for a possible export. An export in .ics would obviously
be ideal but it would surely require standardizing attributes like for
calendar events ("date", "location", "description", etc).
Yes it works. I don't get this error message anymore. On the other hand, I have the impression that I don't get the same thing as in your screenshot. Am I wrong?
Very interesting that it seems possible to you. Is there already a script to export (via .cvs)? That would be very useful to integrate into a calendar.
Hi. It works for me. I think maybe it could be because of
localization/language and the java calendar.
Here I created the 2021 calendar to test it.
I am not sure you will use it sometimes but not that often. If you really
need it I may try to fix it. I would need to add some logging because I
cannot reproduce the same issue on this computer. [image: image.png]
Yes it works. I don't get this error message anymore. On the other hand, I
have the impression that I don't get the same thing as in your screenshot.
Am I wrong?
Very interesting that it seems possible to you. Is there already a script
to export (via .cvs)? That would be very useful to integrate into a
calendar.
Look, I don't want to bother you with this. I wanted to test it with the prospect of documenting my notes in time. I'll try to solve the problem myself. I would be more seriously interested in the prospect of exporting the events... I'll see if anyone can develop that.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello everybody,
I made for myself Calendar script, which I found useful, if you use Freeplane for project managing, maybe it can somebody else helps. And also I am not very experienced programmer, espetially in Groovy/Java (I spent last few years by "holiday" programming in Python only :) ), so maybe somebody should have an idea, how to improve/rewrite them in clearer way.
Calendar script asks for year, for which should be calendar generated, create a new node with calendar and split all days of generated calendars to structure in week order. For better overview it colors months. It could be useful for diary, or workflow tracking, or for settings reminders etc.
I tested it for few years, seems everything works as expected.
Installation:
- Installation is common: Copy & paste script below, paste it in new file, called e.g. Calendar.groovy, put the file into freeplane_dir/scripts and restart Freeplane. Script will appear in Tools->Scripts.
Features:
- You can use your own translations to generate localized calendar. Days are named according to your localization of Freeplane automatically
- You can pick your own favorit color to colorize calendar :)
Known problems:
- Few days, which can belong to previous week (last week of previous year) is not neccessary on their right spot (monday over monday grid).
- Translations should be solved in better way: If you use translations with diacritics (ěščřžřý...), it will be broken during create calendar from "external" script - means installed script. If you put these script straight into some node of your map, everything seems well.
Possible improvement: Split nodes also in accordance to month.
Hope it helps :)
Testing, reporting, improvement, some feedback, will be welcome.
Last edit: Ferdinand Mravenec 2017-06-21
Well done Ferdinand ;)
Consider putting it into the wiki, to the "incubator scripts page"
Thanks :)
I didnt post it to incubator scripts page, because I expected, that exists better way, how to solve similar issue (whenever I see yours "xxx.each{...}" stuff :) ), maybe there is some problem, what I overview and, of course, I havent access yet :) So maybe a bit later :)
I did one also some time ago, I still use it.
https://github.com/viaa/FreeplaneScripts/blob/master/Calendar.groovy
Seems heavy :)
Hi Ferdinand,
It displays the calendars with the usual format as tables and by quarters and months.
A screenshot is in attachment.
Best regards,
Alexandre
Last edit: Alexandre 2017-07-04
I'd like to try out both of these calendar scripts simultaneously for comparison purposes, (and heck, I might like both and have a use case for both of them on different occasions) but they both have to be named "calendar.groovy" in my scripts folder, which is problematic.
Do you guys have a suggested solution?
Last edit: Leo Staley 2018-01-25
Seems calendars as mind maps are not very popular. But I do use mine to put some things like vacations, sick days for me and other people I work with or things to do at a specific date sometimes.
I have a bigger problem @Ferdinand Mravenec:
I created the Calendar.groovy file in my scripts folder, I restarted freeplane, and then, in my map, I right clicked on my node, "Test Calendar," and freeplane gave me an error:
Hi,
I want to try this script and i have the same problem.
Any idea ?
Hi bepolymathe,
The calendar is re-uploaded to git.
Alexandre
Le dim. 27 déc. 2020 à 23:31, bepolymathe bepolymathe@users.sourceforge.net
a écrit :
Hi Alexandre,
Thanks for that. But i still have a error message.
Hello everyone,
Looking at the scripts you've developed I think freeplane is a very interesting tool for a diary + calendar.
With a template system, you can imagine keeping a diary that includes meeting notes, references (readings, sites) but also events (calendar). However, I see a major obstacle: export. Would some of you have ideas on the best solutions for a possible export. An export in .ics would obviously be ideal but it would surely require standardizing attributes like for calendar events ("date", "location", "description", etc).
Does this inspire you?
Can you check again the calendar script, I think I needed to
explicitly declare some variables with def. It worked on my comp but it
seems to give an error on yours.
About what you suggested. I do that already I keep notes, references to
sites (all my bookmarks), todo lists, etc.
It is possible to export using scripts, so to select the data you need and
create a csv file.
Le lun. 28 déc. 2020 à 16:44, bepolymathe bepolymathe@users.sourceforge.net
a écrit :
Yes it works. I don't get this error message anymore. On the other hand, I have the impression that I don't get the same thing as in your screenshot. Am I wrong?
Very interesting that it seems possible to you. Is there already a script to export (via .cvs)? That would be very useful to integrate into a calendar.
Hi. It works for me. I think maybe it could be because of
localization/language and the java calendar.
Here I created the 2021 calendar to test it.
I am not sure you will use it sometimes but not that often. If you really
need it I may try to fix it. I would need to add some logging because I
cannot reproduce the same issue on this computer.
[image: image.png]
Le lun. 28 déc. 2020 à 19:07, bepolymathe bepolymathe@users.sourceforge.net
a écrit :
Look, I don't want to bother you with this. I wanted to test it with the prospect of documenting my notes in time. I'll try to solve the problem myself. I would be more seriously interested in the prospect of exporting the events... I'll see if anyone can develop that.