mIRC Home    About    Download    Register    News    Help

Print Thread
Execute .bat using !stats #193284 17/01/08 11:05 PM
Joined: Oct 2005
Posts: 98
S
starpossen Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Oct 2005
Posts: 98
I've got pisg for doing my stats, and all works as it should, I use a .bat file for executing the log generator and also for uploading to my site.

My question is:
Is it possible to make a script, where if a predifined user types !dostats
It will ececute the batfile, and then send a messages to the channel saying: Stats updated, have a look at http://blabla.bla

I hope this is possible.

Re: Execute .bat using !stats [Re: starpossen] #193288 17/01/08 11:09 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Code:
on *:text:!dostats:#: {
  run batchfilename.bat
  msg $chan Stats updated, check http://www....com/
}


Of course, you'll probably want to limit this to only voiced or opped users or use the userlist levels to limit it to specific user levels. Also, I'm assuming pisg takes awhile to create the file and get it uploaded, so you might want to put a timer on the msg line to send the msg 30-60 seconds (or whatever it takes to get it created/uploaded) after the /run command.


Invision Support
#Invision on irc.irchighway.net
Re: Execute .bat using !stats [Re: Riamus2] #193292 17/01/08 11:49 PM
Joined: Oct 2005
Posts: 98
S
starpossen Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Oct 2005
Posts: 98
Thanks for the quick reply, the !dostats would it be possible to add a hostmask for that command, so only 1 user could execute it?
And regarding the timer, the log isn't that big yet, so the generation of stats and uploads takes betqween 2-5 seconds, however, the timer idea sounds clever.

These two things, how would the code look like?
Once again, thanks for the quick reply.

*EDIT* I tried this:
Code:
on *:text:!dostats:#: {
  run d:\server\pisg\pisg.bat
  .timer 1 10 msg $chan Stats updated, check http://blabla.bla/
}

And it works, I know it might not be the best script, but it works.
Now I just need to add a nick or host to the !dostats command
so only a specified host or user can use the command, any help on this? I guess I could add an @ in on *:text:
But i'd really like to make so only one specific user can use it.

Last edited by starpossen; 18/01/08 01:02 AM.
Re: Execute .bat using !stats [Re: starpossen] #193293 18/01/08 01:57 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
The @ wouldn't do anything for you. That only checks to see if the client running the script is an op... not if the person typing the command is an op.

Do something like this:

Code:
on *:text:!dostats:#: {
  if ($address($nick,2) != *!*@host.com) { return }
  run d:\server\pisg\pisg.bat
  .timer 1 10 msg $chan Stats updated, check http://blabla.bla/
}


Or else put the person's host into your Users list and then use a level on the script:

Code:
on 100:text:!dostats:#: {
  run d:\server\pisg\pisg.bat
  .timer 1 10 msg $chan Stats updated, check http://blabla.bla/
}


That would be level 100+ user could access it. You can also use a named level if you want.


Invision Support
#Invision on irc.irchighway.net
Re: Execute .bat using !stats [Re: Riamus2] #193597 22/01/08 07:09 AM
Joined: Oct 2005
Posts: 98
S
starpossen Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Oct 2005
Posts: 98
Tahnks alot, after being away from home for a few days, I tried what you suggested and it works perfectly smile

Now, how would I add a timer sayin "Check stats at blahblah.blah"
And make it repeat everyday at midday?
I tried usin the exampl from /help timer :
/timer9 14:30 1 1 /say It's now 2:30pm

changed it to:
/timer9 08:00 1 1 /say Check out the stats at http://blabla.bla/

Added it to remote, but nothing happend, any ideas?

Re: Execute .bat using !stats [Re: starpossen] #193601 22/01/08 11:23 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You have the right idea. You just need to either type it from the edit line and hit enter, or add it to an alias and then run the alias, or put the time into an on START event so it starts automatically whenver you start mIRC.

Code:
on *:start: {
  .timerStatAd 8:00 1 1 msg #yourchannel Check out the stats at http://...../
}


Replace the channel name with your channel name. Also note that this will not start the timer until mIRC is restarted unless you manually start the timer from the edit line.


Invision Support
#Invision on irc.irchighway.net
Re: Execute .bat using !stats [Re: Riamus2] #193622 22/01/08 07:26 PM
Joined: Oct 2005
Posts: 98
S
starpossen Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Oct 2005
Posts: 98
Works nicely, but I have a weird problem/issue
When I execute my .bat file for pisg which works perfectly
on my server, everything is fine, but if I use the !dostats command from another computer, I can see the .bat file being executed on my server, but it's not updating the stats, like something is blocking
which seems very odd since it's working when I do it manually.

I hope I make sense.

Re: Execute .bat using !stats [Re: starpossen] #193632 22/01/08 09:09 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
No idea there unless some program (AV/firewall/etc) is blocking it because of permissions. Or maybe it's just not set up correctly.


Invision Support
#Invision on irc.irchighway.net
Re: Execute .bat using !stats [Re: Riamus2] #193795 25/01/08 08:35 PM
Joined: Oct 2005
Posts: 98
S
starpossen Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Oct 2005
Posts: 98
Originally Posted By: Riamus2
You have the right idea. You just need to either type it from the edit line and hit enter, or add it to an alias and then run the alias, or put the time into an on START event so it starts automatically whenver you start mIRC.

Code:
on *:start: {
  .timerStatAd 8:00 1 1 msg #yourchannel Check out the stats at http://...../
}


Replace the channel name with your channel name. Also note that this will not start the timer until mIRC is restarted unless you manually start the timer from the edit line.


Im using the on START, but how would I make it so it would announce it without the need to restart it?

I mean repeat it everyday at the same time specified in the script? I thought it already did that, but it doesnt.

Last edited by starpossen; 25/01/08 08:36 PM.
Re: Execute .bat using !stats [Re: starpossen] #193800 25/01/08 09:33 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Try the -o switch in the timer to make it an offline timer so it's not lost if you disconnect.


Invision Support
#Invision on irc.irchighway.net
Re: Execute .bat using !stats [Re: Riamus2] #193814 26/01/08 06:04 AM
Joined: Oct 2005
Posts: 98
S
starpossen Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Oct 2005
Posts: 98
I never really used timers before this, so bare with me the -o switch, would I place it like so:
Code:
on *:start: {
  .timerStatAd -o 8:00 1 1 msg #yourchannel Check out the stats at http://...../
}

Or am I just making stupid guesses? I did read in the /help /timer
but didnt find what i was looking for.

Re: Execute .bat using !stats [Re: starpossen] #193855 26/01/08 09:04 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yeah. Oh, I just noticed one other thing... you told the timer to only repeat once instead of forever. Change the repetitions from 1 to 0.


Invision Support
#Invision on irc.irchighway.net
Re: Execute .bat using !stats [Re: Riamus2] #193883 26/01/08 10:13 PM
Joined: Oct 2005
Posts: 98
S
starpossen Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Oct 2005
Posts: 98
Is that the first or the second 1 ?

*EDIT* Unless I misread the helpfile, it would be the first.

Last edited by starpossen; 26/01/08 10:17 PM.
Re: Execute .bat using !stats [Re: starpossen] #193885 26/01/08 10:19 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yes, it's the first.


Invision Support
#Invision on irc.irchighway.net
Re: Execute .bat using !stats [Re: Riamus2] #193947 27/01/08 05:21 PM
Joined: Oct 2005
Posts: 98
S
starpossen Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Oct 2005
Posts: 98
That change made it spam the message continuesly untill I stopped the timer manually.

Re: Execute .bat using !stats [Re: starpossen] #194181 30/01/08 10:41 PM
Joined: Oct 2005
Posts: 98
S
starpossen Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Oct 2005
Posts: 98
Any help on why it made a massively spam?
I did exactly as told.

Re: Execute .bat using !stats [Re: starpossen] #194186 30/01/08 10:57 PM
Joined: Aug 2006
Posts: 19
R
Reaper Offline
Pikka bird
Offline
Pikka bird
R
Joined: Aug 2006
Posts: 19
try this
Code:
 on *:start: {
  .timerStatAd -o 8:00 0 1 msg #yourchannel Check out the stats at http://...../
}



ReaperIRC
Killgore Computers
Re: Execute .bat using !stats [Re: Reaper] #194274 01/02/08 12:31 PM
Joined: Sep 2007
Posts: 65
X
XTZGZoReX Offline
Babel fish
Offline
Babel fish
X
Joined: Sep 2007
Posts: 65
Heh. It's not the first. It's the second. Setting the first to 0 means it will do it forever every 1 second.


GamerzWoW
The Official GamerzPlanet WoW Server