Setting Focus on Console Window

H

Hayato Iriumi

Hello,
I'm having an issue with having a focus on the Ruby invoked console
window on Windows platform when I start the process from one of the
Scheduled Tasks.

I have a Ruby script that gets kicked off by Scheduled Task. So the
Run command looks like this: C:\ruby\bin\ruby.exe D:\Temp\HelloRuby.rb

Now when I right click on the scheduled task and choose Run, the
console window doesn't have the focus. I looked for ways to set the
focus on the console window using kernel32 and stuff, but I haven't
been able to find a solution.

Does anyone know how best I can solve this problem?

TIA
 
R

Rodrigo Bermejo

require 'win32ole'
wsh = WIN32OLE.new('WScript.Shell')
wsh.AppActivate("name of the window")

I am not sure I understood your question 100% , but if I am ok with 50%
It may help you.

-ronnie.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top