mIRC Homepage
Posted By: fackue Automatic disconnect after file transfer - 24/10/03 08:01 AM
Would it be possible if you can add an option to automatically disconnect from the internet after all DCC's are completed? Or even disconnect from the internet and shut down the computer? Thanks, I appriciate your time.
Posted By: pheonix Re: Automatic disconnect after file transfer - 24/10/03 01:03 PM
i don't use DCC so this is a lucky guess :tongue:

on *:filercvd:{
if (!$get(0)) { run cmd /c shutdown -s }
}
Posted By: fackue Re: Automatic disconnect after file transfer - 25/10/03 12:16 AM
Where would I stick that, and would I be able to turn it of and on? I don't do it often, but when I do leave my DCC's downloading over night, I'd like to be able to just do a /shutdownon to turn it on, and a /shutdownoff to turn it off. I've never messed with scripts this way, only self installed scripts.
Posted By: pheonix Re: Automatic disconnect after file transfer - 25/10/03 12:28 AM
Code:
menu status,channel,menubar {
  dcc auto shutdown
  .$iif($dccsh,$style(3)) on: .enable #dccsh
  .$iif(!$dccsh,$style(3)) off: .disable #dccsh
}
alias dccsh {
  return $iif($group(#dccsh).status == on,1,0)
}
on *:filercvd:*.*:{
  if ($dccsh) && (!$get(0)) { run cmd /c shutdown -s }
}
#dccsh off
blah
#dccsh end

that has a switch to turn it on and off, i also read up about on *:filercvd ^.^, i'm not willing to test it, *hates dcc*.
you will have to change run cmd to: run <path to ms dos> if you have ms dos.
Posted By: fackue Re: Automatic disconnect after file transfer - 25/10/03 04:34 AM
Thanks, I really appriciate it. I'll try it out next time I download something.
Posted By: fackue Re: Automatic disconnect after file transfer - 25/10/03 09:41 PM
I just now tried this, it wouldn't work for me. I turned it on, recived a DCC, then when the transfer was over, nothing happened, just as if the script was never there.

I also tried it by turning it on right after I recieved the file, during the download, I turned it on - same thing.

I have Win98, I'm assuming the "cmd" is for Win2K/XP? So I did what you said, changed the "cmd" to the path of MS DOS. This is what I came up with:

Code:
if ($dccsh) &amp;&amp; (!$get(0)) { run c:\command.com /c shutdown -s }


I even tried just 'c:\command.com /c shutdown -s' under Run, and all it did was open DOS and quickly close. Sorry - I just don't know what to do?
Posted By: pheonix Re: Automatic disconnect after file transfer - 25/10/03 09:57 PM
try shutdown /s
Posted By: Strider Re: Automatic disconnect after file transfer - 25/10/03 10:26 PM
"/run rundll.exe user.exe,exitwindows" shuts down Win98.
Posted By: fackue Re: Automatic disconnect after file transfer - 25/10/03 10:32 PM
'c:\command.com /c shutdown /s' gives "Bad command or file name".
Posted By: Strider Re: Automatic disconnect after file transfer - 25/10/03 10:44 PM
Well, like I mentioned before (maybe you didn't see my reply), "/run rundll.exe user.exe,exitwindows" works fine with Windows 98.
Posted By: fackue Re: Automatic disconnect after file transfer - 25/10/03 10:48 PM
OK, changing the line, I still get the same problem. It's acting like that script not even there after a transfer was completed.

EDIT: Yeah :tongue:, I was in the middle of typing that reply when you replied back.
Posted By: Strider Re: Automatic disconnect after file transfer - 25/10/03 11:13 PM
if ($dccsh) && (!$get(0))

That's because the second part of that condition is wrong.

I'm assuming that pheonix added that condition to check if no other DCC get windows are open when the transfer ends; but he forgot that, when the event triggers, the window is still open, which means that $get(0) returns 1 and not 0 when no other receive windows are open; the NOT (!) operator should not be used here.

The line should be:

if ($dccsh) && ($get(0)) { run rundll.exe user.exe,exitwindows }

In any case, you might not want it to check if other DCC windows are open, since you are able to turn this feature on and off, meaning that you'll turn it on only when you want mIRC to shut down your computer after you receive a file.

You might want to leave this line like this:

if ($dccsh) { run rundll.exe user.exe,exitwindows }
Posted By: fackue Re: Automatic disconnect after file transfer - 26/10/03 01:24 AM
Thanks a lot, I really appriciate your help Strider, I'll try this out after I nothing really to do on my computer. Thanks also to pheonix, appriciate it.

Another thing - will I have to change the options in mIRC to not confirm closing if a channel is open, or connected to server? Or will it shut down without me having to change that?
Posted By: pheonix Re: Automatic disconnect after file transfer - 26/10/03 01:27 AM
like i said, it was a lucky guess;] i don't use DCC.
Posted By: cold Re: Automatic disconnect after file transfer - 26/10/03 03:16 PM
But since he wants it to shutdown after ALL DCC's are completed (not when he just set the feature on), I'd use a ($dccsh) && ($get(0) < 2) condition.
Posted By: Strider Re: Automatic disconnect after file transfer - 27/10/03 04:39 AM
Sorry, I didn't read that part in his initial post.

fackue: If you're going to use cold's condition, make sure that your DCC get windows close on completion.

Posted By: fackue Re: Automatic disconnect after file transfer - 01/11/03 06:38 AM
Awesome, it works. Thanks you guys. Though it would be cool if it was implemented in mIRC, this script is so limited...

Anyways, here's the script, ready to load:
http://consolevision.com/members/fackue/tools/shutdown.zip
© mIRC Discussion Forums