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.

Directory Watcher help

If you have a question or need help, this is the place to be.
Post Reply
thereddestdog
Posts: 2
Joined: Tue Feb 22, 2011 6:12 pm

Directory Watcher help

Post by thereddestdog »

I am pretty new to EG, and a basic user of it at best. I am simply trying to trigger a program when a new file is created

Just one macro:
-DirectoryWatcher.Created
-Launch: theRenamer.exe -fetch
-Wait 30s: Update XBMC Library

The problem is, if 10 new files are created in the directory, EG will launch the program 10 times. The program being triggered is theRenamer. If the program does not like being open multiple times. If a batch of files are created in the watch directory every few minutes, the program no longer works as supposed to. I've opened task manager a few times to see abour 200 instances of therenamer.exe

I need a way for EG to allow only one instance of therenamer.exe. Can this be done?
User avatar
zian
Site Admin
Posts: 569
Joined: Wed Jun 24, 2009 3:54 pm

Re: Directory Watcher help

Post by zian »

I'm just guessing here but I would think that therenamer.exe would have some settings you can configure to have it run on it's own (no EG directory watcher needed) or a way to exit itself when it's finished.

Have you looked into that?
Sorry I can't be of more help.
eventghost.net
Be there or be square.
thereddestdog
Posts: 2
Joined: Tue Feb 22, 2011 6:12 pm

Re: Directory Watcher help

Post by thereddestdog »

zian wrote:I'm just guessing here but I would think that therenamer.exe would have some settings you can configure to have it run on it's own (no EG directory watcher needed) or a way to exit itself when it's finished.

Have you looked into that?
Sorry I can't be of more help.
Neither are options.

I need a way to only allow one instance of the program
eatmeimadanish
Experienced User
Posts: 118
Joined: Thu Oct 01, 2009 5:11 pm

Re: Directory Watcher help

Post by eatmeimadanish »

Well lets think through this. A file drops in and you run therenamer.exe as soon as directory watcher detects a new file. You do not want therenamer.exe to open more than once.

If theRenamer.exe closes once its complete, I would have part of the macro event conditional on if it finds the process theRenamer.exe, if it does than wait 30 seconds and try again. If it does not than it can move to the next task.

If theRenamer.exe does NOT close once its complete, then you need to have part of the task kill this process after some sort of indicator or length of time.

I am not sure how EventGhost will handle queing since each new file will create a new event in Eventghost. My suggestion is that you trap these events and build something like an XML or CSV file with this data, then have some python code or javascript parse this seperatly and work through it one line at a time.
User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: Directory Watcher help

Post by jitterjames »

I think we need more information about how "therenamer.exe" works. Would the ideal be to run it only once, after all 10 files have been created?
KeKs0r
Posts: 4
Joined: Thu Mar 31, 2011 6:06 pm

Re: Directory Watcher help

Post by KeKs0r »

Hi,

im having the same problem and posted an theoretical idea on this problem in this thread:
viewtopic.php?f=2&t=3149

My Idea was that you have something like a counter, and everytime the UPdated event occurs the counter is set back to e.g. 30 seconds. And after the countdown you start therenamer. In that way, the process "waits" until all files are copied and then therenamer fetches all files and has to be executed only once.
bixtool
Posts: 3
Joined: Mon Aug 15, 2011 9:19 pm

Re: Directory Watcher help

Post by bixtool »

Hi,
try a conditional statement where theRenamer should only be executed if a video file is found by DirectoryWatcher: .mp4, .avi, .mkv etc
All other files found should be ignored.

If VideoFileFound:
run the renamer
Else:
pass
Post Reply