mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2011
Posts: 52
E
eawedat Offline OP
Babel fish
OP Offline
Babel fish
E
Joined: Nov 2011
Posts: 52
hey all,,

If I run any command embedded in %PATH%. for example :

Php Code:
/run ping google 


1)Is it possible to get those results back to mIRC:

Php Code:

Pinging google.com [74.125.39.99] with 32 bytes of data:

Reply from 74.125.39.99: bytes=32 time=97ms TTL=51
Reply from 74.125.39.99: bytes=32 time=94ms TTL=51
Reply from 74.125.39.99: bytes=32 time=94ms TTL=51
Reply from 74.125.39.99: bytes=32 time=98ms TTL=51

Ping statistics for 74.125.39.99:
	Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
	Minimum = 94ms, Maximum = 98ms, Average = 95ms
 



2)How to write those results to a specific new window in mIRC ?


thanks a lot.

Last edited by eawedat; 20/11/11 11:58 AM.
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
The only way I can think of is redirecting the command output to a file - then loadbuf/filter/whatever from this file to your window.

The tricky part is to know at what time your data had been redirected sucessfully. For this reason you could wrap the /run command in a $com call of the WScript.Shell ( %comspec% /c <command [parameters]> > <redirection file> ) and mIRC will continue that particular script only after the call did finish.

Joined: Nov 2011
Posts: 52
E
eawedat Offline OP
Babel fish
OP Offline
Babel fish
E
Joined: Nov 2011
Posts: 52
Thanks Horstl for the idea to write/read output from file>
as that being said: I preferred to use FILES handling process,

I did it but it has to be fixed , if someone could do that please:

Php Code:

alias read {

  %path = $qt($mircdir $+ result.txt)

  //run ping google.com>%path

  if ($fopen(fp)) { fclose fp }

  fopen fp %path

  while (!$feof) && (!$ferr) {
	echo -a $fread(fp)
  }

  fclose fp

}
 


thanks.

Last edited by eawedat; 20/11/11 03:02 PM.
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
As stated, the problem is that you don't know when the command is finished, you have to either use some $com script or a dll


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2011
Posts: 52
E
eawedat Offline OP
Babel fish
OP Offline
Babel fish
E
Joined: Nov 2011
Posts: 52
Wims lets forget a second about reading the file when finished!

What's the problem with :-

Php Code:

alias wr {
  //run ping google.com>$qt($mircdir $+ result.txt)
}
 


it does not write/create result.txt


2)Is there a way to pause the cmd's window? so I could see what has been sent by mIRC?

thanks.


Joined: Jun 2003
Posts: 81
T
TRT Offline
Babel fish
Offline
Babel fish
T
Joined: Jun 2003
Posts: 81
Code:
//run cmd /c ping google.com> $qt($mircdir $+ result.txt)

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
You need a space between '>' and $qt(), and you can use "/run cmd /k ping google.com" to keep the window open


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2011
Posts: 52
E
eawedat Offline OP
Babel fish
OP Offline
Babel fish
E
Joined: Nov 2011
Posts: 52
Php Code:

//run cmd /k ping google.com > $qt($mircdir $+ result.txt)
 


YES Works!


But:

Php Code:

//run ping google.com > $qt($mircdir $+ result.txt)
 


DOES not work!


thanks.

Joined: Jun 2003
Posts: 81
T
TRT Offline
Babel fish
Offline
Babel fish
T
Joined: Jun 2003
Posts: 81
Thats because the output redirection feature is implemented at the lowest (cmd.exe) level.


Link Copied to Clipboard