It is currently May 2nd, 2024, 2:06 pm

Web Browser?

Get help with creating, editing & fixing problems with skins
User avatar
ScoobSTi
Posts: 127
Joined: September 12th, 2012, 10:49 pm

Web Browser?

Post by ScoobSTi »

Hey,

I've been poking around searching things on these forums and I read that it might be possible to create a web browser on Rainmeter either using C++ or AutoIt.

Can someone verify this? And possibly point me in the right direction? I'm still working on my Android skin, and if this would be possible, I would honestly bow down to that user.
Image
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Web Browser?

Post by Kaelri »

I suspect you would find it much, much easier to recreate Rainmeter in a browser than the other way around.

Is there a specific goal that you would like to accomplish by doing this? It's likely that there's an easier way using existing tools. But if you just want to create a general web browser within Rainmeter, then... it's "possible" in the sense of "circumnavigating the globe using only a pogo stick" possible. The question is why you would want to. :)
User avatar
ScoobSTi
Posts: 127
Joined: September 12th, 2012, 10:49 pm

Re: Web Browser?

Post by ScoobSTi »

Dang, I knew it would be crazy to ask! :rofl:

I never actually meant a browser as in "type in a URL and go there". I was hoping that somehow, I could type something into my Google Search bar and it would relay the results back to Rainmeter from the internet and display it on the screen, like Google Now.
Image
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Web Browser?

Post by Kaelri »

Ah, that's much more reasonable. :)

Displaying Google search results is quite easy. You wouldn't able to get the more sophisticated features from the actual search results webpage, such as the "OneBox" gadgets or topic information in the sidebar. But if you just want a list of results, you can use the standard API. The process would go something like this:

1) Use the InputText plugin to get the user's search string. Write the search to the skin file as a variable, using the !WriteKeyValue bang.

Code: Select all

Command1=!WriteKeyValue Variables SearchTerms """$UserInput$""" "#CURRENTCONFIG#"
3) !Refresh the skin so that the new variable can be used.

4) Use the WebParser plugin to send the search term to Google and retrieve the results.

Code: Select all

[MeasureGoogleSearch]
Measure=Plugin
Plugin=WebParser
UpdateRate=-1
URL=http://ajax.googleapis.com/ajax/services/search/web?v=1.0&rsz=large&q=#SearchTerms#
RegExp=...
StringIndex=1
(See the WebParser tutorial for more about using RegExp to match the page content and split it up into different values using StringIndex.)
User avatar
ScoobSTi
Posts: 127
Joined: September 12th, 2012, 10:49 pm

Re: Web Browser?

Post by ScoobSTi »

I hope it's ok to bump this old thread... :(

I've been a bit busy with life, but work has resumed on the skin. I've got the Variables working properly. When I hit "enter" in the search bar, it writes what I typed in into the Variables section called "SearchTerms", which is what you gave me.

I've conjured up this meter myself, which is probably why it isn't working.

Code: Select all

[MeasureGoogleSearch]
Measure=Plugin
Plugin=WebParser
UpdateRate=-1
URL=http://ajax.googleapis.com/ajax/services/search/web?v=1.0&rsz=large&q=#SearchTerms#
RegExp="(?siU)<h3 class="r">(.*)</h3>(.*)<div class="s">(.*)</div>(.*)"
StringIndex=1


[MeterGoogleSearchResults]
MeasureName=MeasureGoogleSearch
Meter=STRING
X=100
Y=100
FontColor=255,255,255,255
FontSize=20
FontFace=Roboto
Antialias=1
I guess you can tell I have no idea what I'm doing with WebParser. I got the RegExp contents by Googling a random topic and getting the source from the results page. The "h3 class" and "div" codes are the first result's title and page info, respectively.

They don't pop up in the skin, so obviously I've done something wrong.
Image
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Web Browser?

Post by Kaelri »

The results from the Google Search API are not formatted in the same way as a search results page in your browser. (I recommend using jsmorley's RainRegExp tool, which will let you see exactly what Rainmeter receives in a WebParser measure.) For example, these are the results from a search for "Rainmeter":

Code: Select all

"results":[
			{
				"GsearchResultClass":"GwebSearch",
				"unescapedUrl":"http://rainmeter.net/",
				"url":"http://rainmeter.net/",
				"visibleUrl":"rainmeter.net",
				"cacheUrl":"http://www.google.com/search?q\u003dcache:AgW0D1bQ1CEJ:rainmeter.net",
				"title":"\u003cb\u003eRainmeter\u003c/b\u003e, desktop customization tool",
				"titleNoFormatting":"Rainmeter, desktop customization tool",
				"content":"\u003cb\u003eRainmeter\u003c/b\u003e displays customizable skins, like memory and battery power, RSS   feeds and weather forecasts, right on your desktop. Many skins are even   functional: \u003cb\u003e...\u003c/b\u003e"
			},
			{
				"GsearchResultClass":"GwebSearch",
				"unescapedUrl":"http://customize.org/rainmeter",
				"url":"http://customize.org/rainmeter",
				"visibleUrl":"customize.org",
				"cacheUrl":"http://www.google.com/search?q\u003dcache:x8EwMIfIuBQJ:customize.org",
				"title":"\u003cb\u003eRainmeter\u003c/b\u003e Skins - Customize.org",
				"titleNoFormatting":"Rainmeter Skins - Customize.org",
				"content":"Download skins for \u003cb\u003eRainmeter\u003c/b\u003e from the original skins and themes site! We have   the best selection of \u003cb\u003eRainmeter\u003c/b\u003e Skins available for free download..."
			},
			{
				"GsearchResultClass":"GwebSearch",
				"unescapedUrl":"http://rainmeter.deviantart.com/",
				"url":"http://rainmeter.deviantart.com/",
				"visibleUrl":"rainmeter.deviantart.com",
				"cacheUrl":"http://www.google.com/search?q\u003dcache:_HHhzXdQkZUJ:rainmeter.deviantart.com",
				"title":"#\u003cb\u003eRainmeter\u003c/b\u003e on deviantART",
				"titleNoFormatting":"#Rainmeter on deviantART",
				"content":"Art - community of artists and those devoted to art. Digital art, skin art, themes,   wallpaper art, traditional art, photography, poetry / prose. Art prints."
			},
			{
				"GsearchResultClass":"GwebSearch",
				"unescapedUrl":"http://lifehacker.com/rainmeter/",
				"url":"http://lifehacker.com/rainmeter/",
				"visibleUrl":"lifehacker.com",
				"cacheUrl":"http://www.google.com/search?q\u003dcache:UnnpoI5FDcMJ:lifehacker.com",
				"title":"\u003cb\u003eRainmeter\u003c/b\u003e News, Videos, Reviews and Gossip - Lifehacker",
				"titleNoFormatting":"Rainmeter News, Videos, Reviews and Gossip - Lifehacker",
				"content":"4 days ago \u003cb\u003e...\u003c/b\u003e The Orbital Control Desktop. The HAL 9000 Desktop. The Before Dusk Desktop."
			},
			{
				"GsearchResultClass":"GwebSearch",
				"unescapedUrl":"http://lifehacker.com/5828789/how-to-create-an-attractive-customized-desktop-hud-with-rainmeter",
				"url":"http://lifehacker.com/5828789/how-to-create-an-attractive-customized-desktop-hud-with-rainmeter",
				"visibleUrl":"lifehacker.com",
				"cacheUrl":"http://www.google.com/search?q\u003dcache:HC_Xrh1i6r4J:lifehacker.com",
				"title":"How to Create an Attractive, Customized Desktop HUD with \u003cb\u003eRainmeter\u003c/b\u003e",
				"titleNoFormatting":"How to Create an Attractive, Customized Desktop HUD with Rainmeter",
				"content":"Aug 9, 2011 \u003cb\u003e...\u003c/b\u003e Whether your goal is to make your desktop look beautiful or you want an   information-rich desktop that provides constant track of your system \u003cb\u003e...\u003c/b\u003e"
			},
			{
				"GsearchResultClass":"GwebSearch",
				"unescapedUrl":"http://lifehacker.com/5084412/configure-your-own-rainmeter-10+foot-hud",
				"url":"http://lifehacker.com/5084412/configure-your-own-rainmeter-10%2Bfoot-hud",
				"visibleUrl":"lifehacker.com",
				"cacheUrl":"http://www.google.com/search?q\u003dcache:qW1RWTWbQc4J:lifehacker.com",
				"title":"Configure Your Own \u003cb\u003eRainmeter\u003c/b\u003e 10-Foot HUD",
				"titleNoFormatting":"Configure Your Own Rainmeter 10-Foot HUD",
				"content":"Nov 12, 2008 \u003cb\u003e...\u003c/b\u003e Windows only: Yesterday you saw reader Espiox\u0026#39;s beautiful time and weather   heads-up display on his desktop using the free \u003cb\u003eRainmeter\u003c/b\u003e utility; \u003cb\u003e...\u003c/b\u003e"
			},
			{
				"GsearchResultClass":"GwebSearch",
				"unescapedUrl":"http://code.google.com/p/rainmeter/",
				"url":"http://code.google.com/p/rainmeter/",
				"visibleUrl":"code.google.com",
				"cacheUrl":"",
				"title":"\u003cb\u003erainmeter\u003c/b\u003e - Desktop customization tool for Windows - Google Project \u003cb\u003e...\u003c/b\u003e",
				"titleNoFormatting":"rainmeter - Desktop customization tool for Windows - Google Project ...",
				"content":"\u003cb\u003eRainmeter\u003c/b\u003e is a desktop customization platform. Through \u003cb\u003eRainmeter\u003c/b\u003e, you can   enhance your desktop with skins: handy, compact applets which float freely on   your \u003cb\u003e...\u003c/b\u003e"
			},
			{
				"GsearchResultClass":"GwebSearch",
				"unescapedUrl":"http://browse.deviantart.com/customization/skins/sysmonitor/",
				"url":"http://browse.deviantart.com/customization/skins/sysmonitor/",
				"visibleUrl":"browse.deviantart.com",
				"cacheUrl":"http://www.google.com/search?q\u003dcache:taxOfcowV_gJ:browse.deviantart.com",
				"title":"System Monitoring - Browsing System Monitoring on deviantART",
				"titleNoFormatting":"System Monitoring - Browsing System Monitoring on deviantART",
				"content":"All Categories · Customization · Skins \u0026amp; Themes · System Monitoring · AXE ·   BoxSys · ConWatch · Consolable · Inhotus · Oxygenator · QX · \u003cb\u003eRainmeter\u003c/b\u003e ·   Samurize \u003cb\u003e...\u003c/b\u003e"
			}
		]
I'd probably use a RegExp like this:

Code: Select all

[Variables]
Get=(?(?=.*\"GsearchResultClass\").*\"url\":\"([^\"]*)\".*\"titleNoFormatting\":\"([^\"]*)\")

[MeasureGoogleSearch]
Measure=Plugin
Plugin=WebParser
UpdateRate=-1
URL=http://ajax.googleapis.com/ajax/services/search/web?v=1.0&rsz=large&q=#SearchTerms#
RegExp=(?siU)#Get##Get##Get##Get##Get##Get##Get##Get#
This will match the URLs and titles of each result (in that order).
User avatar
ScoobSTi
Posts: 127
Joined: September 12th, 2012, 10:49 pm

Re: Web Browser?

Post by ScoobSTi »

Thanks! I'll try to get the rest of it working myself.

Hopefully... :o
Image