Hi! I'm new to Node-RED and transitioning from EventGhost. I'm trying to rebuild some scripts I had in EventGhost in Node-RED, but I can't figure out a way to listen for windows events. I searched the forum, but couldn't find anything about windows events. EventGhost had native support for listening to events, but it doesn't look like Node-RED does. Could anyone point me in a direction to look into or have any solutions? Not sure if it helps at all, but I can code in Python.
Or you could try adding windows-event-reader - npm to the setup tab on a function node & see if that works. (see this article for using modules in a function node)
Depending on how instantaneous you need this will likely determine your path.
I would like it to react in less than 5 seconds, but the faster the better.
I was just thinking of something similar but with Python since that's what I'm familiar with. I started working on a solution that used Windows Task Scheduler, but couldn't figure out how to get the data from Python to Node-RED. Do you have any recommendations on on how to go about using MQTT/HTTP/other? I'm not familiar with anything.
I'll look into everything as well and see what I can do.
I usually recommend that you learn Node/JavaScript (you obviously have programming ability, so why not expand that?)
If 5 secs is ok then I see no real hardship in simply running a powershell every 5 secs and checking for new events.
however, if you want to do this in python, then MQTT is probably the way to go. Your python app would run contineoulsy (a deamon) and would send events, as they occur to node-red using MQTT (that would be my first choice).
I'm always up for learning new things, so i'll get into those eventually. Just trying to get things running for now. I'll have to tinker from here to see what I can do and how everything works.
Thanks for the help and the info. You given me a direction to research into. I'm currently looking into windows-event-reader and it looks like its working in the function node, i just don't know how to use it or the function node lol, so i'm going to keep digging into that and see if I can figure it out.
For the event log you can select via filters at what should be triggered. On a hit, a Powershell script is then triggered, which copies the path of the file to the clipboard and sends it to an mqtt topic for further processing.
Nice to see you here Logan!
You are in the right place, so many helpful and skilled people aroud here, I'm sure you will reach your targets. Myself, I have so many re-used Python scripts from the good old EventGhost days, using MQTT to communicate with Node-RED. If you need some ideas, just reach out
Here is a typical setup I use in all my Node-RED instances. I let Node-RED start and monitor the running of my scripts. I really want to be sure they are working as expected. If they should fail, I let Node-RED restart them (and inform me about it via Telegram). In all scripts I therefore have a heartbeat feature, expecting the scripts to respond within a certain time. Might look a bit complex but is really straight forward