It is currently May 1st, 2024, 10:27 am

Substitution with InputText.dll

Get help with creating, editing & fixing problems with skins
BlockJuice
Posts: 9
Joined: September 1st, 2012, 10:44 pm

Substitution with InputText.dll

Post by BlockJuice »

If I try to search for "3+5" in Google with a rainmeter skin, I'll get results for "3 5" instead. I could easily fix that by substituting it with "%2B" (according to this list), but tacking a Substitute option on the end of the measure doesn't really work as well as it should.

So is it possible to do what I'm trying to do here? If not, is there any other way to fix the problem that I'm having (other than by just typing "3 plus 5" and ignoring it)?
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Substitution with InputText.dll

Post by Kaelri »

Frankly, the easiest way to do this would be to set the input as a variable, then use a Lua script to substitute the "+" sign and send the actual search command. For example, you can use an InputText command like this:

Code: Select all

Command1=[!SetVariable "SearchInput" "$UserInput$"][!CommandMeasure "SearchScript" "Search()"]
Then make a new script measure:

Code: Select all

[SearchScript]
Measure=Script
ScriptFile=Search.lua
And the script:

Code: Select all

function Search()
	local SearchInput = SKIN:GetVariable('SearchInput')
	SearchInput = SearchInput:gsub('+', '%%2B')
	SKIN:Bang('"http://www.google.com/search?q='..SearchInput..'"')
end
BlockJuice
Posts: 9
Joined: September 1st, 2012, 10:44 pm

Re: Substitution with InputText.dll

Post by BlockJuice »

Kaelri wrote:-stuff-
Whoa, that worked perfectly! Thanks!