Hot Folder/Monitor Folder Question?

Posted By: RealSerious3D

Hot Folder/Monitor Folder Question? - 12/29/14 03:22

Hello all. I am curious if this is possible in C-Script:

Can a program be written to monitor a folder for new files and then apply an action to the new file?

For example, I want a small program to watch a particular folder and when a JPG is placed in the folder, the program would send it off to a printer to be printed.

There is more to this, but this is a start. Can it be done?

Easy on me, please, I am an artist and know very little about C-Script.
Posted By: WretchedSid

Re: Hot Folder/Monitor Folder Question? - 12/31/14 23:25

I'll be debby downer for a bit... C-Script, or Gamestudio in general, really, is the wrong tool for this job. You don't want an engine initialized just for what is essentially a daemon process that just watches a folder.

Now... Can you watch a folder? Most certainly yes! Either way it'll boil down to real C/C++, wether with gamestudio or in a more appropriate environment. The only difference is that gamestudio would need a DLL whereas you could just write a program in C/C++ that does this and you lose a lot of the overhead you would otherwise have. Here is the appropriate MSDN documentation for what you want to do.

Printing... Well, printing is a lot of pain. Printers are a lot of pain. You can get something very simple with ShellExecute, but ideally you'd have to dig down into the printer spooler API, which is going to be a lot of not so much fun hours.
Posted By: RealSerious3D

Re: Hot Folder/Monitor Folder Question? - 01/01/15 09:38

Yep, I absolutely know it's the wrong tool for the job. No doubt about it. It's a game engine, after all. Even so, I was curious for my own reasons. laugh

Ah, then if GameStudio needs a DLL to do this (i.e it could not be programmed in C-Script alone), then that answers my question. The answer is NO. laugh

Printing is not really an issue for what I was thinking about. As long as the printers are using their proper color profiles, are tweaked for what I want done, and are already set to default for the size of print, etc., then at this point it is simply sending the image to the printer.

Thanks for your response, though, WretchedSid. I do appreciate it.
© 2024 lite-C Forums