gpt4 book ai didi

ruby 在 windows shell 中注入(inject)击键

转载 作者:可可西里 更新时间:2023-11-01 14:25:23 24 4
gpt4 key购买 nike

在 ruby​​ 中有没有一种方法可以在 shell 中注入(inject)击键来运行程序?我需要通过 shell 运行一个程序

sh " #{another program}"

还有一个程序结束时“按任意键继续”。我怎样才能让它继续前进?

ruby有没有类似java的东西

http://alvinalexander.com/java/java-robot-class-example-mouse-keystroke

最佳答案

我认为你最好的选择是使用 Autoit,它可以像这样通过 COM 接口(interface)进行控制

require 'win32ole'
ai = WIN32OLE.new("AutoItX3.Control")
ai.WinWaitActive("Untitled - Notepad")
1.upto(10) do |i|
ai.Send "#{i}{ENTER}"
end

关于ruby 在 windows shell 中注入(inject)击键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13146056/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com