2013-04-26 16 views
0

我想自動完成一些工作,我通常做膩子,但我無法發送一些我需要發送鍵。我嘗試發送-並看到~出現。需要使用RAutomation.send_keys發送破折號字符內膩子

參考:

  • 紅寶石1.8.7(2010-12-23 PATCHLEVEL 330)[I386-的mingw32]
  • rautomation(0.9.1,0.6.3)

    require 'rautomation' 
    
    # Run PuTTY program 
    IO.popen("putty [email protected]") 
    
    window = RAutomation::Window.new(:title => /putty/i) 
    window.exist? 
    => true 
    
    window.send_keys("-") 
    => [45] 
    

更新: 我開始認爲這是與rautomation當我試着下面的,是能夠發送-的。

require 'wind32ole' 

    # Run PuTTY program 
    IO.popen("putty [email protected]") 

    @wsh = WIN32OLE.new('Wscript.Shell') 

    def test() 
     @wsh.AppActivate('PuTTY') 
     @wsh.SendKeys('Ruby{TAB}on{TAB}Windows/ hello -') 
    end 

    test 

UPDATE:我幾乎可以100%肯定它RAutomation,因爲我想一個-發送到Firefox /記事本+ +並沒有什麼表現,但能夠給我abcd

回答

0

支持這些密鑰已經被添加,但如果你從紅寶石寶石的代碼,它可能不會有它尚未作爲更新已完成2013年5月5日和最後RubyGems的更新是在4月份。 https://github.com/jarmo/RAutomation/issues/64

+1

從RAutomation 0.9.2開始,你也可以使用寶石。 – 2013-05-19 20:50:13

+0

感謝您的更新! – 2013-05-21 18:05:39