They say you learn something new every day.

Posts tagged ‘hta’

Copying Text to the Clipboard (05/03/2012)

This is quite a nifty little bit of VBScript for adding something to the user’s clipboard.

strCopy = “This text has been copied to the clipboard.”

Set objIE = CreateObject(“InternetExplorer.Application”)
objIE.document.parentwindow.clipboardData.SetData “text”, strCopy

Have to admit, I’m beginning to go off VB Script. Obviously, it’s incredibly useful, since it works on every Windows machine, and lets you do things like make HTAs, scripts etc.

But, it’s less useful when you move onto the web, because you have to use javascript if you want any hope of it working on people’s computer. But then, with javascript, you can’t access local resources (so you can’t connect to databases) or do things like this cool clipboard copy trick.

Basically, there are some cool things that VBS can do. And you can do them in HTAs or scripts, but as soon as you go online, you need to either have a downloadable HTA, or use a mixture of javascript and a server side language.

Tag Cloud