View Single Post
  #6  
Old 10.12.2019, 14:10
noone1
Guest
 
Posts: n/a
Default

Thank You!!

- in 2nd ex, asyncStdOut doesn't exist outside callAsync scope, which indeed is the problem. And thank you for the idea, your workaround, while it is still a workarroud, is way more simple!

Code:
//----------------------------------------------------------------------------------------------------------------
    //var async;
    //callAsync(function(e,s,r){coutput(e,s,r,"path");async=s;},"cmd","/c",'@echo off & echo.%userprofile%"');
    //while (!async) sleep(1);
    //alert('show must go on'+async);
    //or
    var easync,sasync,rasync;
    callAsync(function(e,s,r){easync=e;sasync=s;rasync=r;},"cmd","/c",'@echo off & echo.%userprofile%"');
    while (!sasync) sleep(1);
    coutput(easync,sasync,rasync,"path");
//----------------------------------------------------------------------------------------------------------------
- as per your first solution, I guess it resolves my problem, too! I didn't think to get a sdtOut out of callSync! so since it exists, it's even more simple!

Code:
//----------------------------------------------------------------------------------------------------------------
    var syncOut, syncStdOut
    syncOut = callSync("cmd", "/c", "echo off & echo %userprofile%","2>&1"); //(to log sdtErr too if needed/any)
    syncStdOut=syncOut.split(crlf)[0];//will depend on the result
    coutput('',syncStdOut,'',"path");

//----------------------------------------------------------------------------------------------------------------
then, will see which one is faster.

I guess I was actually lost in asynchronous space... Arigato sensei

Last edited by noone1; 10.12.2019 at 14:19.
Reply With Quote