mIRC Home    About    Download    Register    News    Help

Print Thread
#51635 27/09/03 05:51 PM
Joined: Aug 2003
Posts: 136
Vogon poet
OP Offline
Vogon poet
Joined: Aug 2003
Posts: 136
Would the comopen command work with a .bat? If so what would I use for the id? I run a bat to ftp a html file to my site, and I have to use the /run command but I have to run a shortcut to the file, and Id like to close the bat window when its finished. Any ideas on how to help?


In Virginia, chickens cannot lay eggs before 8:00 a.m., and must be done before 4:00 p.m.
#51636 27/09/03 06:36 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
You can use this to run the bat, and then perform other commands. e.g. //batrun | echo 4 -a * Done!
* Done! will be echoed AFTER the bat has finished.
Code:
alias batrun {
  var %a = $ticks
  .comopen %a WScript.Shell
  if !$comerr { .comclose %a $com(%a,Run,3,bstr,[color:blue]filename.bat[/color],uint,0,bool,true) }
}


edit
Note: It is "silent" - you will not see any sign of the bat or DOSbox. smile

Last edited by Iori; 27/09/03 06:38 PM.
#51637 27/09/03 06:40 PM
Joined: Aug 2003
Posts: 136
Vogon poet
OP Offline
Vogon poet
Joined: Aug 2003
Posts: 136
Why am I setting my ticks to a variable and wouldnt i want to do a comclose when it is done?


In Virginia, chickens cannot lay eggs before 8:00 a.m., and must be done before 4:00 p.m.
#51638 27/09/03 06:45 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
setting %a = $ticks is simply to give the com a unique name. There IS a comclose, check the last line
if !$comerr { .comclose %a $com(%a,Run,3,bstr,filename.bat,uint,0,bool,true) }
. smile

#51639 27/09/03 06:47 PM
Joined: Aug 2003
Posts: 136
Vogon poet
OP Offline
Vogon poet
Joined: Aug 2003
Posts: 136
ahhhhhh sorry, thank you Ill test it out


In Virginia, chickens cannot lay eggs before 8:00 a.m., and must be done before 4:00 p.m.
#51640 29/09/03 12:57 AM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
Weird thing, I think mIRC should evaluate $com before calling /comclose.. but this won't close it, as I've tested.

Last edited by cold; 29/09/03 12:58 AM.

* cold edits his posts 24/7
#51641 29/09/03 04:42 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Closes for me no problems.
When you pass mIRC a "/command $identifier" line it first evaluates the $identifier before executing the /command. You can see this by typing "//run $mircini", obviously $mircini is evaluated to 'path\mirc.ini' (or whatever.ini) or the command simply couldn't work. smile

#51642 29/09/03 04:59 AM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
Well, I know this, this is the behaviour I said it should have, but it doesn't close here.. is there any other reason for it not closing that I don't know of?

Last edited by cold; 29/09/03 05:04 AM.

* cold edits his posts 24/7
#51643 29/09/03 05:13 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
None that I know of. Check that your .bat file actually completes and closes.

#51644 29/09/03 12:29 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Deleting the dot (.) that precedes the comopen and comclose commands turns off the "silent" mode, letting you know whether the object was successfully opened or closed.

I don't know what's the version of your OS, but assuming it works the same for all of them, lets try what I did on Win98. Open your mIRC folder, locate the batch file and double-click on it (the file doesn't have to contain meaningful commands yet, just add some echo's). What happens when it finishes running? Is the DOS window automatically closed?

If it stays open, that's why your $com() never returned. You must get it to close itself once the process is finished. To accomplish that, do either:
  • Go to the file properties, select the 'Program' tab and check the 'Close on exit' option (note: that will create a .pif file on the same folder)
  • Add a single CLS command at the end of the file without a CRLF after it (since /write always ends the line with a CRLF you'll have to type it manually or use binary writing, /bwrite file.bat -1 CLS).
For details, read this tutorial under the section "Closing a DVM window automatically".

#51645 29/09/03 08:32 PM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
Yeah, that was the problem, it didn't close automatically. Doing what you've suggested solved it. Thanks for the help, very much appreciated smile


* cold edits his posts 24/7
#51646 01/10/03 07:05 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
I didn't realize win98 didn't auto close dos boxes when .bat files complete, good to know but its a bit retarded I think. smile


Link Copied to Clipboard