mIRC Homepage
Posted By: orcsoul Script that starts another mirc instance - 16/08/10 12:20 AM
What I'm trying to accomplish is that on execution of a specific 'on text' event, client A will launch client B ... I'm pretty sure I've got everything worked out except for how (if it's possible) to start an external program from within mirc.
//run "path to file\mirc.exe"
Posted By: orcsoul Re: Script that starts another mirc instance - 16/08/10 02:12 AM
Of course it had to be that simple *headdesk* I must have glossed right over that / command in the help index for mirc.

Thanks!
Posted By: orcsoul Re: Script that starts another mirc instance - 16/08/10 04:08 AM
Ok.. so everything is working.. however after putting a little more thought into it I realized I've got a very nasty vulnerability in my script.. as it stands now it's susceptible to malicious/ignorant misuse by spawning multiple instances of the run target...

I'm not familiar enough with mirc scripting to know how to construct an if-then or some other type of logic check that will somehow make sure that the command can only be run successfully once...

Perhaps by doing a /whois and checking that a nick is in use.. if the nick is in use, the /run doesn't get executed, otherwise the /run is performed?


on 1:TEXT:*call bot*:*://run "C:\Internet Utils\mircbot\mirc.exe"

Is where I'm at... but I'm unfortunately not quite sure how the syntax would work for the if statement, especially when it comes to somehow integrating it with the bot-call remote line.
Posted By: RusselB Re: Script that starts another mirc instance - 16/08/10 04:21 AM
The first option that occurs to me is to use a group to limit the ability to have the /run command started.
Eg:
Code:
on *:start:{
  .enable #bot_start
}
#bot_start off
on *:text:*call bot*:*:{
  .disable #bot_start
  run "C:\Internet Utils\mircbot\mirc.exe"
}
#bot_start end

When the script starts, the group #bot_start will be enabled.
This will then allow the call bot text to be recognized.
When that text is recognized the first time, the group is disabled, then the other mIRC is run.
Since the group is disabled the first time the text is recognized, that ON TEXT event will not be triggered again.
Exceptions are:
1) The script is restarted
2) The group is re-enabled, either manually or via another script.
Posted By: orcsoul Re: Script that starts another mirc instance - 16/08/10 05:09 AM
Hmm, thanks for the suggestion. I ended up figuring out how to integrate an if statement into the bot-call before seeing your reply, so went that route.
If you REALLY want I could write a script using coms to check for 2 mirc.exe's running, and if not, start the second smile
Posted By: orcsoul Re: Script that starts another mirc instance - 16/08/10 06:24 PM
That would make the script significantly more secure from abuse, however I've no idea how much work that would entail on your behalf, and the crowd that would be utilizing the commands isn't the type to try to abuse something like that. However, thanks for the offer on that.
© mIRC Discussion Forums