Jump to content
Macro Express Forums

Handling URL strings with percent characters


Recommended Posts

Version: M/E pro 4.0.0.1

 

When working with an URL like:

 

http://data.un.org/Data.aspx?d=MDG&f=seriesRowID%3a563%3bcountryID%3a100%2c108%2c116%2c12%2c124%2c140%2c152%2c156%2c170%2c178%2c180%2c188%2c191%2c212%2c218%2c222%2c231%2c24%2c246%2c250%2c276%2c288%2c300%2c308%2c32%2c36%2c384%2c4%2c40%2c50%2c56%2c64%2c68%2c70%2c752%2c756%2c76%2c818%2c826%2c84%2c840%2c854&c=2,3,4&s=_countryEnglishNameOrderBy:asc,year:desc&v=1

 

M/E currently says that %3a563% isn't defined. I can't find anything about escaping percent characters in strings in the forums or help docs.

 

Any thoughts on the best way to store that in a variable and navigate to that page?

 

Cheers!

 

Adam

Link to comment
Share on other sites

This has been an issue in many guises going way back to the beta days. I've been out of touch for a bit but I think there were some recent changes and I see you're still on 4.0.0.1 so you might start by installing the latest version.

Link to comment
Share on other sites

One solution is to replace each percent sign in the URL with a variable:

<VARIABLE SET TO ASCII CHAR Value="37" Destination="%PCT%"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="http://data.un.org/Data.aspx?d=MDG&f=seriesRowID%3a563%3bcountryID%3a100%2c108%2c116%2c12%2c124%2c140%2c152%2c156%2c170%2c178%2c180%2c188%2c191%2c212%2c218%2c222%2c231%2c24%2c246%2c250%2c276%2c288%2c300%2c308%2c32%2c36%2c384%2c4%2c40%2c50%2c56%2c64%2c68%2c70%2c752%2c756%2c76%2c818%2c826%2c84%2c840%2c854&c=2,3,4&s=_countryEnglishNameOrderBy:asc,year:desc&v=1"/>
<VARIABLE MODIFY STRING Option="\x0F" Destination="%T[1]%" ToReplace="%" ReplaceWith="%PCT%" All="TRUE" IgnoreCase="FALSE"/>
<WEB SITE URL="%T[1]%" Wait="FALSE" Default_Browser="TRUE" _IGNORE="0x000C"/>

Link to comment
Share on other sites

Ha! Now that's a good idea Joe! I had tried temporary substitution with other characters but eventually MEP evaluated and caused a problem. I never considered replacing the percent signs with percent variables.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...