Ruby bring window to foreground
I am using Ruby 1.9.1p430 (2010-08-16 revision 28998) on MS Ws7 with MS Office 2010
I have launched a copy of Word from Ruby using WIN32OLE:
wd = WIN32OLE.new('Word.Application')
All works fine, I can manipulate my d开发者_Python百科ocument as required.
However, the Word window is in the background and I would like to bring it to the foreground so that the user sees the window and can interact with it as necessary.
I have done some reading but cannot find a way to do this using Ruby.
Any help or pointers in the right direction greatly appreciated.
You are using wd.visible = true And it is still in the background?
Good luck :-)
Unfortunately, that sort of thing is both os specific, and not in the standard libs, so it is going to be tough. First thing is dig through the WIN32OLE docs a bit http://ruby-doc.org/stdlib/libdoc/win32ole/rdoc/index.html, but I don't think it will be there.
after that, I would poke around github a bit (although I wouldn't hold out too much hope).
After that, I would look at http://www.autoitscript.com/autoit3/index.shtml (or something like it), and see if I could use that or integrate with it somehow.
finally, I would look at how http://win32utils.rubyforge.org/ handles api wrapping, figure out the win32 api call you need, and then write a c extension wrapper for it.
精彩评论