It is currently March 3rd, 2021, 6:19 am
Help with creating, editing & fixing problems with skins
CodeCode
Posts: 271 Joined: September 7th, 2020, 2:24 pm
Post
by CodeCode » October 18th, 2020, 6:15 am
Hello, I and some others are modifying the ical google calendar skin. They managed to get the time to mostly correctly display.
I have found that the 0's in the am hours and the difference between am and pm seem to be confused.
I have posted the skin for reference but the line looks like this:
Queue['Item'..i..'Time'] = Item.Date and os.date('%I:%M -', Item.Date) or ''
The
%#I:%M crashes rainmeter...
Google Calendar ical_xx.xx.zip
You do not have the required permissions to view the files attached to this post.
Last edited by CodeCode on October 18th, 2020, 11:48 pm, edited 1 time in total.
Can't fix it if it ain't broke - unless it is in code.
balala
Rainmeter Sage
Posts: 12321 Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania
Post
by balala » October 18th, 2020, 12:49 pm
CodeCode wrote: ↑ October 18th, 2020, 6:15 am
I have found that the 0's in the am hours and the difference between am and pm seem to be confused.
It does work well for me. The times shown as 00:00 with the
%H:%M format, is shown as 12:00 - AM if I switch to the
%I:%M - %p format.
CodeCode wrote: ↑ October 18th, 2020, 6:15 am
The
%#I:%M crashes rainmeter...
Note that the
# parameter is not valid in lua. It is in Rainmeter, however in lua it isn't, so you can't use it. That's why Rainmeter crashes...
jsmorley
Developer
Posts: 21559 Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA
Post
by jsmorley » October 18th, 2020, 1:18 pm
Correct. To duplicate the functionality of the
# character in Lua, you would use
string.gsub() to remove the leading
0 :
Code: Select all
function Update()
someTime = string.gsub(os.date('%I:%M:%S', 1603005001),'^0','')
print(someTime)
end
string.gsub() can support two forms:
newString = string.gsub(oldString, regular expression search pattern, replacement)
newString = oldString:gsub(regular expression search pattern, replacement)
So this would also work, no real advantage either way, your preference... I kinda prefer this:
Code: Select all
function Update()
someTime = os.date('%I:%M:%S', 1603005001):gsub('^0','')
print(someTime)
end
http://lua-users.org/wiki/StringLibraryTutorial
balala
Rainmeter Sage
Posts: 12321 Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania
Post
by balala » October 18th, 2020, 1:53 pm
jsmorley wrote: ↑ October 18th, 2020, 1:18 pm
string.gsub() can support two forms:
newString = string.gsub(oldString, regular expression search pattern, replacement)
newString = oldString:gsub(regular expression search pattern, replacement)
As most (or hope I'm not wrong if I say all) functions in lua.
jsmorley
Developer
Posts: 21559 Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA
Post
by jsmorley » October 18th, 2020, 1:57 pm
balala wrote: ↑ October 18th, 2020, 1:53 pm
As most (or hope I'm not wrong if I say all) functions in lua.
Yes, as long as we are talking about a "method" in a "library". I mostly see / use it with the string, math and table libraries.
balala
Rainmeter Sage
Posts: 12321 Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania
Post
by balala » October 18th, 2020, 2:46 pm
jsmorley wrote: ↑ October 18th, 2020, 1:57 pm
Yes, as long as we are talking about a "method" in a "library". I mostly see / use it with the string, math and table libraries.
Well, I don't know too much in lua, just what have I gathered while I was using it with Rainmeter, so it was just an observation, based on my experience.
CodeCode
Posts: 271 Joined: September 7th, 2020, 2:24 pm
Post
by CodeCode » October 18th, 2020, 9:04 pm
Ok, so sometimes the time is coming out 2 hours too early in the rainmeter skin from what is in my calendar. But not always.
jsmorley wrote: ↑ October 18th, 2020, 1:18 pm
Correct. To duplicate the functionality of the
# character in Lua, you would use
string.gsub to remove the leading
0 :
Code: Select all
function Update()
someTime = string.gsub(os.date('%I:%M:%S', 1603005001),'^0','')
print(someTime)
end
string.gsub() can support two forms:
newString = string.gsub(oldString, regular expression search pattern, replacement)
newString = oldString:gsub(regular expression search pattern, replacement)
So this would also work, no real advantage either way, your preference... I kinda prefer this:
Code: Select all
function Update()
someTime = os.date('%I:%M:%S', 1603005001):gsub('^0','')
print(someTime)
end
http://lua-users.org/wiki/StringLibraryTutorial
Where would that go in this line:
Code: Select all
Queue['Item'..i..'Time'] = Item.Date and os.date('%I:%M -', Item.Date) or ''
Can't fix it if it ain't broke - unless it is in code.
jsmorley
Developer
Posts: 21559 Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA
Post
by jsmorley » October 18th, 2020, 9:30 pm
CodeCode wrote: ↑ October 18th, 2020, 9:04 pm
Where would that go in this line:
Code: Select all
Queue['Item'..i..'Time'] = Item.Date and os.date('%I:%M -', Item.Date) or ''
Queue['Item'..i..'Time'] = Item.Date and os.date('%I:%M -', Item.Date):gsub('^0','') or ''
CodeCode
Posts: 271 Joined: September 7th, 2020, 2:24 pm
Post
by CodeCode » October 18th, 2020, 9:41 pm
jsmorley wrote: ↑ October 18th, 2020, 9:30 pm
Queue['Item'..i..'Time'] = Item.Date and os.date('%I:%M -', Item.Date):gsub('^0','') or ''
Thanks jsmorley, that fixed my issue as posted.
Strange, I saw this solution somewhere else, and I tried it, but it did not work - however now it does... hmph.
Can't fix it if it ain't broke - unless it is in code.
CodeCode
Posts: 271 Joined: September 7th, 2020, 2:24 pm
Post
by CodeCode » October 18th, 2020, 9:44 pm
There remains the additional issue though.
Some of my calendar appointments are still coming out 2 hours earlier than they should.
The calendar even says 7 am - 8 am but is showing as 5am to 6 am. Even after deleting the event and re-entering it.
Can't fix it if it ain't broke - unless it is in code.