here is my code that fails in 1.9…it used to show a popup under
windows
require ‘win32ole’
class Testnet
def self.popup(msg)
wsh = WIN32OLE.new(‘WScript.Shell’)
wsh.popup(msg, 0, “TESTNET POPUP”)
end
end
here is my code that fails in 1.9…it used to show a popup under
windows
require ‘win32ole’
class Testnet
def self.popup(msg)
wsh = WIN32OLE.new(‘WScript.Shell’)
wsh.popup(msg, 0, “TESTNET POPUP”)
end
end
I should add windows is windows XP, sp3
Joe
Works for me.
I’m running 1.9.2p180 on Windows XP sp3.
What error are you getting?
Worked when I changed:
def self.popup(msg)
To:
def popup(msg)
Worked for me in the first way.
perhaps the local var wsh is going out of scope when the method ends ??
perhaps:
require ‘win32ole’
class Testnet
def initialize()
@wsh = WIN32OLE.new(‘WScript.Shell’)
end
def popup(msg)
@wsh.popup(msg, 0, “TESTNET POPUP”)
end
end # class
tn = Testnet.new()
tn.popup(“This is a test message.”)
Also, sometimes if the text message passed to Windows API UI functions,
does not resolve to a valid string, they can fail silently.
You could add some validation code to the popup() method, before calling
the WSH popup function.
?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs