I am using Ruby on a mac to open a dozen URLs one at a time with Nokogiri etc.
For each URL I need to let my ruby program know whether to keep the URL window for further inspection or close it.
But I cannot see the terminal window and its prompt, it is hidden behind the last URL window.
I have to click on the terminal window in order to bring it to the front, in order to enter my decision on the keyboard.
puts "close webpage?"
if gets =~ /^y/i then 1 ; else; 0; end;
I would like the terminal window to come to the front before it prompts me for an answer.
I think the question is two fold
- Is there a terminal command that tells a terminal window to become the active one (the one in the front) that would work with mac iTerm.
The Apple script "bringiTermtofront" works in the applescript editor.
tell application "iTerm" to activate
Is there a way to execute a terminal command from ruby. the ruby code
system "osascript bringiTermtofront.scpt"
brings the iTerm to the front.