in reply to automation on windows

Personally, I would just use Perl and write a small Perl program that monitors the SMB share for new files:

#!perl -w use strict; require Win32::ChangeNotify; my($dir)= @ARGV; while(1) { $notify = Win32::ChangeNotify->new($dir,0,'FILE_NAME'); $notify->wait or warn "Something failed: $! / $^E\n"; sleep 10; # give the process writing the file some time for my $pdf (glob "$dir/*.pdf" ) { ; # we process all files here, +because I'm lazy system(1, qq{"C:\\Program Files (x86)\\Adobe\\Reader 10.0\\Rea +der\\AcroRd32.exe" /t $pdf}); }; $notify->reset(); }

Replies are listed 'Best First'.
Re^2: automation on windows
by morgon (Priest) on Nov 01, 2014 at 22:38 UTC
    Cool, thanks for pointing out "/t".

    But assuming I do not want this script to run all the time, how would I start it from the host? Would I install an ssh-server on the XP-machine and use that to start it or is there a better way on windows?

    And how would I automate things that I cannot handle with a command-line switch?

    I mean what are the proper tools on Windows when you have to synthesize keyboard or mouse-events? On X I can use e.g. xdotool but I have no idea what to use on Windows - autoit maybe?

      If you want to send keystrokes or mouse events, you want to use Win32::GuiTest.

      This usually conflicts with processes started through a service though, becuase Windows permissions disallow sending events from processes started through a service to the desktop (or so I think).

      If you want to launch a process from the outside, either have an SSH daemon running on the target machine or use WMI (if you are Administrator in your domain) or write a small HTTP server that then launches the target process.

      If you want a quick solution, I'd advise to use the perl script in Corion's first post and autoit for the other stuff. You save yourself the hassle of compiling the package. In autoit you'd have to write just a small script that when acroread windows pop up prints the contents and then closes the acreoreads. A few lines, simple like BASIC. If time is a concern I'd really suggest that heretic, quick and dirty solution..."