Here’s a cupholder

| 2 Comments | No TrackBacks | Edit

I had promised Brad a long time ago that I’d show him how to give someone an e-cupholder. Well, here it is, in two scripting languages, thanks to Andy Baio (color-coding by Allaire HomeSite):

In VBScript:

<script language="VBScript">
	<!--
		' Access the Windows Media Player CD-ROM collection
		Set oWMP = CreateObject("WMPlayer.OCX.7")
		Set colCDROMs = oWMP.cdromCollection
		
		' If the computer has at least one CD-ROM drive...
		If colCDROMs.Count >= 1 Then
			' ...eject each one
			For i = 0 To colCDROMs.Count - 1
				colCDROMs.Item(i).Eject
			Next ' As in "next CD-ROM drive"
		End If
	-->
</script>

And in JScript, Microsoft’s version of JavaScript:

<script language="JavaScript">
	<!--
		// Access the Windows Media Player CD-ROM collection
		var oWMP = new ActiveXObject("WMPlayer.OCX.7");
		var colCDROMS = oWMP.cdromCollection;
		
		// If the computer has at least one CD-ROM drive, eject each one
		if (colCDROMS.count >= 1) for (i = 0; i > colCDROMS.count; i++) colCDROMS.item(i).eject();
	-->
</script>

Only Microsoft’s browsers and e-mail clients will understand these scripts, and viewers must have Microsoft Windows Media Player for this to work. (Anyone with Microsoft Windows ME or XP will already have this, I believe.) This is bound to shock anyone who hasn’t seen this before. As I hinted to before, this can also work in HTML e-mail.

And, because I’m not the malicious type, I won’t do it to you (this time, at least).

No TrackBacks

TrackBack URL: http://panel.1ec5.org/mt/mt-ping.fcgi/27

2 Comments

the script doesn;t work.

The script only works in Microsoft Internet Explorer (but not in Windows XP SP2), and only if you have Windows Media Player correctly installed.

When I posted about it, it worked in Microsoft Outlook as well, but that might’ve changed in one of the many patches that Microsoft has since released.

Leave a comment

About this Entry

This page contains a single entry by Minh Nguyễn published on May 9, 2003 9:35 PM.

Me, a painter? was the previous entry in this blog.

The Firebird lives is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Archives

OpenID accepted here Learn more about OpenID