'use strict';
' CaptaJaus tray — node directo, delay corto.
Dim sh, fso, wmi, procs, count, node, dir, cmd
Set sh = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set wmi = GetObject("winmgmts:\\.\root\cimv2")
Set procs = wmi.ExecQuery("SELECT ProcessId FROM Win32_Process WHERE Name='node.exe' AND CommandLine LIKE '%captajaus_tray.js%'")
count = 0
For Each p In procs : count = count + 1 : Next
If count > 0 Then WScript.Quit 0

WScript.Sleep 4000

node = "C:\Program Files\nodejs\node.exe"
If Not fso.FileExists(node) Then WScript.Quit 1
dir = "C:\xampp\htdocs\captajaus\pm2-tray"
sh.CurrentDirectory = dir
cmd = """" & node & """ captajaus_tray.js"
sh.Run cmd, 0, False
