retrieve text from popup

I am using the following code to click on a popup, and would like to be able to retrieve the text which is displayed in the popup. Does anyone have any suggestions as to how to do this?

def startClicker(ie, button , waitTime = 4)    w =    longName = ie.dir.gsub("/" , "\\" )    shortName = w.getShortFileName(longName)    c = "start ruby #{shortName }\\clickJSDialog.rb #{button } #{ waitTime} "    puts "Starting #{c}"    w.winsystem(c)    w=nil end