Page 1 of 1

run dos bat file or cmd line (os shell) from auggie script

Posted: Sun Sep 22, 2019 3:28 pm
by Richard Cullin
i have been playing around reprogramming sonoff  wifi switches to operate at my beck and call. it occurred to me that it would be a nice way to control
pumps, compressors exhaust fans  etc from auggie without the need for any physical connection.
i can use the command line utility wget.exe
{wget "http://10.0.0.131/st?sw=4" } to send a command to the sonoff

can auggie script run an os shell ?



Re: run dos bat file or cmd line (os shell) from auggie script

Posted: Sun Sep 22, 2019 6:52 pm
by Richard Cullin
tried Exec, Execute , got nothing except the print message

Code: Select all

 
global	AirButton = function()
{
 
 
print("airblow toggle"); 
Exec("c:\ctwin\s5.bat");
    yield();
 
return;
};
 

Re: run dos bat file or cmd line (os shell) from auggie script

Posted: Mon Sep 23, 2019 1:52 am
by Ya-Nvr-No
found some examples:
system.Exec(path+file);
system.Exec("Notepad " + path + file);

try this:
system.Exec("c:\ctwin\s5.bat");

Re: run dos bat file or cmd line (os shell) from auggie script

Posted: Mon Sep 23, 2019 2:17 am
by ArtF
YaNvrNo:

  Good thing you remembered that, I knew there was something we added but couldnt
quite remember what.. :)

Art

Re: run dos bat file or cmd line (os shell) from auggie script

Posted: Mon Sep 23, 2019 4:03 am
by Richard Cullin
system.Exec("Notepad "

notepad works ok. but not my wget.exe ,  i will try locating it in the "PATH"
in the morning , its late here pumpkins everywhere

Re: run dos bat file or cmd line (os shell) from auggie script

Posted: Mon Sep 23, 2019 10:35 am
by Richard Cullin

thanks , works perfectly when executable is in the system PATH

I can now send this json udp packet to my sonoff switch and turn the exhaust duct fan on/off for the laser fume extractor
from the auggie console 

Code: Select all

 global	AirButton = function()
{ 
print("airblow toggle"); 
system.Exec("sfk udpsend sonoff5:9889 {\"switch\":2}" );
    yield(); 
return;
};