Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^4: Executing external programs

by Veltro (Friar)
on Feb 19, 2019 at 00:00 UTC ( #1230129=note: print w/replies, xml ) Need Help??

in reply to Re^3: Executing external programs
in thread Executing external programs

Also, you cannot expect that any program can be controlled. Some programs are made in such a manner that they can be controlled with OLE/COM and notepad is not one of them

There are some ways to program around that and there are many 'tools' around that are made for UI Automation.

Someone did however create a OLE module in Perl which would allow you to do something like this:

use strict ; use warnings ; use Win32::OLE ; use Time::HiRes qw( sleep ) ; my $ex = Win32::OLE->new('WScript.Shell') or die "oops\n"; $ex->run('Notepad') ; sleep(0.1) ; $ex->sendkeys("Hello World!") ;

Which is equivalent to the vbscript:

Set wshshell = wscript.CreateObject("WScript.Shell") "Notepad" wscript.sleep 100 wshshell.sendkeys "Hello World!"

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1230129]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2019-03-21 09:31 GMT
Find Nodes?
    Voting Booth?
    How do you Carpe diem?

    Results (108 votes). Check out past polls.