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

Help: Rainmeter Skins • Re: How to add Url Encoding to $UserInput$

$
0
0
I have this section of code in my rainmeter script:

Code:

Command1=!Execute ["http://www.google.com/search?q=$UserInput$"] DefaultValue=""
I want to change this script so that the $UserInput$ area adds url encoding to it. That way, if I type something like # into the search box, instead of going to http://www.google.com/search?q=# and redirecting me to http://www.google.com/webp, it goes to http://www.google.com/search?q=%23

Code:

[Rainmeter]Update=1000AccurateText=1[MeterSearchBox]Meter=ShapeShape=Rectangle 1,1,202,25 | Fill Color 215,215,215,255 | Stroke Color 130,130,130,255W=202H=25LeftMouseUpAction=[!CommandMeasure "MeasureSearchInput" "ExecuteBatch 1-2"][MeasureSearchInput]Measure=PluginPlugin=InputTextX=3Y=2W=200H=22SolidColor=200,200,200,255FontColor=47,47,47,255FontSize=11AntiAlias=1FocusDismiss=1DynamicVariables=1Command1=$UserInput$Command2=["https://www.google.com/search?q=[MeasureSearchInput:EncodeURL]"]
So you are getting the user input in Command1, and using the value you just got - in Command2

https://docs.rainmeter.net/manual/variables/section-variables/#EncodeURL


1.jpg

Notes:
Do not use !Execute it was deprecated years ago.
I highly recommend against using http://. Use https:// Unless you want every hacker out there to see your searches for Naked Midget Wrestling.


GoogleIt.rmskin

Statistics: Posted by jsmorley — Today, 3:45 am



Viewing all articles
Browse latest Browse all 1418

Trending Articles