It is currently April 19th, 2024, 6:42 pm

Need help with a skin that uses a web page

Get help with creating, editing & fixing problems with skins
Greyrat
Posts: 28
Joined: July 8th, 2016, 10:28 am

Need help with a skin that uses a web page

Post by Greyrat »

Hello there,I need help making a skin that uses some code from a website:
view-source:https://store.enmasse.com/closers/items,
specifically, lines 163 and 168 (the free code portion)
Image
I want them to be displayed as texts in the skin but I don't know how, since the code changes everyday.
User avatar
balala
Rainmeter Sage
Posts: 16145
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Need help with a skin that uses a web page

Post by balala »

Have you wrote a Rainmeter code so far? Please post it.
Greyrat
Posts: 28
Joined: July 8th, 2016, 10:28 am

Re: Need help with a skin that uses a web page

Post by Greyrat »

No,I haven't. I really don't know how to do this.
BobbyBoy
Posts: 10
Joined: June 21st, 2018, 5:09 am

Re: Need help with a skin that uses a web page

Post by BobbyBoy »

Greyrat wrote:No,I haven't. I really don't know how to do this.
Looking at your post history you do. Keep trying! :D
Greyrat
Posts: 28
Joined: July 8th, 2016, 10:28 am

Re: Need help with a skin that uses a web page

Post by Greyrat »

No I don't.I just copy from other skins and try to figure stuff our from there. But I'm totally stumped here, how do I even get the information from the website and make it be usable by the skin.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Need help with a skin that uses a web page

Post by kyriakos876 »

Greyrat wrote:Hello there,I need help making a skin that uses some code from a website:
view-source:https://store.enmasse.com/closers/items,
specifically, lines 163 and 168 (the free code portion)
Image
I want them to be displayed as texts in the skin but I don't know how, since the code changes everyday.
First of all you can't parse view-source.... you need to use "https://store.enmasse.com/closers/items" alone.
I would write you the regular experssions but when I open that in my browser the line 168 is empty... and line 163 is different from what you've posted so I suppose it changed. If you want to get the line 163, you would need this:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[MeterString]
Meter=String
MeasureName=MeasureThis
DynamicVariables=1

[MeasureThis]
Measure=Plugin
Plugin=WebParser
URL="https://store.enmasse.com/closers/items"
RegExp=(?siU)<h3>(.*)</h3>.*
StringIndex=1
OnChangeAction=[!UpdateMeter MeterString][!Redraw]
DynamicVariables=1
User avatar
xenium
Posts: 865
Joined: January 4th, 2018, 9:52 pm

Re: Need help with a skin that uses a web page

Post by xenium »

Greyrat wrote:Hello there,I need help making a skin that uses some code from a website:
view-source:https://store.enmasse.com/closers/items,
specifically, lines 163 and 168 (the free code portion)
Image
I want them to be displayed as texts in the skin but I don't know how, since the code changes everyday.
See if it works and in the next days:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
UpdateRateSeconds=600

URL=https://store.enmasse.com/closers/items


[MeasureNAME]
Measure=WebParser
Url=#URL#
RegExp=(?siU)<h3>(.*)</h3>.*<div class="free">(.*)</div>.*<div class="code">.*<small>Redeem Code In <span>Closers Game Launcher</span></small>.*<img id="scissors" src="https://static.enmasse.com/images/closers/daily-deals/scissors.png" /><span id="free-code"><p>(.*)</p></span>
StringIndex=1
UpdateRate=#UpdateRateSeconds#

[MeasureFREE]
Measure=WebParser
Url=[MeasureNAME]
StringIndex=2

[MeasureCODE]
Measure=WebParser
Url=[MeasureNAME]
StringIndex=3

[MeterText]
Meter=String
MeasureName=MeasureNAME
MeasureName2=MeasureFREE
MeasureName3=MeasureCODE
StringAlign=center
FontFace=arial
FontColor=255,255,255,255
FontSize=10
StringStyle=Normal
X=100
Y=100
W=300
H=100
Text=%1 #CRLF# %2 #CRLF# %3
AntiAlias=1
image.PNG
Edited:
I see that it displays the new NAME and the new CODE and after they either changed.
See how it works and in the next days.
Edited2:
A small change to RegExp to work again
You do not have the required permissions to view the files attached to this post.
Last edited by xenium on October 14th, 2018, 2:02 pm, edited 3 times in total.
User avatar
balala
Rainmeter Sage
Posts: 16145
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Need help with a skin that uses a web page

Post by balala »

Beside kyriakos876 and xenium, I also post a reply. Sorry kyriakos876 and xenium...

Ok, let's start creating a skin to do what you want. First you need a new skin. Create one. The easiest way to do this is to open Manage Rainmeter and on the Skins tab click the Create new skin button (next to the Active skins button, in the upper left corner). This opens the Create new skin dialog. In this window, click Add folder and input a name for the folder (MySkin for example - this will be the name of the config). Highlighting the newly created config (MySkin in the above example), click Add skin, then click @Resources. This way you've created the needed structure for your new skin: you have a config (the MySkin folder above), its skin (the NewSkin.ini file - unless you didn't modify the name of the new file) and the associated @Resources folder.
In the Create new skin window, click the Close button. This closes the window and makes a complete refresh of Rainmeter. This refresh needed to allow you to see the newly created skin.
Now open the Skins\MySkin\NewSkin.ini file in your default text editor, whatever it would be. You get a very simple code:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Metadata]
Name=
Author=
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]

[MeterString]
Meter=String
This code has to be extended, adding a few WebParser measures, which will parse the needed information.
First add a DynamicWindowSize=1 option to the [Rainmeter] section, then add the following measures anywhere to your code (well, probably the best would be to add them before the [MeterString] String meter, but finally doesn't matter too much where you add them):

Code: Select all

[MeasureRainmeter]
Measure=WebParser
UpdateRate=900
URL=https://store.enmasse.com/closers/items
RegExp=(?siU)

[MeasureInfo1]
Measure=WebParser
URL=[MeasureRainmeter]
StringIndex=1
See that [MeasureRainmeter] is the parent WebParser measure, while [MeasureInfo1] is the child measure.
The question is what information would you like to get from the site. Because the RegExp option has to be written accordingly.
Finally replace the [MeterString] meter with (for example) the following one. This will be needed to can see the got data:

Code: Select all

[MeterString]
Meter=STRING
MeasureName=MeasureInfo1
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=%1
Now, as I wrote above, the most important question is what you would like to get from the site? I know you wrote in the initial request you'd like the lines 163 and 168 on the posted image, but what exactly is shown right now on the site, what you'd need?
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Need help with a skin that uses a web page

Post by kyriakos876 »

Mad respect to you balala for taking such a detailed approach on this. :17good