Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 08, 2016, 09:50:56 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: URL encoding in aliases?  (Read 2939 times)

Jesper Hertel

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 102
    • View Profile
    • Donate to Member
URL encoding in aliases?
« on: February 20, 2009, 05:31:11 PM »
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

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,666
    • View Profile
    • App's Apps
    • Read more about this member.
    • Donate to Member
Re: URL encoding in aliases?
« Reply #1 on: February 20, 2009, 05:37:05 PM »
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.b...-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...arch?q=c%23%20idioms

« Last Edit: February 20, 2009, 05:47:26 PM by app103 »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,421
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: URL encoding in aliases?
« Reply #2 on: February 20, 2009, 05:53:08 PM »
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

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 102
    • View Profile
    • Donate to Member
Re: URL encoding in aliases?
« Reply #3 on: February 20, 2009, 07:12:48 PM »
It accepts an unencoded url as the commandline parameter, converts & encodes it, then launches it in the default browser. (I also included the source)
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

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 102
    • View Profile
    • Donate to Member
Re: URL encoding in aliases?
« Reply #4 on: February 20, 2009, 07:22:32 PM »
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.
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




mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,421
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: URL encoding in aliases?
« Reply #5 on: February 20, 2009, 09:47:20 PM »
i improved the automatic handling, but had to go ahead and add the ability to use $$u1,$$u2, $$uc, etc. to explicitly request that an arguement be url encoded, so that an alias could mix and match.  will be in next release.