mIRC Home    About    Download    Register    News    Help

Print Thread
#227918 28/11/10 11:08 AM
Joined: Nov 2009
Posts: 81
V
Voglea Offline OP
Babel fish
OP Offline
Babel fish
V
Joined: Nov 2009
Posts: 81
mirc.exe -a /alias [parameters] - execute alias
mirc.exe -s signal [parameters] - sent signal to mirc

(update message)
for what? just i want execute some command from external programs, like uTorrent.


Last edited by Voglea; 28/11/10 11:15 AM.
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
write a simple .bat file
Code:
@echo off
echo %1 >> path\file.txt

then, from utorrent use: "path-to-file" "%n"

and THEN have mIRC poll path\file.txt


I am SReject
My Stuff
Joined: Apr 2010
Posts: 30
M
Ameglian cow
Offline
Ameglian cow
M
Joined: Apr 2010
Posts: 30
i wrote a small program for that years ago in delphi:

Code:
program mirccmd;

uses
  ddeman;

{$R *.res}


var
  DDE: TDDEClientConv;
  i:Integer;
  parameters:String;
begin
  try
    for i := 1 to paramcount do begin
      parameters := parameters + ' ' + ParamStr(i);
    end;
    DDE := TDDEClientConv.Create(nil);
    DDE.SetLink('mirc', 'COMMAND');
    DDE.OpenLink;
    DDE.PokeData('COMMAND',Pchar(parameters));
  except
  end;

end.


It simply sends the command line arguments to mirc's DCC server (server name is hardcoded as mirc's default dde name 'mirc').

Notice: include the starting / when passing commands. Example:

Code:
mirccmd.exe /echo -a test


Download:
Code:
http://www57.zippyshare.com/v/50510393/file.html

Last edited by m0viefreak; 28/11/10 06:00 PM.
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
The command line is here to tell to mirc how to behave before the application start, what you're asking is completely not needed, use the on start event to run your alias and to send your signal

after reading argv0's post, it seems you don't want the application to really run, which isn't mentioned in your suggestion.

Last edited by Wims; 28/11/10 09:39 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
I like this, but I see some problems with it:

1) The behaviour to me would seem like it would spawn a new instance of mIRC. The only feasible thing to do here would be to have mIRC talk to an already running instance to pass the command. In this sense, it should function like DDE, however...

2) This would be problematic if you were running multiple instances of mIRC, since it would be impossible to tell which process to talk to. mIRC works by having the process listen to a DDE service name (defaulting to "mIRC"), which is what mIRC could contact, but...

3) If the DDE service name changes from mIRC to something else, mIRC would not be able to know what it is. In this case, it might be necessary to supply the DDE service name in the command line. I wouldn't have a problem with this.

In short, mIRC should have a command-line switch that acts as a tiny helper method to send a DDE requests to a DDE service (defaulting to mIRC). I suppose it could look like:

mirc.exe -d [SERVICENAME] "command to execute"

Although for parsing simplicity, having a separate switch for the service name might be wise:

mirc.exe -s SERVICENAME -d "command to execute"

Calling mIRC in this way wouldn't actually spawn the client, it would simply send a DDE message and exit, without showing any UI elements-- it would basically be the delphi code shown above.

The only problem I see with having such a functionality in mIRC is that it lends itself for more piggyback abuse from viruses, which could use this command to send DDE messages to arbitrary services (like your browser). I'm not sure how big a deal this is, though, if a virus is already running in memory.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Link Copied to Clipboard