|
Joined: Jul 2015
Posts: 26
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2015
Posts: 26 |
The script would search for either Dayz.exe or CSGO.exe in running applications and send a message upon detecting one.
The message would say the following if CSGO.exe was detected: !updatetitle CSGO Comp w/ oBeE !updategame Counter-Strike: Global Offensive
The message would say the following if Dayz.exe was detected: !updatetitle #Dayz PVP Elektro !updategame DayZ
I imagine this could be tailored to work with any game/application by switching the parameters another game.
Thanks for your help.
|
|
|
|
Joined: Nov 2009
Posts: 295
Fjord artisan
|
Fjord artisan
Joined: Nov 2009
Posts: 295 |
You have something else that interested me. Give this a shot. It will start checking when mirc starts or you do /autogame. It'll message the commands when it sees one of those two exes running and it won't message them repeatedly either. Let me know how it works out for you.
on *:start: .timerautogame 0 30 autogame
alias autogame {
if ($chkprocess(CSGO.exe)) && (%autogame != csgo) {
set %autogame csgo
msg #pball !updatetitle CSGO Comp w/ oBeE
msg #pball !updategame Counter-Strike: Global Offensive
}
elseif ($chkprocess(Dayz.exe)) && (%autogame != dayz) {
set %autogame dayz
msg #pball !updatetitle #Dayz PVP Elektro
msg #pball !updategame DayZ
}
else set %autogame none
}
alias chkprocess {
.comopen numMirc1 WbemScripting.SWbemLocator
if ($com(numMirc1)) .comclose numMirc1 $com(numMirc1,ConnectServer,3,dispatch* numMirc2)
if ($com(numMirc2)) .comclose numMirc2 $com(numMirc2,ExecQuery,3,bstr,SELECT Name FROM Win32_Process WHERE Name = $qt($1-),dispatch* numMirc3)
if ($com(numMirc3)) {
var %total $comval(numMirc3,0)
.comclose numMirc3
return %total
}
:error
if ($com(numMirc1)) .comclose numMirc1
if ($com(numMirc2)) .comclose numMirc2
if ($com(numMirc3)) .comclose numMirc3
return -1
}
|
|
|
|
Joined: Jul 2015
Posts: 26
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2015
Posts: 26 |
pball! My man! It's not workin out idk what's wrong with it. I updated the channel and loaded it up, when i open csgo nothin happens, closed csgo opened dayz nothin happens.
I also just thought of this, what will the script do if both of the programs are open at the same time? It should do nothing?
|
|
|
|
Joined: Nov 2009
Posts: 295
Fjord artisan
|
Fjord artisan
Joined: Nov 2009
Posts: 295 |
Try manually starting the timer with the command below. Something else you need to check is if your mirc is set to disable com calls, since this script uses that. Check under the mirc options - other - lock and see if Com is checked under the disable features area.
If you start one first, it will display the message for that program. Then if you load the second program it will display the message for that one. If you want it to ignore the second program if the first one is already running that would be simple. The script could also do something when it sees neither program running if you want.
Start timer manually: /timerautogame 0 30 autogame
|
|
|
|
Joined: Jul 2015
Posts: 26
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2015
Posts: 26 |
Ok so I checked that com calls arent disabled, and they werent since i was able to use the other script you made for me for the server ip. I tried to manually start the timer as well and it says it succeed but still nothin. This is what I updated the script with:
on *:start: .timerautogame 0 1 autogame
alias autogame { if ($chkprocess(csgo.exe)) && (%autogame != csgo) { set %autogame csgo msg #obeewnn !updatetitle CSGO Comp w/ oBeE msg #obeewnn !updategame Counter-Strike: Global Offensive } elseif ($chkprocess(Dayz.exe)) && (%autogame != dayz) { set %autogame dayz msg #obeewnn !updatetitle #Dayz PVP Elektro msg #obeewnn !updategame DayZ } else set %autogame none }
alias chkprocess { .comopen numMirc1 WbemScripting.SWbemLocator if ($com(numMirc1)) .comclose numMirc1 $com(numMirc1,ConnectServer,3,dispatch* numMirc2) if ($com(numMirc2)) .comclose numMirc2 $com(numMirc2,ExecQuery,3,bstr,SELECT Name FROM Win32_Process WHERE Name = $qt($1-),dispatch* numMirc3) if ($com(numMirc3)) { var %total $comval(numMirc3,0) .comclose numMirc3 return %total }
|
|
|
|
Joined: Nov 2009
Posts: 295
Fjord artisan
|
Fjord artisan
Joined: Nov 2009
Posts: 295 |
Hmm, I just tested the script again and it works for me. Type the following command and it should echo a number in the window you type it in. That will test if the script is able to see if a program is running.
//echo -a $chkprocess(explorer.exe)
I can't think of anything else in particular that would stop this script from working.
|
|
|
|
Joined: Jul 2015
Posts: 26
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2015
Posts: 26 |
Ok so when i type //echo -a $chkprocess(explorer.exe)
I get:
* /echo: insufficient parameters
I'm not sure how to debug this... Do you accept donations via paypal? I feel inclined to donate for all your help
Not sure if this matters but I have MIRC 7.38
Last edited by obee; 10/07/15 09:16 PM.
|
|
|
|
Joined: Nov 2009
Posts: 295
Fjord artisan
|
Fjord artisan
Joined: Nov 2009
Posts: 295 |
Well that means that alias chkprocess alias is not working and thus the script is not. My advice now is to make sure you copied the whole chkprocess alias and have it saved and loaded inside of a script. Then you can try that command again to check if it is working.
Your version of mirc shouldn't matter being that new.
|
|
|
|
Joined: Jul 2015
Posts: 26
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2015
Posts: 26 |
GOT IT!!!!!! I unloaded some other scripts I had. One of them was an twitch stream uptime script... the other was the server script you made for me. They may have been interfering with it... not sure but it works now! Previously when i loaded the script, it didnt give me the commands prompt, this time it did.
That uptime script didnt work anyways, might need your help with that as well, will post a new topic.
Last edited by obee; 10/07/15 11:18 PM.
|
|
|
|
Joined: Jul 2015
Posts: 26
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2015
Posts: 26 |
ok... I might have gotten a little excited. 1. The bot does not recognize the second command, could you maybe add a 5 second delay to the second line?
<obeesak> !updatetitle #Dayz PVP Elektro
<obeesak> !updategame DayZ
<obeesak> Stream title updated to: #Dayz PVP Elektro
2. The script keeps updating every 30 seconds or so. 3. Can you set it to do nothing when it detects both apps running at the same time? thanks for all your help man i really appreciate it
|
|
|
|
Joined: Nov 2009
Posts: 295
Fjord artisan
|
Fjord artisan
Joined: Nov 2009
Posts: 295 |
Ok a 5 second timer added to the second message and it will do nothing if both programs are running at the same time. It also should only do the commands once, until either the other program runs or neither program is running. Let me know how this update works.
on *:start: .timerautogame 0 30 autogame
alias autogame {
if ($chkprocess(CSGO.exe)) && ($chkprocess(Dayz.exe)) halt
if ($chkprocess(CSGO.exe)) && (%autogame != csgo) {
set %autogame csgo
msg #pball !updatetitle CSGO Comp w/ oBeE
.timer 1 5 msg #pball !updategame Counter-Strike: Global Offensive
}
elseif ($chkprocess(Dayz.exe)) && (%autogame != dayz) {
set %autogame dayz
msg #pball !updatetitle #Dayz PVP Elektro
.timer 1 5 msg #pball !updategame DayZ
}
else set %autogame none
}
alias chkprocess {
.comopen numMirc1 WbemScripting.SWbemLocator
if ($com(numMirc1)) .comclose numMirc1 $com(numMirc1,ConnectServer,3,dispatch* numMirc2)
if ($com(numMirc2)) .comclose numMirc2 $com(numMirc2,ExecQuery,3,bstr,SELECT Name FROM Win32_Process WHERE Name = $qt($1-),dispatch* numMirc3)
if ($com(numMirc3)) {
var %total $comval(numMirc3,0)
.comclose numMirc3
return %total
}
:error
if ($com(numMirc1)) .comclose numMirc1
if ($com(numMirc2)) .comclose numMirc2
if ($com(numMirc3)) .comclose numMirc3
return -1
}
|
|
|
|
Joined: Jul 2015
Posts: 26
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2015
Posts: 26 |
Seems like its still outputting the message every 30 seconds. The timer, and the feature where it doesnt do anything when both are running, work well though.
|
|
|
|
Joined: Nov 2009
Posts: 295
Fjord artisan
|
Fjord artisan
Joined: Nov 2009
Posts: 295 |
Scratch that. I messed up adding that else line for when neither program is running and that was added after I tested. This should fix it
on *:join:#pball: .timerautogame 0 30 autogame
on *:part:#pball: .timerautogame off
alias autogame {
if ($chkprocess(CSGO.exe)) && ($chkprocess(Dayz.exe)) halt
if ($chkprocess(CSGO.exe)) && (%autogame != csgo) {
set %autogame csgo
msg #pball !updatetitle CSGO Comp w/ oBeE
.timer 1 5 msg #pball !updategame Counter-Strike: Global Offensive
}
elseif ($chkprocess(Dayz.exe)) && (%autogame != dayz) {
set %autogame dayz
msg #pball !updatetitle #Dayz PVP Elektro
.timer 1 5 msg #pball !updategame DayZ
}
elseif (!$chkprocess(CSGO.exe)) && (!$chkprocess(Dayz.exe)) set %autogame none
}
alias chkprocess {
.comopen numMirc1 WbemScripting.SWbemLocator
if ($com(numMirc1)) .comclose numMirc1 $com(numMirc1,ConnectServer,3,dispatch* numMirc2)
if ($com(numMirc2)) .comclose numMirc2 $com(numMirc2,ExecQuery,3,bstr,SELECT Name FROM Win32_Process WHERE Name = $qt($1-),dispatch* numMirc3)
if ($com(numMirc3)) {
var %total $comval(numMirc3,0)
.comclose numMirc3
return %total
}
:error
if ($com(numMirc1)) .comclose numMirc1
if ($com(numMirc2)) .comclose numMirc2
if ($com(numMirc3)) .comclose numMirc3
return -1
}
|
|
|
|
Joined: Jul 2015
Posts: 26
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2015
Posts: 26 |
Nice dude! Works great, thank you so much!
|
|
|
|
Joined: Jul 2015
Posts: 26
Ameglian cow
|
OP
Ameglian cow
Joined: Jul 2015
Posts: 26 |
Ok here's a curveball I just thought of. Running the scripts from another networked pc.
I can reroute the server script to the network file, but for the chkprocess I'm not sure if you can check a remote pc's process by using the ip?
|
|
|
|
Joined: Nov 2009
Posts: 295
Fjord artisan
|
Fjord artisan
Joined: Nov 2009
Posts: 295 |
I'm not aware of any way to remotely check if a program is running on another computer. Other than running some sort of script/program on the networked computer and have it check and relay the info to the computer with the mirc script.
It wouldn't be too hard to make a python script or a simple C# program to check if either of those programs are running and write that info to a file. Then use a script to read that file and check if either are running. But that's getting away from mirc. Though if you had mirc on both computers it'd be possible to have a script on each computer that communicates between each other.
|
|
|
|
Joined: Dec 2013
Posts: 779
Hoopy frood
|
Hoopy frood
Joined: Dec 2013
Posts: 779 |
Would it be possible to terminate processes in a similar fashion?
Nillens @ irc.twitch.tv Nillen @ irc.rizon.net
|
|
|
|
Joined: Nov 2009
Posts: 295
Fjord artisan
|
Fjord artisan
Joined: Nov 2009
Posts: 295 |
It is possible to terminate processes running on the same computer. If you give more detail I could script something otherwise I could just post the alias for killing a process.
|
|
|
|
Joined: Dec 2013
Posts: 779
Hoopy frood
|
Hoopy frood
Joined: Dec 2013
Posts: 779 |
I don't know anything about coms, but what I'm looking for would be for the local pc that the mIRC client is running on. What I'd like to specify is only for example " /Terminate winamp.exe " and that would terminate any matching processes. You don't have to personalize anything if you don't want to, if you have an alias already that terminates a process I can work with that ![smile smile](/images/graemlins/mirc/smile.gif)
Nillens @ irc.twitch.tv Nillen @ irc.rizon.net
|
|
|
|
Joined: May 2015
Posts: 249
Fjord artisan
|
Fjord artisan
Joined: May 2015
Posts: 249 |
Dont give a fish - teach to fish!
|
|
|
|
|