It is currently September 14th, 2024, 8:24 am

Quoteplugin.dll pull limit

Get help with creating, editing & fixing problems with skins
User avatar
jsmorley
Developer
Posts: 22743
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Quoteplugin.dll pull limit

Post by jsmorley »

Here is what you will need to create:

First create LuaQuotes.ini in a folder called LuaQuotes in My Documents\Skins\

Code: Select all

[Rainmeter]
Author=Jeffrey Morley
Update=1000
DynamicWindowSize=1

[MeasureLuaScript]
Measure=Script
ScriptFile=#CURRENTPATH#LuaQuotes.lua
TableName=LuaQuotes
FileToRead=#CURRENTPATH#Quotes.txt
UpdateDivider=10

[MeterQuote]
Meter=String
X=0
Y=0
W=200
H=90
FontFace=Segoe UI
FontColor=255,255,255,255
FontSize=12
StringStyle=Bold
ClipString=1
AntiAlias=1
Then create a file called LuaQuotes.lua in the same folder:

Code: Select all

PROPERTIES =
{

	FileToRead = "";

}

function Initialize()

	hQuoteFile = io.input(PROPERTIES.FileToRead)
	iCount = 1
	while true do
		local sLine = io.read()
		if sLine == nil then break end
		iCount = iCount + 1
	end		
	io.flush(hQuoteFile)
	
	MeterQuote = tolua.cast(SKIN:GetMeter("MeterQuote"), "CMeterString")

end -- function Initialize

function Update()

	hQuoteFile = io.input(PROPERTIES.FileToRead)
	
	sLineNumber = math.random(iCount -1)
	TO.LuaLog(tostring(sLineNumber))
	for i = 1, sLineNumber -1 do
		io.read()
	end

	sLineToReturn = io.read()
	
	MeterQuote:SetText(tostring(sLineToReturn))
	
	io.flush(hQuoteFile)
	
end -- function Update

function GetStringValue()

	return "Line "..tostring(sLineNumber).." Returned"
	
end -- function GetStringValue
Note that white space is not important to lua at all, so how you indent and where and if you put blank lines between statements is up to you, HOWEVER, lua IS "case sensitive". The case of everything should be exactly as I have it.

This code assumes you have a file called Quotes.txt that is just lines of text like:

I totally take back all those times I didn't want to nap when I was younger.
Nothing sucks more than that moment during an argument when you realize you're wrong.
A closed mouth gathers no foot.
A crisis is when you can't say "Let's forget the whole thing."

If the format is different I might need to tweak the lua just a tad, but it will be able to handle pretty much anything you throw at it.
1-24-2011 8-30-56 PM.jpg
You do not have the required permissions to view the files attached to this post.
Airyn_Reine
Posts: 13
Joined: July 4th, 2010, 4:32 am

Re: Quoteplugin.dll pull limit

Post by Airyn_Reine »

oh i'm sorry, misunderstood, thought you wanted first 100 lines of the ini :P

quotes file looks like this

Better to be p1ssed off than p1ssed on.[]Man who keep feet planted firmly on ground have trouble putting on pants.[]Man with one chopstick go hungry.[]<just4helpin> How did you guys come up with ideas for your user names?
<synth> I dunno.
<Wrench> I'm a tool.[]Man with athletic finger make broad jump[]etc[]etc[]etc[]continues until end
User avatar
jsmorley
Developer
Posts: 22743
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Quoteplugin.dll pull limit

Post by jsmorley »

Hm... I will have to tweak the lua a bit as right now it is reading "lines" from the file and picking a random line number. Let me play with this a bit.
User avatar
jsmorley
Developer
Posts: 22743
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Quoteplugin.dll pull limit

Post by jsmorley »

Oh, by the way. Thank you for your service.
Airyn_Reine
Posts: 13
Joined: July 4th, 2010, 4:32 am

Re: Quoteplugin.dll pull limit

Post by Airyn_Reine »

Any help is greatly appreciated. Thank You.
Airyn_Reine
Posts: 13
Joined: July 4th, 2010, 4:32 am

Re: Quoteplugin.dll pull limit

Post by Airyn_Reine »

I figure it's a bit unfair to ask for help if I don't at least give a peak at what I'm doing :P
I don't use windows shell, using emerge desktop, so upper left icon area, top right systray, and bottom center clock and tasktray are not part of rainmeter.
Also, hidden, I have a full screen random image display skin minimized in bottom left corner...
When I find time, I will also be reworking the sysmeter skin on the left, adding a hide feature, better gfx, etc etc. Right side text listing will be revamped a bit too... In development, at least in my mind :P, is a skin for comic viewing, sortuva cbr/cbz function, will be great... just gotta write them
You do not have the required permissions to view the files attached to this post.
Airyn_Reine
Posts: 13
Joined: July 4th, 2010, 4:32 am

Re: Quoteplugin.dll pull limit

Post by Airyn_Reine »

well, good news, for me anyway... I managed to figure out the skin for a sequential graphical browser (I use it to display calvin and hobbes now)... haven't checked any of the other threads, figured it out on my own, but for anyone interested, using the calc function to increase a variable, rainmeter automatically appends .000000 to the end of it. Didn't know that. Solved the call function in the meter by simply renaming all the pics *.000000.jpg... Simple solution, minimal effort.

Took me 3 hours to figure this out... I'm sure all this might seem elementary to some, but nothing is mentioned on it in the manual, and i rather enjoy the time i spend righting (and writing) the quirks I find

I'm not a programmer, and have little experience programming (a single beginner class in VBasic is all i have).
User avatar
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

Re: Quoteplugin.dll pull limit

Post by Chewtoy »

You can also add a Substitute=".0000":"" to the calc.
I don't think, therefore I'm not.
Airyn_Reine
Posts: 13
Joined: July 4th, 2010, 4:32 am

Re: Quoteplugin.dll pull limit

Post by Airyn_Reine »

Thanks, I'll remember that for future skins...
Airyn_Reine
Posts: 13
Joined: July 4th, 2010, 4:32 am

Re: Quoteplugin.dll pull limit

Post by Airyn_Reine »

Ok, I know I'm gonna seem like a retard for taking so long to solve this problem (to my liking), but I actually set it aside after my last post and simply forgot about it. However, while editing a different skin, it hit me like a bird on a window.
Using a randomly generated variable to call separate files using the quoteplugin measure works just fine, so long as you don't use !SetVariable, quoteplugin wouldn't read variables set this way. <250 separators per file, should be well within quoteplugin capability to access all quotes.
I hope this will be of use to someone else, cuz it really annoys me it took this long to figger out... By the way, lua was not used in the final scripting.

--- abbreviated
[Rainmeter]
Update=-1

[variables]
file=1

[RandomCalc]
Low,1;High,9

[Quoteplugin]
pathname=#file#.txt

LeftMouseAction= !Execute [!WriteKeyValue variables file [Random]] [!Refresh]