Is there a way in ruby, can I enter a keystroke in the shell so that the program starts? I need to run a program in a shell through
sh " #{another program}"
And there is "Press any key to continue" at the end of the program. How can I make him move on?
Is there something similar in ruby ββlike java
http://alvinalexander.com/java/java-robot-class-example-mouse-keystroke
I think your best bet is with Autoit, it can be controlled via a COM interface like this
require 'win32ole' ai = WIN32OLE.new("AutoItX3.Control") ai.WinWaitActive("Untitled - Notepad") 1.upto(10) do |i| ai.Send "#{i}{ENTER}" end
You can use Open3.popen2 to start the process and get the descriptors for stdout and stdin, and then you can "press the key" by running stdin.puts "Y" .
stdin.puts "Y"
Source: https://habr.com/ru/post/1443074/More articles:Schema.org product tags incomplete - schema.orgExt JS 4: Override the format of data sent to the server - javascriptHow to remove \ n characters from a file? - c #https://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1443072/mysql-what-happens-to-an-index-if-i-alter-the-column-its-on&usg=ALkJrhjjm_HbSj_aPBkg79zw0ooVNzROkQThe best way to initialize a class variable is initializationGit: unable to redirect / parse git fetch --dry-run 'command output - gitWhat is its return value of openAccessory? - javaSlow memcache performance on Google App Engine - google-app-engineOrder in Django Admin based on a custom callable in a display list - djangoHow to refactor a complex method in a Rails model using Rspec? - ruby ββ| fooobar.comAll Articles