Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 688

Help: Rainmeter Skins • Re: Secret Digital Diary help

$
0
0
one final thing i was wondering if you can add on the top for it to say the date the txt file was written
Alright, got some time and implemented the FileView method of getting the file info that I linked to previously. While this could and should have been tried by you, there were a few particularities of that measure that were not that obvious for a beginner, and I liked the project, so I tackled that myself.
InputDiary_2.0.0.rmskin
Cover.jpg
Page.jpg

Code:

function LoadFile(filepath)  local file, contents = io.open(filepath, 'r'), ''  if file then local alllines = {}; for oneline in file:lines() do alllines[#alllines + 1] = oneline end; contents = table.concat(alllines, '\r\n'); file:close() else print('Unable to load file ' .. filepath) end  return contentsendfunction SaveFile(filepath, contents)  local file, alllines = io.open(filepath, 'w'), {}  if file then for oneline in (contents..'\r\n'):gmatch('(.-)\r\n') do alllines[#alllines + 1] = oneline end; file:write(table.concat(alllines, '\n')); file:close() else print('Unable to save file ' .. filepath) end  return trueend

Code:

[Variables]CurrentPage=5TotalPages=50PageContent=""PageY=0ScrollStep=15[Rainmeter]Update=1000AccurateText=1DynamicWindowSize=1[Metadata]Name=InputDiaryAuthor=Yincognito (idea and original code by delirious)Version=2.0Information=50-page digital diary with navigation and editing functionality.License=Creative Commons Attribution-Noncommercial-Share Alike 4.0---Measures---[Script]Measure=ScriptScriptFile=#@#Scripts\Script.luaUpdateDivider=-1OnUpdateAction=[!SetVariable PageY 0][!SetVariable PageContent "[&Script:LoadFile('[#@]Diary\Page[#CurrentPage].txt')]"][!SetOption Folder WildcardSearch "Page[#CurrentPage].txt"][!UpdateMeasureGroup Page][!CommandMeasure Folder "Update"][!UpdateMeter *][!Redraw]DynamicVariables=1[Folder]Group=PageMeasure=PluginPlugin=FileViewPath=#@#DiaryWildcardSearch=Page[#CurrentPage].txtShowDotDot=0ShowFolder=0Count=1FinishAction=[!UpdateMeter *][!Redraw][FileName]Group=Page|FileMeasure=PluginPlugin=FileViewPath=[Folder]Type=FileNameIgnoreCount=1Index=1RegExpSubstitute=1Substitute="^$":"No File"[FileSize]Group=Page|FileMeasure=PluginPlugin=FileViewPath=[Folder]Type=FileSizeIgnoreCount=1Index=1RegExpSubstitute=1Substitute="^$":"0"[FileDate]Group=Page|FileMeasure=PluginPlugin=FileViewPath=[Folder]Type=FileDateDateType=ModifiedIgnoreCount=1Index=1RegExpSubstitute=1Substitute="^$":"No Date"[PageInput]Group=PageMeasure=PluginPlugin=InputTextX=[PageContainer:X]Y=[PageContainer:Y]W=[PageContainer:W]H=[PageContainer:H]SolidColor=245,235,225,255FontColor=0,0,0,255FontFace=ArialFontSize=10DefaultValue="#PageContent#"Command1=[!SetVariable PageY 0][!SetVariable PageContent """$UserInput$"""][&Script:SaveFile('[#@]Diary\Page[#CurrentPage].txt','[#PageContent]')][!SetOption Folder WildcardSearch "Page[#CurrentPage].txt"][!UpdateMeasureGroup Page][!CommandMeasure Folder "Update"][!UpdateMeter *][!Redraw]OnDismissAction=[]UpdateDivider=-1DynamicVariables=1---Styles---[Texts]FontColor=0,0,0,255FontFace=ArialFontSize=9.765AntiAlias=1ClipString=2---Meters---[CoverImage]Group=DiaryHidden=0Meter=ImageImageName=#@#Images\diary.pngW=359H=359DynamicVariables=1[OpenDiary]Group=DiaryHidden=0Meter=ShapeShape=Rectangle 103,123,159,82 | StrokeWidth 0 | Stroke Color 0,0,0,0 | Fill Color 0,0,0,1LeftMouseUpAction=[!ToggleMeterGroup Diary][!Redraw][PageImage]Group=DiaryHidden=1Meter=ImageImageName=#@#Images\page.pngW=359H=359DynamicVariables=1[PageInfo]Group=DiaryHidden=1Meter=StringMeterStyle=TextsX=192Y=8W=282FontFace=Segoe UIFontSize=10FontWeight=700FontColor=255,0,128,255StringAlign=CenterMeasureName=FileNameMeasureName2=FileSizeMeasureName3=FileDateText=%1 (%2 b, %3)LeftMouseUpAction=[!CommandMeasure FileDate "Open"]DynamicVariables=1[PageContainer]Group=DiaryHidden=1Meter=ImageX=51Y=38W=282H=285SolidColor=0,0,0,255MouseScrollUpAction=[!SetVariable PageY (Clamp((#PageY#+#ScrollStep#),([PageContainer:H]-[PageText:H]),0))][!UpdateMeter *][!Redraw]MouseScrollDownAction=[!SetVariable PageY (Clamp((#PageY#-#ScrollStep#),([PageContainer:H]-[PageText:H]),0))][!UpdateMeter *][!Redraw]DynamicVariables=1[PageText]Group=DiaryHidden=1Container=PageContainerMeter=StringMeterStyle=TextsX=0Y=#PageY#W=282Text="#PageContent#"LeftMouseUpAction=[!SetVariable PageY 0][!UpdateMeter PageText][!UpdateMeasure PageInput][!Redraw][!CommandMeasure PageInput "ExecuteBatch All"]DynamicVariables=1[PrevPage]Group=DiaryHidden=1Meter=ImageImageName=#@#Images\lbutton.pngX=107Y=323W=30H=30LeftMouseUpAction=[!SetVariable PageY 0][!SetVariable CurrentPage (Clamp(#CurrentPage#-1,1,#TotalPages#))][!WriteKeyValue Variables CurrentPage "[#CurrentPage]"][!SetVariable PageContent "[&Script:LoadFile('[#@]Diary\Page[#CurrentPage].txt')]"][!SetOption Folder WildcardSearch "Page[#CurrentPage].txt"][!UpdateMeasureGroup Page][!CommandMeasure Folder "Update"][!UpdateMeter *][!Redraw]DynamicVariables=1[PageNumber]Group=DiaryHidden=1Meter=StringMeterStyle=TextsX=192Y=328W=51FontSize=14StringAlign=CenterText=#CurrentPage#LeftMouseUpAction=[!ToggleMeterGroup Diary][!Redraw]DynamicVariables=1[NextPage]Group=DiaryHidden=1Meter=ImageImageName=#@#Images\rbutton.pngX=248Y=323W=30H=30LeftMouseUpAction=[!SetVariable PageY 0][!SetVariable CurrentPage (Clamp(#CurrentPage#+1,1,#TotalPages#))][!WriteKeyValue Variables CurrentPage "[#CurrentPage]"][!SetVariable PageContent "[&Script:LoadFile('[#@]Diary\Page[#CurrentPage].txt')]"][!SetOption Folder WildcardSearch "Page[#CurrentPage].txt"][!UpdateMeasureGroup Page][!CommandMeasure Folder "Update"][!UpdateMeter *][!Redraw]DynamicVariables=1
I added other improvements and features as well, described in the screenshot. The skin is 9 pixels larger this time and the font has a fractional value, in order to fit the text precisely along the page line separators and lines to have an integer height to facilitate scrolling.

Statistics: Posted by Yincognito — Today, 5:37 pm



Viewing all articles
Browse latest Browse all 688

Trending Articles