mIRC Home    About    Download    Register    News    Help

Topic Options
#188895 - 01/11/07 01:59 PM com for doscmd
Turbo_boy Offline
Babel fish

Registered: 16/09/03
Posts: 84
Hello there,

I'm trying to make a script that execute a dos command and give
the results back.

But now I found the option $com but how to use it for doing dos commands? And is it possible to use it.

(I used dll's but after a while it just let irc crash :()

Top
#188896 - 01/11/07 02:15 PM Re: com for doscmd [Re: Turbo_boy]
Collective Offline
Planetary brain

Registered: 10/12/02
Posts: 3138
Loc: London, UK
You can use WScript.Shell's Exec() method, it won't allow you to hide the command window, though. Run() does, but you can't catch the output with that.

See here for an example script.

Top
#188898 - 01/11/07 02:42 PM Re: com for doscmd [Re: Collective]
Turbo_boy Offline
Babel fish

Registered: 16/09/03
Posts: 84
Thnx, it does just what I needed.

Top
#189107 - 04/11/07 01:45 AM Re: com for doscmd [Re: Turbo_boy]
The_JD Offline
Fjord artisan

Registered: 28/03/06
Posts: 392
Loc: New South Wales, Australia
Oh, just had a look... nice work

To make it close...

change this line:
Code:
   if ( !$com(stdcatch.shell $+ %i,Exec,1,bstr,$1-,dispatch* stdcatch.exec $+ %i) ) || ( !$com(stdcatch.exec $+ %i) ) { 


to this:
Code:
   if ( !$com(stdcatch.shell $+ %i,Exec,1,bstr,cmd.exe /C $+ $1-,dispatch* stdcatch.exec $+ %i) ) || ( !$com(stdcatch.exec $+ %i) ) { 


Obviously CMD.EXE only works on Windows NT... but you would change it to command.com if you were on Windows 9X.

Hope it helps
_________________________
[02:16] * Titanic has quit IRC (Excess Flood)

Top