Thursday, July 14, 2011

Creating Windows Pop ups

Sometimes it's the simple things that make you go in circles. Sometimes you need a dang pop up!

Took a bit of searching but I finally found this page after looking for how to do the equivalent of "wscript.echo".

http://tinyurl.com/6zk9pvs

Quick code dive

require 'win32ole'

wsh = WIN32OLE.new("wscript.shell")
wsh.popup("Hello World!")

That's pretty much it to emulate wscript.echo.

We want POWER!

Our wsh.popup method gives us 4 fields to customize.

wsh.popup({message in the body},{time for window to stay open before} ,{title of the window},{window type} + {type of icon})

Link to summary of window/button types: http://ss64.com/vb/popup.html

#script to tell us if our burrito's are done. Please don't use this code. It's for your own good.


require 'win32ole'

wsh = WIN32OLE.new("wscript.shell")

if Burrito.instance.burning? #singleton Burritos, the best!
wsh.popup("YOUR BURRITOS ARE ON FIRE!",0,"DANGER HUNGRY MAN!", 0 + 48) 

Consider yourself informed. Now go turn off your microwave! 

No comments:

Post a Comment