Can I write text to a notepad and save the file through ruby

A

Anukul Singhal

Hi,

After invoking notepad through ruby, I wanted to know if I could type
some text in that notepad (which was just invoked using `notepad`) and
save it using a ruby code.

Can anyone please help me with the ruby code in this regard?

Thanks,
Anukul
 
J

James Britt

Anukul said:
Hi,

After invoking notepad through ruby, I wanted to know if I could type
some text in that notepad (which was just invoked using `notepad`) and
save it using a ruby code.

Can anyone please help me with the ruby code in this regard?

Look into a free tool called AutoItX. It is a COM and DLL thing that
you can script to drive Win32 applications.

You can use Ruby's Win32OLE lib to load the COM object, then control it
using Ruby code instead of the AutoIt scripting language.



--
James Britt

"In physics the truth is rarely perfectly clear, and that is certainly
universally the case in human affairs. Hence, what is not surrounded by
uncertainty cannot be the truth."
- R. Feynman
 
D

Drew Olson

Anukul said:
Hi,

After invoking notepad through ruby, I wanted to know if I could type
some text in that notepad (which was just invoked using `notepad`) and
save it using a ruby code.

Can anyone please help me with the ruby code in this regard?

Thanks,
Anukul

Do you really need to invoke notepad? Why not just write the text to the
file directly?

File.open('foo.txt','w') do |out|
out << 'some text to write to the file, blah blah blah'
end
 

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

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,246
Members
46,840
Latest member
BrendanG78

Latest Threads

Top