Page 1 of 1

Help Directory Watcher and eg.event.payload

Posted: Thu Aug 02, 2012 9:14 pm
by bskchaos
Need some help to automatically process files when added to a directory.

Example:

Directory Watcher will monitor the shared folder C:\dir\
When someone drop a file (testfile.ext) a program should be executed with the following command line options:

program.exe -i c:\dir\testfile.ext -o c:\dir\output\testfile.ext

Processed files will be stored at c:\dir\output

Re: Help Directory Watcher and eg.event.payload

Posted: Fri Aug 03, 2012 1:19 am
by bskchaos
Done, {eg.event.payload[0][16:]} did most of the trick.

Now users can drop a PDF file in a shared folder and get the decrypted version/log in the unlocked folder.

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1397">
    <Macro Name="Start Program: pdfdecrypt.exe" Expanded="True">
        <Event Name="DirectoryWatcher.Created" />
        <Action>
            EventGhost.ShowOSD(u'{eg.event.payload[0][16:]}', u'0;-24;0;0;0;700;0;0;0;1;0;0;2;32;Arial', (255, 255, 255), (0, 0, 0), 4, (0, 0), 0, 3.0, False)
        </Action>
        <Action Enabled="False">
            EventGhost.Wait(5.0)
        </Action>
        <Action Enabled="False">
            System.Execute(u'C:\\pdfdecrypt\\pdfdecrypt.exe', u'-i "{eg.event.payload[0]}" -o "d:\\pdf_unlocker\\unlocked\\unlocked_{eg.event.payload[0][16:]}" -l "d:\\pdf_unlocker\\unlocked\\{eg.event.payload[0][16:-4]}.log"', 0, True, 2, u'C:\\pdfdecrypt')
        </Action>
    </Macro>
</EventGhost>