'Encode the URL. This may have logical errors in it. This is a rather quick and dirty encode routine.If Len(inputURL) > 0 Then' Loop through each character in the URL and encode iti = 1DoWhile i <= Len(inputURL) c = Mid(inputURL, i, 1)If c = "%"Then'If we find an encoded character, keep it encodedURL = encodedURL & c & mid(inputURL, i+1,1) & mid(inputURL, i+2,1) i = i + 2ElseIf InStr(VALID_CHAR_SET, c) = 0 Then'If current character is not in the valid character set ' convert current character to HEX c = Hex(Asc(c))

Very nice. I was waiting for someone to write a URL shortener action. Since dealing with URLs will be common within actions, a future version will have some built-in helper functions so you won't have to write your own encode routines in each action.

No problem. I was really trying to illustrate that you can make Web API calls and manipulate the clipboard with the returned values. I hope this is an adequate example to show that concept. Web APIs could really extend the functionality of what you do. How many different Google APIs could you call to perform some action? Yahoo! has its APIs. The social media sites have APIs. The possibilities could be endless.

Here is an updated version of the Bitly Action that Austin created that utilizes the new UrlEncode functionality in 3D Clipboard 1.5. It also checks the response status code to determine if the request was successful. Enjoy!

// Were we successful?if(objHttp.status==200){// Place short URL on clipboard Clipboard.Value= objHttp.responseText;}else{// There was an error. Display a message to the user.new ActiveXObject("WScript.Shell").Popup("An error was returned from "+ BITLY_HOSTNAME +":\r\n\r\n"+"Status: "+ objHttp.status+"\r\n"+"Response Text: "+ objHttp.responseText,30,"Error",48);}