mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2004
Posts: 1
V
Mostly harmless
OP Offline
Mostly harmless
V
Joined: Nov 2004
Posts: 1
Hey peeps ehre is a problem that i need to be solved. I want to start winamp with a trigger like !winampon / !Winampoff. So that winamp.exe is starting at the computer where the script is running. The only problem is i don't now how.
Can some1 post me a line of code that Open en Closes window after writing a trigger down in a chat room.

Thanks in advance

Unreal out

Joined: Aug 2004
Posts: 237
L
Fjord artisan
Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
you need a dll like moo.dll I think

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
For !winampon, you can use /run:

Code:
on *:text:!winampon:#:{ run [color:red]full path to winamp.exe[/color] }


For !winampoff, you'll probably need a dll capable of ending processes.


New username: hixxy
Joined: Aug 2004
Posts: 237
L
Fjord artisan
Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
How solving spaces in that path???

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Two ways:

Code:
on *:text:!winampon:#:{ run [color:blue]$shortfn([/color][color:red]full path to winamp.exe[/color][color:blue])[/color] }


Code:
on *:text:!winampon:#:{ run [color:blue]"[/color][color:red]full path to winamp.exe[/color][color:blue]"[/color] }


New username: hixxy
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
[*] Download this dll by base, to communicate with Winamp.
[*] Copy the dll to your main mIRC folder.
[*] Add this code to your remotes:

on $*:TEXT:/^!winamp(on|off)$/Si:#: $dll(WA_Link.dll,WA_Link_Command,$iif($regml(1) == off,close,start))

I didn't add any error checking, I expect you to do that yourself. For more info regarding the dll, look here.

Something like this could easily be abused, so you'd better add user permissions, error checking etc.

Greets


Gone.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
As an alternative, you could use COM, but it will probably only work on computers which have an NT based OS, like win2k and xp, 2003 etc. The good thing is that you don't need a dll.

Code:
on $*:TEXT:/^!winamp(on|off)$/Si:#: wa_switch $regml(1)
 [color:red]  [/color] 
alias wa_switch {
  if $1 == off {
    .comopen a WbemScripting.SWbemLocator
    if $com(a) { .comclose a $com(a,ConnectServer,3, dispatch* b) }
    if $com(b) { .comclose b $com(b,ExecQuery,3,string,SELECT Name FROM Win32_Process WHERE Name = "winamp.exe",dispatch* c) }
    if $com(c) {
      var %a = $com(c,Count,3) 
      while %a { .echo -q $comval(c,%a,Terminate) | dec %a } 
    }
    .comclose c
  }
  else { run $shortfn(full path to winamp.exe) }
}


Greets


Link Copied to Clipboard