Wiki Home

Tiny URL

Namespace: WIN_COM_API
Very useful site that will convert one of those really long URLs into a very short URL that won't get word-wrapped in the e-mail. (Just in case you're wondering what this is all about.) As Carl points out below, the Tiny URL web site has instructions on how to automate the process of copying the new URL to your clipboard.
Not to nitpick too much and be contrary, as I have used it on ocassion, but:
- Even though they has been in existence for a while, what if they dissappear? That would break the links you posted elsewhere (e.g. NewsGroups)
- Even though I have not seen it happen, do we know how long do they keep the link in their database? It could break the links you posted elsewhere (see above).
- Even though tinyURL links arguably look better than some obscenely long URLs I've seen around, they look fishy to a skeptical mind. Say you receive a tinyURL in an email message. In these days of SPAM, malicious worms and virii, would you blindly click on it? How else could you tell it points to a safe place (even if sent to you by a friend)? -- Alex Feldstein
The site is actually much more useful. Their free services include: full editing capability, password-protection, and custom subdomains. Incredible stuff, and they're not even done with the site yet. It's going to be the new leader in url-shortening.
The idea is great, its implementation on both sites is very solid. It may happen that some big players, like Yahoo, Google or Microsoft, will pick it up soon.
The site is very useful. It's possible to get your own url Incredible stuff! Someone created a bookmarklet for shurl:
Handy site, wrote this prg so you can have a exe version of their toolbar addon. (not sure why you would want it, theirs is 'better' but I didn't 'get it' until after I wrote this.)

* mkTinyUrl.prg
* By CarlKarsten
* Takes a URL from the clipboard and runs it through, leaves the tinyurl on the clip.

Local ;
	loIE as InternetExplorer.Application

* for testing
* _cliptext = ""

* Create an instance of IE
loIE = loNewIE(.f.)

* go to the tinyrul page
lNav( loIE, "" )

* Stuff the textbox on the page with whatever text is on the clipboard (hope it is a url)
loie.Document.forms.item(0).url.value = _cliptext
* click the button
* wait for tinyrul server to do it's thing
lWait( loIE )

* page says:
* Note: For IE 4+ on Windows, the TinyURL is automatically copied to your clipboard and is ready for pasting.
* So I am not going to bother tryihng to scrape the result and put it on the clipboard - it should be there.

* destroy the instance of IE


Function loNewIE( llShowIE )

Local ;

loIE = Createobject("InternetExplorer.Application")
IF llShowIE
	loIE.visible = .t.

Function lNav( toIE, tcURL )


toIE.navigate( tcURL )
llRet = lWait( toIE )
IF !llRet
	MessageBox( "Timeout!", 10 )

Return llRet

Function lWait
Lparameters ;
	toIE as InternetExplorer.Application

Local ;
	ltStartTime, ;
	ltTimeOut, ;

ltStartTime = Datetime()
ltTimeOut = ltStartTime + 60

DO WHILE (Datetime() < ltTimeOut ) ;
	AND type( "toIE.document" ) <> "O"
*	? "#1 message()", Message()
DO WHILE (Datetime() < ltTimeOut ) ;
	AND toIE.busy
DO WHILE (Datetime() < ltTimeOut ) ;
	and type( "toie.document.readystate" ) <> "C"
*	? "#2 message()", Message()
DO WHILE (Datetime() < ltTimeOut ) ;
	and toie.document.readystate <> "complete"
*	? "#2 message()", Message()

* ?? " Done.", ltTimeOut - Datetime()
* ? toie.document.readystate

llRet = Datetime() < ltTimeOut
If !llREt
*	toIE.quit()


Contributors: Carl Karsten
Category Code Samples
( Topic last updated: 2005.06.21 06:46:28 PM )