ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Find And Run Robot

URL encoding in aliases?

(1/2) > >>

Jesper Hertel:
I use my shortcut "g text" all the time to search for text in Google:

Regexp: ^g (.*)
Result: Google: $$1 |http://www.google.dk/search?q=$$1 /ICON=icons\google.ico

Well, now I wanted to search for "C# idioms", inspired by another thread here on DonationCoder. But no, that did not work: I got a search for C only, without any idioms - check http://www.google.dk/search?q=c#%20idioms. Apparently the q argument of the Google search is delimited by the # character.

Would there be any possibility to be able to URL encode the search string? Like a $$$1 instead of $$1 or something like that, or maybe a little more clever like $${urlencode($$1)} to allow for other functions in the future?

Like:

Google: $$1 |http://www.google.dk/search?q=$$$1 /ICON=icons\google.ico

or

Google: $$1 |http://www.google.dk/search?q=$${urlencode($$1)} /ICON=icons\google.ico

app103:
If you can create an alias to launch an application, with the command line parameter of the unencoded url, then you can use a small utility I made to handle stuff like that.

It accepts an unencoded url as the commandline parameter, converts & encodes it, then launches it in the default browser. (I also included the source)

http://cranialsoup.blogspot.com/2009/01/converting-and-encoding-url-containing.html

Oh, one more thing.... If the url has any spaces in it, don't convert them to %20. Just enclose the whole thing, with spaces, within quotes when you pass it as the command line parameter.

So your URL should be passed as "http://www.google.dk/search?q=c# idioms" and the utility will open this in the default browser: http://www.google.dk/search?q=c%23%20idioms

mouser:
jesper that is a very good idea, but i can do better and just automatically encode url strings; look for it in next release coming in the next few days.

Jesper Hertel:
It accepts an unencoded url as the commandline parameter, converts & encodes it, then launches it in the default browser. (I also included the source)
-app103 (February 20, 2009, 05:37 PM)
--- End quote ---
Thanks, app103! Good suggestion :Thmbsup:, I hadn't thought of going that way...

Now with mouser's nice promises of an automagic solution without me having to move a finger, I will wait for a few days to see if that simply solves my problem!  ;)

Jesper Hertel:
jesper that is a very good idea, but i can do better and just automatically encode url strings; look for it in next release coming in the next few days.
-mouser (February 20, 2009, 05:53 PM)
--- End quote ---
You really rock, mouser! I keep wondering if you really are a normal human being or if you are actually a team of 100 developers disguised as one person? ;)

Or maybe you are just one of those SDAs (Software Developing Angels) sent by God? :P



Navigation

[0] Message Index

[#] Next page

Go to full version