mIRC Home    About    Download    Register    News    Help

Print Thread
#162727 22/10/06 07:06 AM
Joined: Apr 2006
Posts: 24
A
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Apr 2006
Posts: 24
Hello,

I'm looking for a way to capture STDOUT (standard output) from a /run command. Specifically, I am going to tar a file using 7za.exe, and then I need to know when it is done.

I'm thinking capuring STDOUT is the best way to do this, but I'm open to other suggestions for other ways to do this because I dont know how to do it on mIRC.

ARc


#162728 22/10/06 08:54 AM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
you could try appending > Path\to\output\file to the command line and timer for the file excistence. Though note: i am not sure if the file is created prior to or after the run is closed.

Last edited by Mpdreamz; 22/10/06 08:55 AM.

$maybe
#162729 22/10/06 07:12 PM
Joined: Apr 2006
Posts: 24
A
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Apr 2006
Posts: 24
Hrm... Yeah I can see what you are saying, but I dont think it would be that great of a solution becuase it would create another file that I would have to delete later. Is there some way to return the STDOUT back to mIRC without needoing to do a $read() on a file.


#162730 22/10/06 09:04 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
i doubt it, mirc cant handle text beyond 950 characters so it would need to indexed if it was all of a returned anyway, be simplier to just store it to a file and then read it.

You could even partly interactevly read it, becuase as the file is created, mirc is also running and can get the lines as there created.

example.
Code:
alias example {
  window @example
  .timerexample2 1 1 example2 0
}
alias example2 {
  if !$isfile(c:\example.txt) {
    .timerexample2 1 1 example2 0
    ;^ no file reset the counter on file size
  }
  elseif ($lines(c:\example.txt) <= $1) { 
    .timerexample2 1 1 example2 $1
    .remove c:\example.txt
    .timerexample2 1 1 example2 0
    ;^ same size file (or less) set the timer off again with same size counter, attempt to delete the file, and if worked set the conter back to zero
  }
  else { 
    tokenize 32 $1 $v1
   .timerexample2 1 1 example2 $1
    window @example
    filter -pr $+($calc(1 + $1),-,$2) c:\example.txt @example *
    .timerexample2 1 1 example2 $2
    ;^ set timer off again as if nothing been done then display the text of the file from conter pos + 1 to last line of file, then set the timer off again using last line of file as the counter
  }
  :error | reseterror
}


run /example
start a dos session and do some dos command that is redirected to C:\example.txt such as dir/s c:\>c:\example.txt

You might find the double setting off of the timer a bit hard to follow, but its becuase sometimes the file c:\example.txt cant be accessed and/or deleted so its down to a wait and see approch.

#162731 22/10/06 10:36 PM
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
You could use this, it still creates the temp file, then auto-loads it into an mIRC @window and deletes it.
Code:
alias cmd {
  var %b = $$1-,%a = $+(cmd,$ticks)
  .comopen %a wscript.shell
  if !$comerr { .comclose %a $com(%a,run,1,bstr,cmd.exe /c pushd $mircdir && %b > %a 2>&1,uint,7,bool,true) }
  window -n @cmd.exe
  loadbuf -pr @cmd.exe %a
  window -g1 @cmd.exe
  .remove %a
}

Sample Useage:
/cmd dir/s/b
/cmd 7za a -ttar archive *.txt

#162732 24/10/06 07:00 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I like the idea of interactivity, so u can see the data as it is created, sure for short commands who would really care, but for say something taking 10 mins or even 3 hours, its nioce to see the progress as it happens.

#162733 24/10/06 10:43 PM
Joined: Apr 2006
Posts: 24
A
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Apr 2006
Posts: 24
Interactivity is prob the best solution here, since I will be tar-ing stuff, which sometiems woudl take a while. Thanks DaveC.

I did find a dll called stdio, but I havent taken an indepth look at it yet. Thanks!


Link Copied to Clipboard