Loading a URL with % in it

Get help with using AutoHotkey and its commands and hotkeys
msalapow
Posts: 1
Joined: 29 Mar 2017, 11:06

Loading a URL with % in it

Post by msalapow » 29 Mar 2017, 11:12

Hey all,

Very new to AHK... sorry for such a basic question but I cant find an answer anywhere. I am trying to load a URL that has % in it.

Code: Select all

run, C:\Program Files\Internet Explorer\iexplore http://www.microsoft.com/examplewith%in%it
Is there any way to make this work?
User avatar
Nextron
Posts: 1217
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 AHK: Unicode x32

Re: Loading a URL with % in it

Post by Nextron » 29 Mar 2017, 12:58

Your question threw me off a little, figuring the URL was causing problems due to percentage encoding (if you're sending an URL to a server directly you would replace % with %25, but in this case your browser takes care of that).

But it must actually be AHK that expects a variable name to be in between the percentages. If you want those to be literal, precede them with backticks: `:

Code: Select all

run, C:\Program Files\Internet Explorer\iexplore http://www.microsoft.com/examplewith`%in`%it
garry
Posts: 1453
Joined: 22 Dec 2013, 12:50

Re: Loading a URL with % in it

Post by garry » 29 Mar 2017, 15:22

or this example ( start with default browser )
( some short movies here )

Code: Select all

aa:="http://www.cheeseheadhosting.us/downloads/golden%20age%20of%20television%20vault%201/1955%20alfred%20hitchcock%20presents/"
run,%aa%
User avatar
AlleyArtwork
Posts: 30
Joined: 09 Jun 2015, 21:08

Re: Loading a URL with % in it

Post by AlleyArtwork » 30 Mar 2017, 20:29

Use a String Replace to convert a copied URL with % in them, into an AHK readable URL:

Code: Select all

StringReplace, clipboard, clipboard, `%,```%,all
This would turn the above example's URL: http://www.microsoft.com/examplewith%in%it
into this: http://www.microsoft.com/examplewith`%in`%it
loop {
MsgBox, Life is like an Infinite Message Box of chocolates.`nThere are %a_index% chocolates in this box.
}
Post Reply

Return to “Ask For Help”