It is currently September 20th, 2019, 10:37 am

Lua Script todo.txt

Discuss the use of Lua in Script measures.
aidayong
Posts: 18
Joined: June 22nd, 2011, 7:59 am

Lua Script todo.txt

aidayong » March 27th, 2012, 9:17 am

An update to my previous post http://rainmeter.net/forum/viewtopic.php?f=5&t=11639 regarding using todo.txt on rainmeter

Basically i have update the lua script for todo.txt that jsmorley(TQ for it) introduce to do the following
a) extract unique context eg. @call @computer @home (something like smartlist)
b) extract unique project eg. +rmtr +inbox
c) display number of task based on context eg @office = 25 task
d) display list based on context by leftclick context smartlist

Please mind that it is still raw n i just learn lua code 24 hours ago. So bare with me.

TestDummy.lua

Code: Select all

PROPERTIES =
{
  SettingInSkin = 0;
  
}
function Initialize()

   sFileName = SELF:GetOption('FileName')
   sContext = SKIN:GetVariable('CContext')
   
 end -->Initialize

function Update()
	
   for i = 1, 5 do
      SKIN:Bang('!SetOption Meter'..i..' Text \"\"')
   end
   
   hFile = io.open(sFileName)
   if not hFile then print('File error'); return 'File error'; end 
   io.close(hFile)   
   
	if sContext == '' then SKIN:Bang('!Refresh'); return 'No input'; end
	
    n=0  
    tData = {}   
	for sLine in io.lines(sFileName) do
    n=n+1
	  if string.find(sLine,sContext) then
	    sline2=string.sub(sLine,11) --> remove date position 1-11
	    table.insert(tData,n..")"..sline2) --> insert line number in front
      end
	end
	
		NewNumber = table.getn(tData) --> calc no of line containing context ToDotype
		
	for i = 1, (#tData < 6) and #tData or 5 do
      SKIN:Bang('!SetOption Meter'..i..' Text \"'..tData[i]..'\"')
	end
		
   t2={}
   context = {}
	for sLine in io.lines(sFileName) do
		for context in string.gmatch(sLine,"@[%w]+") do --> extract context label
			if not t2[context] then
			table.insert(t2,context)
			t2[context] = true
			end
		end
	end

	  ContextNum = table.getn(t2) --> calc no of context
	  
	for i = 1, (#t2 < 9) and #t2 or 8 do
    SKIN:Bang('!SetOption CMeter'..i..' Text \"'..t2[i]..'\"')
	SKIN:Bang('!SetOption CMeter'..i..' LeftMouseUpAction """!Execute [!WriteKeyValue Variables CContext \"'..t2[i]..'\"][!Refresh]"""')
	end
	
	
		t3={}
    context = {}
	for sLine in io.lines(sFileName) do
		for project in string.gmatch(sLine,"\+[%w]+") do --> extract project label
			if not t3[project] then
			table.insert(t3,project)
			t3[project] = true
			end
		end
	end
	ProjectNum = table.getn(t3)
	
	for i = 1, (#t3 < 9) and #t3 or 8 do
    SKIN:Bang('!SetOption Project'..i..' Text \"'..t3[i]..'\"')
	end
	return NewNumber
end -->Update


Test.ini

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
color.secondary=255,255,255,25
color.primary=255,255,255,255
color.background=0,128,255,40
E=2.7182818
fontname=Trebuchet MS
textSize=8
colorBar=235,170,0,255
colorText=255,255,255,205
CContext=@idea

[Background]
Meter=IMAGE
SolidColor=0,0,0,100
X=0
Y=0
W=(#SCREENAREAWIDTH#/6)
H=#SCREENAREAHEIGHT#

[MeasureScript]
Measure=Script
ScriptFile="#CURRENTPATH#Testdummy.lua"
FileName=D:\Dropbox\My_Text\todo.txt
ToDoType=#CContext#
UpdateDivider=-1

[styleLeftText]
StringAlign=LEFT
StringCase=NONE
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontname#
FontSize=#textSize#
AntiAlias=1
X=0
Y=2R
SolidColor=0,0,0,1
AntiAlias=1

[TextStyle]
X=0
Y=2R
FontFace=#fontname#
FontSize=11
FontColor=#colorText#
SolidColor=0,0,0,1
AntiAlias=1

[MeterHeader]
Meter=String
MeterStyle=TextStyle
X=10
Y=60
H=18
W=(#SCREENAREAWIDTH#/6-20)
SolidColor=0,0,0,200
Text=Enter Search
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 1"

[MeasureInput]
Measure=Plugin
Plugin=InputText.dll
X=0
Y=0
H=18
W=235
FontFace=Arial
FontSize=11
FontColor=255,255,255,255
SolidColor=0,0,0,255
Command1=!Execute [!SetOption MeasureScript ToDoType "$UserInput$][!UpdateMeasure MeasureScript #CURRENTCONFIG#]

[ToDoTypeTitle]
Meter=String
MeasureName=MeasureScript
StringAlign=CENTER
StringCase=UPPER
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontname#
FontSize=10
AntiAlias=1
ClipString=0
X=(#SCREENAREAWIDTH#/12)
W=(#SCREENAREAWIDTH#/12)
Text=#CContext# · %1
Y=20r

[Meter1]
Meter=String
MeterStyle=styleLeftText
Y=5R

[Meter2]
Meter=String
MeterStyle=styleLeftText

[Meter3]
Meter=String
MeterStyle=styleLeftText

[Meter4]
Meter=String
MeterStyle=styleLeftText

[Meter5]
Meter=String
MeterStyle=styleLeftText

[CMeter1]
Meter=String
MeterStyle=styleLeftText
Y=5R

[CMeter2]
Meter=String
MeterStyle=styleLeftText

[CMeter3]
Meter=String
MeterStyle=styleLeftText

[CMeter4]
Meter=String
MeterStyle=styleLeftText

[CMeter5]
Meter=String
MeterStyle=styleLeftText

[CMeter6]
Meter=String
MeterStyle=styleLeftText

[CMeter7]
Meter=String
MeterStyle=styleLeftText

[CMeter8]
Meter=String
MeterStyle=styleLeftText

[Project1]
Meter=String
MeterStyle=styleLeftText
Y=5R

[Project2]
Meter=String
MeterStyle=styleLeftText

[Project3]
Meter=String
MeterStyle=styleLeftText

[Project4]
Meter=String
MeterStyle=styleLeftText

[Project5]
Meter=String
MeterStyle=styleLeftText

[Project6]
Meter=String
MeterStyle=styleLeftText

[Project7]
Meter=String
MeterStyle=styleLeftText

[Project8]
Meter=String
MeterStyle=styleLeftText

Appreciate some feedback or pointers.
User avatar
jsmorley
Developer
Posts: 19461
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Lua Script todo.txt

jsmorley » March 27th, 2012, 12:23 pm

Looks fine to me. You are obviously a "quick study"... ;-)

There are a million ways to write any program, and much of any feedback would be of a coding "style" nature that I think is the preference of the author unless you are working on a shared project. Just a few things that are more functional I might point out:

1) You don't need the PROPERTIES table at the top at all any more. That functionality has been deprecated and you can just use SELF:GetOption() or SELF:GetNumberOption() anywhere in the script to retrieve a setting from the actual script measure. You can just remove PROPERTIES entirely.

2) Using table.getn(t3) and #t3 are the same thing. Both return the current count of the items in a table/array. Not sure either is preferred, but you might want to pick one or the other for consistency. I use #tableName myself. So you could use NewNumber = table.getn(tData) or NewNumber = #tData and they both store the current count of the table in your NewNumber variable. Lua has a lot of "syntaxical sugar" shortcuts that can be useful.

3) It's not terribly important in a small script, which almost all are in Rainmeter, but it is probably a good practice to remember that in Lua (unlike most languages) all variables are "global" unless you specify the word "local" when they are defined. Local variables when they are possible use a tad less resources, and in general are a safer and more efficient way to carry variables around in memory.

All in all I think you are doing fine with Lua. Obviously you have done some coding before, so Lua should really be a breeze once you get used to the particulars of the language. It's really a very simple and straightforward one compared to many others.

This is a particularly good reference if you have not tumbled to it yet: http://lua-users.org/wiki/TutorialDirectory.
User avatar
smurfier
Moderator
Posts: 1937
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Lua Script todo.txt

smurfier » March 27th, 2012, 1:31 pm

Instead of iterating over the same file three times each update, I suggest reading that file into a table then iterating over the table.

Code: Select all

	hFile = io.input(SKIN:MakePathAbsolute(sFileName),'r')
	fLines={}
	if not hFile then
		print('File error'); return 'File error';
	else
		for line in io.lines() do
			table.insert(fLines,line)
		end
	end
	io.close(hFile) 

	tData = {}
	for i,v in ipairs(hFile) do
		if string.find(v,sContext) then
			local sline2=string.sub(v,11) --> remove date position 1-11
			table.insert(tData,i..")"..sline2) --> insert line number in front
		end
	end
Also, I notice that you initialize the table named context a few time, but never use it.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
jsmorley
Developer
Posts: 19461
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Lua Script todo.txt

jsmorley » March 27th, 2012, 1:41 pm

smurfier wrote: Also, I notice that you initialize the table named context a few time, but never use it.
Yeah "context" is not a table as used, just a variable. You can initialize it with local context = "" if you want, although you don't really have to "def" variables in Lua unless you want them reset to some starting value on each update.

The one other thing that occurs to me is that since we now are specifically creating and populating the table fLines on each update, it might be worth putting fLines = nil right above the "return" line at the end of your Update() function. Your text file is not that large currently, but if it gets bigger, and it stores the entire text file in memory, it might be worth returning the memory resources between updates by "destroying" the table when you are done with it. Not sure if the trade-off between a CPU cycle or two to destroy the table is a good price for giving back the memory, but it just feels right...

P.S. I think you are going to want for i,v in ipairs(hFile) do to be for i,v in ipairs(fLines) do in Smurfier's example.
aidayong
Posts: 18
Joined: June 22nd, 2011, 7:59 am

Re: Lua Script todo.txt

aidayong » April 5th, 2012, 12:13 pm

Script have been updated to include the following
1| task number below ten are padzero
2| task format with due date eg '2012-04-04 buy new ipad due:05/04/2012' are sorted as today/overdue or later/future list
3| using userinput to add task and append todo textfile

i am having some problem in appending text file because each time i add task via userinput it will write twice. i not sure why n its bugging me.
line 1
line 2
line 3
line 4
2012-04-05 taking chances
2012-04-05 taking chances
2012-04-05 adding to task
2012-04-05 adding to task
test.lua

Code: Select all

function Initialize()

   sFileName = SELF:GetOption('FileName')
   sKeyword = SKIN:GetVariable('Keyword')
   sUserInput=SKIN:GetVariable('UserInput')
   
 end -->Initialize

function Update()
	tData = {}
	tContext ={}
	tProject = {}
	tDue ={}
	tSeven={}
	nyear = os.date("%Y",os.time())
	nmonth = os.date("%m",os.time())
	nday = os.date("%d",os.time())	
	
	local hFile = io.open(SKIN:MakePathAbsolute(sFileName),'a+')
	fLines={}
	
	if not hFile then
		print('File error'); return 'File error';
	else
	   
		for line in hFile:lines() do
        table.insert(fLines,line)
		end
	end

	for i,v in ipairs(fLines) do
		if string.find(v,sKeyword) then
			local sline2=string.sub(v,11) --> remove date position 1-11
			if i<10 then --padzero for number less than 10
			table.insert(tData,"0"..i.."|"..sline2) --> insert line number in front
			else
			table.insert(tData,i.."|"..sline2) --> insert line number in front
			end --if
		end --if
		for context in string.gmatch(v,"@[%w]+") do --> context label
			if not tContext[context] then
			table.insert(tContext,context)
			tContext[context] = true
			end --if
		end --for context
		
		for project in string.gmatch(v,"\+[%w]+") do --> project label
			if not tProject[project] then
			table.insert(tProject,project)
			tProject[project] = true
			end--if
		end--for project
		
		for sdue in string.gmatch(v,"due:%d+/%d+/%d+") do
		strdate = string.gmatch(sdue,"%d+")
		day = strdate()
		month = strdate()
		year = strdate()
		local sline2=string.sub(v,11) --> remove date position 1-11
			if nyear-year > 0 then
				table.insert(tDue,i.."|"..sline2)
			elseif nmonth-month > 0 then
				table.insert(tDue,i.."|"..sline2)
			elseif nday - day >= 0 then
				table.insert(tDue,i.."|"..sline2)
			elseif nday - day <-7 then
				table.insert(tSeven,i.."|"..sline2)
			end--if
		end--for sdue
	end --for
	fLines=nil
	hFile:write(nyear,"-",nmonth,"-",nday," ",sUserInput,"\n")  -- add task via userinput
	io.close(hFile)
		
	if sKeyword == '' then SKIN:Bang('!Refresh'); return 'No input'; end
	   	NewNumber = #tData --> calc no of line containing context ToDotype
			
	for i = 1, (#tData < 8) and #tData or 7 do
      SKIN:Bang('!SetOption Task'..i..' Text \"'..tData[i]..'\"')
	end
		  
	for i = 1, (#tContext < 11) and #tContext or 10 do
    SKIN:Bang('!SetOption Context'..i..' Text \"'..tContext[i]..'\"')
	SKIN:Bang('!SetOption Context'..i..' LeftMouseUpAction """!Execute [!WriteKeyValue Variables Keyword \"'..tContext[i]..'\"][!Refresh]"""')
	end
		
	for i = 1, (#tProject < 9) and #tProject or 8 do
    SKIN:Bang('!SetOption Project'..i..' Text \"'..tProject[i]..'\"')
	SKIN:Bang('!SetOption Project'..i..' LeftMouseUpAction """!Execute [!WriteKeyValue Variables Keyword \"'..tProject[i]..'\"][!Refresh]"""')
	end
	
	for i = 1, (#tDue < 9) and #tDue or 8 do
    SKIN:Bang('!SetOption Today'..i..' Text \"'..tDue[i]..'\"')
	end
	
	for i = 1, (#tSeven < 8) and #tSeven or 7 do
    SKIN:Bang('!SetOption Seven'..i..' Text \"'..tSeven[i]..'\"')
	end

	return NewNumber
	
end -->Update
You do not have the required permissions to view the files attached to this post.
User avatar
smurfier
Moderator
Posts: 1937
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Lua Script todo.txt

smurfier » April 5th, 2012, 5:32 pm

May I see your skin file?
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
aidayong
Posts: 18
Joined: June 22nd, 2011, 7:59 am

Re: Lua Script todo.txt

aidayong » April 6th, 2012, 2:28 pm

i had this feeling that the culprit is the skin. but cant figure it out.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
color.secondary=255,255,255,25
color.primary=255,255,255,255
color.background=0,128,255,40
E=2.7182818
fontname=Trebuchet MS
textSize=8
colorBar=235,170,0,255
colorText=255,255,255,205
Keyword=@home
move=8
UserInput=

[Background]
Meter=IMAGE
SolidColor=0,0,0,140
X=0
Y=0
W=(#SCREENAREAWIDTH#/6)
H=(#SCREENAREAHEIGHT#*2/5)

[StyleTitle]
StringAlign=LEFT
StringCase=UPPER
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontname#
FontSize=13
AntiAlias=1
Y=r
DynamicVariables=1

[ContextTitle]
Meter=String
MeterStyle=StyleTitle
Text=@
X=10
Y=7
LeftMouseUpAction=!Execute [!ShowMeterGroup ContextGroup] [!HideMeterGroup ProjectGroup][!MoveMeter 85 78 Task1][!MoveMeter 85 105 meterSeperator3]
MouseOverAction=!Execute [!MoveMeter 95 7 ProjectTitle][!MoveMeter 125 7 TodayTitle][!MoveMeter 155 7 LaterTitle][!MoveMeter 185 7 SearchTitle][!SetOption ContextTitle Text "Context"]
MouseLeaveAction=!Execute [!MoveMeter 40 7 ProjectTitle][!MoveMeter 70 7 TodayTitle][!MoveMeter 100 7 LaterTitle][!MoveMeter 130 7 SearchTitle][!SetOption ContextTitle Text "@"]

[ProjectTitle]
Meter=String
MeterStyle=StyleTitle
Text=+
X=40
LeftMouseUpAction=!Execute [!ShowMeterGroup ProjectGroup] [!HideMeterGroup ContextGroup][!MoveMeter 75 85 Task1]
MouseOverAction=!Execute [!MoveMeter 125 7 TodayTitle][!MoveMeter 155 7 LaterTitle][!MoveMeter 185 7 SearchTitle][!SetOption ProjectTitle Text "Project"]
MouseLeaveAction=!Execute [!MoveMeter 70 7 TodayTitle][!MoveMeter 100 7 LaterTitle][!MoveMeter 130 7 SearchTitle][!SetOption ProjectTitle Text "+"]

[TodayTitle]
Meter=String
MeterStyle=StyleTitle
Text==
X=70
LeftMouseUpAction=!Execute [!ShowMeterGroup TodayGroup][!HideMeterGroup SevenGroup] [!HideMeterGroup TaskGroup]
MouseOverAction=!Execute [!MoveMeter 155 7 LaterTitle][!MoveMeter 185 7 SearchTitle][!SetOption TodayTitle Text "Today"]
MouseLeaveAction=!Execute [!MoveMeter 100 7 LaterTitle][!MoveMeter 130 7 SearchTitle][!SetOption TodayTitle Text "="]

[LaterTitle]
Meter=String
MeterStyle=StyleTitle
Text=>
X=100
LeftMouseUpAction=!Execute [!ShowMeterGroup SevenGroup][!HideMeterGroup TaskGroup] [!HideMeterGroup TodayGroup]
MouseOverAction=!Execute [!MoveMeter 185 7 SearchTitle][!SetOption LaterTitle Text "Later"]
MouseLeaveAction=!Execute [!MoveMeter 130 7 SearchTitle][!SetOption LaterTitle Text ">"]

[SearchTitle]
Meter=String
MeterStyle=StyleTitle
Text=?
X=130
;LeftMouseUpAction=!Execute [!ShowMeterGroup ProjectGroup] [!HideMeterGroup ContextGroup]

[styleSeperator]
SolidColor=255,255,255,15
X=r
Y=0R
H=1
W=((#SCREENAREAWIDTH#/6)-16)

[meterSeperator]
Meter=IMAGE
MeterStyle=styleSeperator
X=8

[ToDoTypeTitle]
Meter=String
StringAlign=CENTER
StringCase=UPPER
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontname#
FontSize=10
AntiAlias=1
ClipString=0
X=(#SCREENAREAWIDTH#/12)
W=(#SCREENAREAWIDTH#/12)
Text=#Keyword# · %1
Y=2R

[meterSeperator1]
Meter=IMAGE
MeterStyle=styleSeperator
X=8

[TextStyle]
X=0
Y=2R
FontFace=#fontname#
FontSize=11
FontColor=0,0,0,80
SolidColor=0,0,0,1
AntiAlias=1

[MeterHeader]
Meter=String
MeterStyle=TextStyle
X=10
Y=4R
H=18
W=(#SCREENAREAWIDTH#/6-20)
SolidColor=255,255,255,50
Text=Add Task
LeftMouseUpAction=!CommandMeasure "MeasureInput" "ExecuteBatch 1"

[MeasureInput]
Measure=Plugin
Plugin=InputText.dll
X=10
Y=55
H=18
W=(#SCREENAREAWIDTH#/6-20)
FontFace=Trebuchet MS
FontSize=11
FontColor=0,0,0,80
SolidColor=255,255,255,70
Command1=!Execute [!WriteKeyValue Variables UserInput "$UserInput$" "#CURRENTPATH#test.ini"] [!Refresh "#CURRENTCONFIG#"]
DynamicVariables=1

[MeasureScript]
Measure=Script
ScriptFile="#CURRENTPATH#testdummy3.lua"
FileName="D:\Dropbox\Rainmeter\1 - WHITE\todoc.txt"
UpdateDivider=-1

[CstyleLeftText]
StringAlign=LEFT
StringCase=NONE
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontname#
FontSize=10
AntiAlias=1
X=0r
Y=2R
SolidColor=0,0,0,1
AntiAlias=1
Group=ContextGroup
Hidden=1

[Context1]
Meter=String
MeterStyle=CstyleLeftText
X=5
Y=78

[Context2]
Meter=String
MeterStyle=CstyleLeftText

[Context3]
Meter=String
MeterStyle=CstyleLeftText

[Context4]
Meter=String
MeterStyle=CstyleLeftText

[Context5]
Meter=String
MeterStyle=CstyleLeftText

[Context6]
Meter=String
MeterStyle=CstyleLeftText

[Context7]
Meter=String
MeterStyle=CstyleLeftText

[Context8]
Meter=String
MeterStyle=CstyleLeftText

[Context9]
Meter=String
MeterStyle=CstyleLeftText

[Context10]
Meter=String
MeterStyle=CstyleLeftText

[PstyleLeftText]
StringAlign=LEFT
StringCase=NONE
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontname#
FontSize=11
AntiAlias=1
X=0r
Y=2R
SolidColor=0,0,0,1
AntiAlias=1
Group=ProjectGroup
Hidden=1

[Project1]
Meter=String
MeterStyle=PstyleLeftText
Y=78

[Project2]
Meter=String
MeterStyle=PstyleLeftText

[Project3]
Meter=String
MeterStyle=PstyleLeftText

[Project4]
Meter=String
MeterStyle=PstyleLeftText

[Project5]
Meter=String
MeterStyle=PstyleLeftText

[Project6]
Meter=String
MeterStyle=PstyleLeftText

[Project7]
Meter=String
MeterStyle=PstyleLeftText

[Project8]
Meter=String
MeterStyle=PstyleLeftText



[styleLeftText]
StringAlign=LEFT
StringCase=NONE
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,20
FontColor=255,255,255,250
FontFace=#fontname#
FontSize=8
AntiAlias=1
X=r
Y=1R
H=26
W=(#SCREENAREAWIDTH#/6-20)
ClipString=1
SolidColor=0,0,0,1
Hidden=0
Group=TaskGroup

[Task1]
Meter=String
MeterStyle=styleLeftText
Y=78
X=8

[meterSeperator3]
Meter=IMAGE
MeterStyle=styleSeperator

[Task2]
Meter=String
MeterStyle=styleLeftText

[meterSeperator4]
Meter=IMAGE
MeterStyle=styleSeperator

[Task3]
Meter=String
MeterStyle=styleLeftText

[meterSeperator5]
Meter=IMAGE
MeterStyle=styleSeperator

[Task4]
Meter=String
MeterStyle=styleLeftText

[meterSeperator6]
Meter=IMAGE
MeterStyle=styleSeperator

[Task5]
Meter=String
MeterStyle=styleLeftText

[meterSeperator7]
Meter=IMAGE
MeterStyle=styleSeperator

[Task6]
Meter=String
MeterStyle=styleLeftText

[meterSeperator8]
Meter=IMAGE
MeterStyle=styleSeperator

[Task7]
Meter=String
MeterStyle=styleLeftText

[meterSeperator9]
Meter=IMAGE
MeterStyle=styleSeperator

[TstyleLeftText]
StringAlign=LEFT
StringCase=NONE
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,20
FontColor=255,255,255,250
FontFace=#fontname#
FontSize=8
AntiAlias=1
X=0r
Y=1R
H=26
W=(#SCREENAREAWIDTH#/6-20)
ClipString=1
SolidColor=0,0,0,1
AntiAlias=1
Group=TodayGroup
Hidden=1

[Today1]
Meter=String
MeterStyle=TstyleLeftText
Y=78

[Today2]
Meter=String
MeterStyle=TstyleLeftText

[Today3]
Meter=String
MeterStyle=TstyleLeftText

[Today4]
Meter=String
MeterStyle=TstyleLeftText

[Today5]
Meter=String
MeterStyle=TstyleLeftText

[Today6]
Meter=String
MeterStyle=TstyleLeftText

[Today7]
Meter=String
MeterStyle=TstyleLeftText

[Today8]
Meter=String
MeterStyle=TstyleLeftText

[SstyleLeftText]
StringAlign=LEFT
StringCase=NONE
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,20
FontColor=255,255,255,250
FontFace=#fontname#
FontSize=8
AntiAlias=1
X=0r
Y=1R
H=26
W=(#SCREENAREAWIDTH#/6-20)
ClipString=1
SolidColor=0,0,0,1
AntiAlias=1
Group=SevenGroup
Hidden=1

[Seven1]
Meter=String
MeterStyle=SstyleLeftText
Y=78

[Seven2]
Meter=String
MeterStyle=SstyleLeftText

[Seven3]
Meter=String
MeterStyle=SstyleLeftText

[Seven4]
Meter=String
MeterStyle=SstyleLeftText

[Seven5]
Meter=String
MeterStyle=SstyleLeftText

[Seven6]
Meter=String
MeterStyle=styleLeftText

[Seven7]
Meter=String
MeterStyle=SstyleLeftText

[StyleTitle2]
StringAlign=RIGHT
StringCase=UPPER
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontname#
FontSize=13
AntiAlias=1
Y=7R
X=(#SCREENAREAWIDTH#/6-8)
DynamicVariables=1
TEXT=X
Hidden=0

[Mark1]
Meter=String
MeterStyle=StyleTitle2
Y=78

[Mark2]
Meter=String
MeterStyle=StyleTitle2

[Mark3]
Meter=String
MeterStyle=StyleTitle2

[Mark4]
Meter=String
MeterStyle=StyleTitle2

[Mark5]
Meter=String
MeterStyle=StyleTitle2

[Mark6]
Meter=String
MeterStyle=StyleTitle2

[Mark7]
Meter=String
MeterStyle=StyleTitle2

User avatar
smurfier
Moderator
Posts: 1937
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Lua Script todo.txt

smurfier » April 6th, 2012, 5:26 pm

I'm pretty sure it's the UpdateDivider=-1 on the script measure. If I remember previous discussions correctly, using that on a script measure actually causes the measure to update twice, not the advertised once. Try leaving it enabled and just disable it at the end of Update().
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
aidayong
Posts: 18
Joined: June 22nd, 2011, 7:59 am

Re: Lua Script todo.txt

aidayong » April 7th, 2012, 3:36 am

it helps a lot by by disabling the measurescript. now the script run once. thanks

skin.ini

Code: Select all

[MeasureScript]
Measure=Script
ScriptFile="#CURRENTPATH#testdummy3.lua"
FileName="D:\Dropbox\Rainmeter\1 - WHITE\todoc.txt"
Disabled=0
skin.lua

Code: Select all

	
SKIN:Bang('!DisableMeasure MeasureScript')
end -->Update
User avatar
jsmorley
Developer
Posts: 19461
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Lua Script todo.txt

jsmorley » April 7th, 2012, 7:52 am

aidayong wrote:

Code: Select all

	
SKIN:Bang('!DisableMeasure MeasureScript')
end -->Update

Code: Select all


SELF:Disable()
end -->Update
Also works.