Error 403 from Google Calendar? Upgrade to the new Google Calendar support. See here for details. close
Welcome, Guest
Please Login or Register.    Lost Password?

[Solved] Few question about script
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: [Solved] Few question about script
#19905
[Solved] Few question about script 1 Year, 2 Months ago  
a) Rainlendar_SetOption()
I thinks there is a bug at Rainlendar_SetOption(PATH, NAME, VALUE).
I can use any PATH except "OverriddenSettings".
For example:
Rainlendar_SetOption("Calendars/Calendar1", "ReadOnly", "1") is work normal, but
Rainlendar_SetOption("OverriddenSettings/Shadow4/Event\ List", "ExcludedCalendars", "Trash") is not work.
Please help.
add: I remember, at before, it seems must use "//" replace "/", I will try it later then see if it work.
add: Ahhh, use "//" also got the same result.

b)
Use all_cal = Rainlendar_GetCalendars() will got all_cal = {[2]=calendar1, [3]=calendar2, ---},
the table is starting from all_cal[2].
Use all_win = Rainlendar_GetWindows() will got all_win = {[0]=window1,[1]=window2, ---},
the table is starting from all_win[0].
So, my question is: Why should such a setting?
It really very bothers me, if I forgot where from they started, when I was using them.
add: Maybe other APIs have the same behavior, I will try them later.
add: OK, other APIs, which return a table, are work normal - starting from table[1].
anoob
Platinum Boarder
Posts: 508
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: TaiChung, Taiwan, R.O.C. Birthday: 02/12
Last Edit: 2013/09/21 04:13 By anoob.
The administrator has disabled public write access.
I couldn't speak English! This skin released to Customize.org(Do you want it? Click Picture) Please contact me if interested: jhg5702@gmail.com
 
#19913
Re: Few question about script 1 Year, 2 Months ago  
a) You don't have to escape the space in the function call so Rainlendar_SetOption("OverriddenSettings/Shadow4/Event List", "ExcludedCalendars", "Trash") should work. If you need to use the backspace that must be escaped with a second backspace ("\\") or otherwise the script won't be read (or it might work incorrectly).

b) All lua lists should start from index 1 so that's a bug in those two methods. I'll fix them. The lists in lua are a bit weird anyway since they can contain also gaps in the indexing.
Rainy
Moderator
Posts: 6064
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#19917
Re: Few question about script 1 Year, 2 Months ago  
Rainy wrote:
a) You don't have to escape the space in the function call so Rainlendar_SetOption("OverriddenSettings/Shadow4/Event List", "ExcludedCalendars", "Trash") should work. If you need to use the backspace that must be escaped with a second backspace ("\\") or otherwise the script won't be read (or it might work incorrectly).
Unfortunately, Rainlendar_SetOption("OverriddenSettings/Shadow4/Event List", "ExcludedCalendars", "Trash") still not work.
And I thinks the "space" not the cause of this issue, because
Rainlendar_SetOption("OverriddenSettings/Shadow4/Calendar", "ExcludedCalendars", "Trash")
also not work.
anoob
Platinum Boarder
Posts: 508
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: TaiChung, Taiwan, R.O.C. Birthday: 02/12
The administrator has disabled public write access.
I couldn't speak English! This skin released to Customize.org(Do you want it? Click Picture) Please contact me if interested: jhg5702@gmail.com
 
#19925
Re: Few question about script 1 Year, 2 Months ago  
When are you running the script? I tried this by launching the script from a button and it should work at least in that situation. Note that you need to call also Rainlendar_Refresh() after the setting is changed so that the new value gets written to the ini file and taken into use.
Rainy
Moderator
Posts: 6064
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#19927
Re: Few question about script 1 Year, 2 Months ago  
Rainy wrote:
When are you running the script? I tried this by launching the script from a button and it should work at least in that situation. Note that you need to call also Rainlendar_Refresh() after the setting is changed so that the new value gets written to the ini file and taken into use.
I put a lua file in script folder, so it will run at Rainlendar startup.
Code:


function trash_initialize()
  no_trash = 0
  local windowslist = Rainlendar_GetWindows()
  for i=0, #windowslist do
    local _, _, skin, window = windowslist[i]:find("(.*)::(.*)")
    local sw = skin.."/"..window
    local ex_cal = Rainlendar_GetOption("OverriddenSettings/"..sw, "ExcludedCalendars")
    if ex_cal:find("Trash") then
     elseif ex_cal == "" then
       Rainlendar_SetOption("OverriddenSettings/"..sw, "ExcludedCalendars", "Trash")
       no_trash = no_trash + 1
     else
       Rainlendar_SetOption("OverriddenSettings/"..sw, "ExcludedCalendars", ex_cal .. ";Trash")
       no_trash = no_trash + 1
    end
  end
  if no_trash > 0 then
     Rainlendar_Refresh()
  end
end

trash_initialize()




I finally found the possible reason:
It seems because I have some custom skin, they need some time to redraw, so I have to delay this script.
Code:


function trash_initialize()
  no_trash = 0
  local windowslist = Rainlendar_GetWindows()
  for i=0, #windowslist do
    local _, _, skin, window = windowslist[i]:find("(.*)::(.*)")
    local sw = skin.."/"..window
    local ex_cal = Rainlendar_GetOption("OverriddenSettings/"..sw, "ExcludedCalendars")
    if ex_cal:find("Trash") then
     elseif ex_cal == "" then
       Rainlendar_SetOption("OverriddenSettings/"..sw, "ExcludedCalendars", "Trash")
       no_trash = no_trash + 1
     else
       Rainlendar_SetOption("OverriddenSettings/"..sw, "ExcludedCalendars", ex_cal .. ";Trash")
       no_trash = no_trash + 1
    end
  end
  if no_trash > 0 then
     Rainlendar_Refresh()
  end
end

function trash_delay()
  if os.clock() > now_trash_time then
     trash_initialize()
     return false
  end
end

now_trash_time = os.clock() + 1
Rainlendar_CreateTimer(1000 * 1, trash_delay)
--trash_initialize()




Thanks your help.
anoob
Platinum Boarder
Posts: 508
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: TaiChung, Taiwan, R.O.C. Birthday: 02/12
The administrator has disabled public write access.
I couldn't speak English! This skin released to Customize.org(Do you want it? Click Picture) Please contact me if interested: jhg5702@gmail.com
 
Go to topPage: 1
get the latest posts directly to your desktop