mIRC Home    About    Download    Register    News    Help

Topic Options
#101452 - 24/10/04 06:05 PM COM object not working..
j0k3r Offline
Pikka bird

Registered: 24/12/03
Posts: 10
Loc: Wisconsin
Code:
alias cmd {
  var %f = c:\ $+ $1 $+ .txt
  if ($com($1)) { .comclose $1 }
  .comopen $1 WScript.Shell
  if (!$comerr) {
    .comclose $1 $com($1,Run,3,bstr,$+(%,comspec%) /c $1 $2- > %f,uint,0,bool,true)
  }
  loadbuf -s %f
  .remove %f
}


This is supposed to perform a task using DOS and output it to a file, and then get shown in status.

The problem I receive is:

* /loadbuf: unable to open 'c:\netstat.txt'

Top
#101453 - 24/10/04 06:17 PM Re: COM object not working..
tidy_trax Offline
Hoopy frood

Registered: 02/11/03
Posts: 2327
It works fine for me using /cmd echo %username%, check that the command you're trying is a valid DOS command.
_________________________
New username: hixxy

Top
#101454 - 24/10/04 06:25 PM Re: COM object not working..
j0k3r Offline
Pikka bird

Registered: 24/12/03
Posts: 10
Loc: Wisconsin
/cmd echo %username% didn't work for me, either.

is this for certain OS' or something?

* /loadbuf: unable to open 'c:\echo.txt'

Top
#101455 - 24/10/04 06:29 PM Re: COM object not working..
tidy_trax Offline
Hoopy frood

Registered: 02/11/03
Posts: 2327
Shouldn't be, try opening cmd.exe (or msdos) and typing "echo %comspec%" without the quotes, it should echo the full path to cmd/msdos, if it does, I can't see why it wouldn't work.
_________________________
New username: hixxy

Top
#101456 - 24/10/04 06:33 PM Re: COM object not working..
j0k3r Offline
Pikka bird

Registered: 24/12/03
Posts: 10
Loc: Wisconsin
It does return the path to cmd.exe, but it still doesnt work frown

Top
#101457 - 24/10/04 06:39 PM Re: COM object not working..
tidy_trax Offline
Hoopy frood

Registered: 02/11/03
Posts: 2327
Try this then:

Code:
alias cmd {
  if ($com($1)) { .comclose $1 }
  .comopen $1 WScript.Shell
  if (!$comerr) {
    var %comspec = $com($1,ExpandEnvironmentStrings,3,bstr,$+(%,comspec%))
    %comspec = $com($1).result
    .comclose $1
    run -n %comspec /c $1- > $1.txt
    .timer 1 2 loadbuf -s $1.txt
    .timer 1 2 .remove $1.txt
  }
}


It's a messy workaround, but it might work for you. smile
_________________________
New username: hixxy

Top
#101458 - 24/10/04 06:47 PM Re: COM object not working..
j0k3r Offline
Pikka bird

Registered: 24/12/03
Posts: 10
Loc: Wisconsin
uh i think i found the problem..

i put echo $comerr before if (!$comerr) and it echos 1

Code:
.comopen $1 WScript.Shell
isn't working

Top
#101459 - 25/10/04 10:39 AM Re: COM object not working..
Armada Offline
Fjord artisan

Registered: 26/03/04
Posts: 540
If its just netstat your looking for i use this.
Code:
 
alias netstat {
  write -c netstat.txt
  var %a = run $+ $ticks 
  .comopen %a WScript.Shell 
  if $comerr { return }
  if $com(%a,Run,3,bstr,cmd.exe /c netstat > " $+ $mircdirnetstat.txt",uint,0,bool,true) {
    .comclose %a
  }
  .comclose %a
}
 

Top