如何在使用ruby的windows中关注窗口

如何在使用ruby的windows中关注窗口,ruby,Ruby,如何在ruby中关注窗口?这是我的代码: require 'win32ole' win = WIN32OLE.new("WScript.Shell") win.run("notepad.exe") win.SendKeys("This is automatic") 我想在SendKeys之前关注“notepad.exe”窗口Try-win.AppActivate(“记事本”),我发现代码是正确的,但需要将其放在以下路径中:AppActivate(“win”)Try-win.AppActiva

如何在ruby中关注窗口?这是我的代码:

require 'win32ole'

win = WIN32OLE.new("WScript.Shell")
win.run("notepad.exe")
win.SendKeys("This is automatic")

我想在SendKeys之前关注“notepad.exe”窗口

Try-win.AppActivate(“记事本”),我发现代码是正确的,但需要将其放在以下路径中:AppActivate(“win”)Try-win.AppActivate(“记事本”),在SendKeys之前我发现代码是正确的,但需要将其放在以下路径中:AppActivate(“win”)