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

Help: Rainmeter Skins • Re: Secret Digital Diary help

$
0
0
i decided to make writing the date manually in a txt file but when i click it im not able to edit it from the widget i was wondering if u could fix that and the scroll feature u added i tried to implement that but it didnt work could u help me aaa

Code:

[Variables]CurrentPage=1TotalPages=50PageContent=""PageContent2=""CurrentPage2=[#CurrentPage2]ScrollStep=15PageY=0[Rainmeter]Update=1000AccurateText=1DynamicWindowSize=1OnRefreshAction=[!SetVariable PageContent "[&Script:LoadFile('[#@]Diary\Page[#CurrentPage].txt')]"][!UpdateMeasure PageInput][!UpdateMeter PageText][!UpdateMeter PageNumber][!Redraw][!SetVariable PageContent2 "[&Script:LoadFile('[#@]Diary\\Date[#CurrentPage].txt')]"][!SetVariable PageContent2 "[&Script:LoadFile('[#@]Diary\\Date[#CurrentPage].txt')]"][!UpdateMeasure PageInput1][!UpdateMeter PageText2][!UpdateMeter PageText2][!UpdateMeter PageNumber][!Redraw][Metadata]Name=DigitalDiaryAuthor=YourNameVersion=1.0Information=50-page digital diary with navigation and editing functionality.---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][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=10AntiAlias=1ClipString=2---Meters---[DiaryContainer]Meter=ShapeShape=Rectangle 0,0,350,350,15 | StrokeWidth 0 | Stroke Color 0,0,0,0 | Fill Color 0,0,0,255[ImageNumberCalc]Measure=CalcFormula=Counter % 4DynamicVariables=1[CoverImage]Group=DiaryContainer=DiaryContainerHidden=0Meter=ImageImageName=#@#Images\diary[ImageNumberCalc].pngW=350H=350DynamicVariables=1[PageImage]Group=DiaryContainer=DiaryContainerHidden=1Meter=ImageImageName=#@#Images\page.pngW=350H=350DynamicVariables=1[PageTextOutline4]Group=DiaryHidden=1Meter=StringContainer=PageContainerMeterStyle=TextsX=86Y=81W=176H=191Text="#PageContent#"FontColor=255,255,255,255DynamicVariables=1[PageText]Group=DiaryHidden=1Container=PageContainerMeter=StringMeterStyle=TextsX=85Y=80W=175H=190Text="#PageContent#"LeftMouseUpAction=[!CommandMeasure PageInput "ExecuteBatch All"]DynamicVariables=1[OpenDiary]Group=DiaryHidden=0Meter=ShapeShape=Rectangle 100,120,155,80 | StrokeWidth 0 | Stroke Color 0,0,0,0 | Fill Color 0,0,0,1LeftMouseUpAction=[!ToggleMeterGroup Diary][!Redraw][PrevPage]Group=DiaryHidden=1Meter=ImageImageName=#@#Images\lbutton.pngX=80Y=275W=30H=30LeftMouseUpAction=[!SetVariable CurrentPage (Clamp(#CurrentPage#-1,1,#TotalPages#))][!WriteKeyValue Variables CurrentPage "[#CurrentPage]"][!SetVariable PageContent "[&Script:LoadFile('[#@]Diary\Page[#CurrentPage].txt')]"][!UpdateMeasure PageInput1][!UpdateMeter PageText1][!WriteKeyValue Variables CurrentPage2 "[#CurrentPage2]"][!SetVariable PageContent2 "[&Script:LoadFile('[#@]Diary\Date[#CurrentPage].txt')]"][!UpdateMeasure PageInput2][!UpdateMeter PageText2][!UpdateMeter PageNumber][!Redraw]DynamicVariables=1[PageNumber]Group=DiaryHidden=1Meter=StringMeterStyle=TextsX=172Y=288W=50FontSize=12FontColor=255,255,255,255StringAlign=CenterText=#CurrentPage#LeftMouseUpAction=[!ToggleMeterGroup Diary][!Redraw]DynamicVariables=1[NextPage]Group=DiaryHidden=1Meter=ImageImageName=#@#Images\rbutton.pngX=225Y=275W=30H=30LeftMouseUpAction=[!SetVariable CurrentPage (Clamp(#CurrentPage#+1,1,#TotalPages#))][!WriteKeyValue Variables CurrentPage "[#CurrentPage]"][!SetVariable PageContent "[&Script:LoadFile('[#@]Diary\Page[#CurrentPage].txt')]"][!UpdateMeasure PageInput][!UpdateMeter PageText][!WriteKeyValue Variables CurrentPage2 "[#CurrentPage2]"][!SetVariable PageContent2 "[&Script:LoadFile('[#@]Diary\Date[#CurrentPage].txt')]"][!UpdateMeasure PageInput1][!UpdateMeter PageText2][!UpdateMeter PageNumber][!Redraw]DynamicVariables=1[PageContainer]Group=DiaryHidden=1Meter=ImageX=10Y=-11W=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---Measures---[PageInput2]Measure=PluginPlugin=InputTextX=160Y=50W=175H=190SolidColor=245,235,225,255FontColor=0,0,0,255FontFace=ArialFontSize=10DefaultValue="#PageContent2#"Command1=[!SetVariable PageContent2 """$UserInput$"""][&Script:SaveFile('[#@]Diary\\Date[#CurrentPage].txt','[#PageContent2]')][!UpdateMeasure PageInput1][!UpdateMeter PageText2][!Redraw]DynamicVariables=1---Meters---[DiaryContainer]Meter=ShapeShape=Rectangle 0,0,350,350,15 | StrokeWidth 0 | Stroke Color 0,0,0,0 | Fill Color 0,0,0,255[PageText2]Group=DiaryHidden=1Meter=StringMeterStyle=TextsX=145Y=52W=175H=190Text="#PageContent2#"DynamicVariables=1
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 delirious — 18 minutes ago



Viewing all articles
Browse latest Browse all 1702

Trending Articles