Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Help Directory Watcher and eg.event.payload

Questions and comments specific to a particular plugin should go here.
Post Reply
bskchaos
Experienced User
Posts: 56
Joined: Tue Mar 25, 2008 3:04 pm

Help Directory Watcher and eg.event.payload

Post 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
bskchaos
Experienced User
Posts: 56
Joined: Tue Mar 25, 2008 3:04 pm

Re: Help Directory Watcher and eg.event.payload

Post 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>
Post Reply