Hey all, first time posting on Rainmeter forums
I'm adjusting the Google Calendar skin and I'm almost 100% done.
(https://visualskins.com/skin/google-calendar)
*Going to pretend like I know what I'm talking about for this next piece*
Looks to me like Reader.lua is responsible for scraping Google Calendar information then passing it to Gcalendar.ini in two strings
I'm unsure if this solution is best accomplished through a modification of the Gcalendar.ini or the Reader.lua
What I want to do is concatenate the Item1Date, Item2Date, etc so that only the the last 6 characters ("Sep 02" for example) are kept.
See the image below. I'd like just the Month and Day to display.
Relevant places:
1. The string, I believe, is produced on Line #268 in Reader.lua
2. The string is utilized on Line #319 and onwards in Gcalendar.ini
I'm new to Rainmeter and tried some things to concatenate the string but they failed.
I tried to do stuff like "RegExpSubstitute", but I think it failed because this is done somewhere else and not in a Meter=String area.
Unsure about this. Feel free to educate a noob, would love to understand what's going on.
This forum reminds me a lot of the AHK forums upon first glance.
Thank you for your time!
~DH
It is currently April 26th, 2024, 3:31 am
[SOLVED] String Concatenation in .Lua File
-
- Posts: 18
- Joined: July 18th, 2019, 5:06 pm
[SOLVED] String Concatenation in .Lua File
You do not have the required permissions to view the files attached to this post.
Last edited by Colorado on July 18th, 2019, 8:00 pm, edited 2 times in total.
Learnin some Rainmeter I guess
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: [Beginner] String Concatenation
There is no need to work with the Reader.lua script file or concatenate strings in a such simple case. Just have to add a Hidden=1 option to each of the [ItemWhat1] - [ItemWhat8] meters.
This solution has the advantage that if anytime later you change your mind and want to add those strings back, you just have to remove the added Hidden=1 options (or rewrite them as Hidden=0).
-
- Posts: 18
- Joined: July 18th, 2019, 5:06 pm
Re: [Beginner] String Concatenation
When I add Hidden=1 to the [ItemWhen1] meter, it does not display the string whatsoever.balala wrote: ↑July 18th, 2019, 6:13 pm There is no need to work with the Reader.lua script file or concatenate strings in a such simple case. Just have to add a Hidden=1 option to each of the [ItemWhat1] - [ItemWhat8] meters.
This solution has the advantage that if anytime later you change your mind and want to add those strings back, you just have to remove the added Hidden=1 options (or rewrite them as Hidden=0).
I'm looking to keep the last six digits of the Item1Date string.
For example, "Aug 06" should be kept.
Image of your proposed change:
Learnin some Rainmeter I guess
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: [Beginner] String Concatenation
Right, my mistake, sorry.
Instead of [ItemWhen1] - [ItemWhen8], add the Hidden=1 option to the [ItemWhat1] - [ItemWhat8] meters.
Sorry again for the confusion. Definitely my fault.
-
- Posts: 18
- Joined: July 18th, 2019, 5:06 pm
Re: [Beginner] String Concatenation
Not looking to hide strings.
I'm looking to shorten the Item1Date, Item2Date, Item3Date, etc etc etc only.
Second proposed change:
Learnin some Rainmeter I guess
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: [Beginner] String Concatenation
Sorry again I misunderstood you. Now I suppose I understood your intention. If I'm not wrong again somehow, you have to modify a line of the Reader.lua script file. Replace the function local Timestamp = SELF:GetOption('Timestamp', '%I:%M %p %A %b %d') line with the shorter local Timestamp = SELF:GetOption('Timestamp', '%b %d') (Output() function). This command sets the format of the returned dates. The initial %I:%M %p %A %b %d format meant in order: hour, in 12-hours format (%I), minutes (%M), either "am" or "pm" (%p), full weekday name (%A), abreviated month name (%b) and finally day of month (%d). This format is now modified to %b %d, which means abreviated month name and day of month.
Here are the usable date formats in lua: https://www.lua.org/pil/22.1.html
Is it ok now?
-
- Posts: 18
- Joined: July 18th, 2019, 5:06 pm
Re: [Beginner] String Concatenation
THANK YOUbalala wrote: ↑July 18th, 2019, 7:16 pm Sorry again I misunderstood you. Now I suppose I understood your intention. If I'm not wrong again somehow, you have to modify a line of the Reader.lua script file. Replace the function local Timestamp = SELF:GetOption('Timestamp', '%I:%M %p %A %b %d') line with the shorter local Timestamp = SELF:GetOption('Timestamp', '%b %d') (Output() function). This command sets the format of the returned dates. The initial %I:%M %p %A %b %d format meant in order: hour, in 12-hours format (%I), minutes (%M), either "am" or "pm" (%p), full weekday name (%A), abreviated month name (%b) and finally day of month (%d). This format is now modified to %b %d, which means abreviated month name and day of month.
Here are the usable date formats in lua: https://www.lua.org/pil/22.1.html
Is it ok now?
This is now solved.
Picture of the final product:
Learnin some Rainmeter I guess
-
- Rainmeter Sage
- Posts: 5406
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: [SOLVED] String Concatenation in .Lua File
Hope things go well for you tomorrow at Dr. Rog's
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Posts: 18
- Joined: July 18th, 2019, 5:06 pm
Re: [SOLVED] String Concatenation in .Lua File
Thanks.
Finger's been dislocated for like 2 months.
He'll need to snap it into place or surgery.
Three Cheers for Science
Learnin some Rainmeter I guess
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: [Beginner] String Concatenation
I'm glad. Sorry again I misunderstood you.