|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
I trying to make a bat file that closing mirc.exe, it working just fine as long as i havent renamed the exe file in any way, how can i check what name mirc using in the processes list? ideas plz..
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Dec 2002
Posts: 2,033
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,033 |
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
In case you aren't creating the batch file in mirc (in which case RoCk's suggestion would do the trick), you could just use "taskkill /IM mirc*.exe" (that's because you can only rename mirc.exe to mircSOMETHING.exe, but not to SOMETHING.exe for example)
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
ERROR: The process "mirc*.exe" not found., so don't do the trick. -------- Edit Solved that problem, now to next one how can i delay a command in dos promt/bat file ? I doing a "restore" for my script, but the problem are that when the bat file closing mirc, then it store the %var's in the file, and after i want to del that file, i dont know how i can make it be deleted after mirc closed and the file are saved, the reason for this is that i will restore the script with a file that have all variables stored as the script was when runned for the first time. del "E:\mirc\system\var.ini" This is the command i want to be delayed, and then the rest of the commands below.. pause dosen't do the trick.
Last edited by sparta; 26/09/08 04:19 PM.
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Feb 2006
Posts: 181
Vogon poet
|
Vogon poet
Joined: Feb 2006
Posts: 181 |
|
|
|
|
Joined: Jun 2008
Posts: 48
Ameglian cow
|
Ameglian cow
Joined: Jun 2008
Posts: 48 |
I found this for you. A common way to insert a fixed-time delay of 1–99 seconds is by using choice. This can be used in Windows 95/98/ME. In Windows NT/2000/XP you may need to install the choice command (if you clickWindows NT/2000/XP there's a download link at item (e) - but see the ping delay method, too, before you decide to download). For Windows 95/98/ME, and a choice delay of, say 10 seconds, you can use: REM | choice /c:delay /td,10>NUL In Windows NT/2000/XP, REM works differently, so use a TYPE NUL pipe ? instead: TYPE NUL | choice /c:delay /td,10 >NUL Note There is a Space before the redirection to >NUL, shown highlighted. A digit placed just before the operator > in Windows NT/2000/XP may conflict with redirection of STDOUT and STDERR (which uses the syntax 1> and 2> respectively). This second version also works in Windows 95/98/ME, so can be used for both Operating systems. In either case, replace the 10 with any number from 1–99 for other delays (in seconds). Our Batch Course Lesson 10 (more in Lesson 20) explains the choice method in detail. That came from http://www.allenware.com/icsw/icswref.htm which is a site trying to sell lessons but still gives out a lot of free info it seems. I thought i was in a giant add at first but sure enough found what you neede ( I think ). Hope it helps.
I've gone to look for myself. If I should return before I get back, please keep me here.
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
That force the user to install a program from a www site, any other way you can do a "restore" system, maybe a bat file arent the best way, but the only way i could figure out, the thing i want to do: 1: close mirc.exe (or what ever the name are) 2: remove the file mirc.ini 3: remove the file called var.ini 4: copy mirc.ini from a map called "backup" 5: copy var.ini from a map called "backup" 6: done! The code i testing with are:
@echo off
cls
echo =========================
echo Script restore importer.
echo =========================
echo.
echo Atempting to import files and settings.
echo.
echo Closing mirc.exe...
taskkill /IM mirc-test.exe
echo.
echo Importing your settings..
del "E:\mirc\mirc.ini"
del "E:\mirc\system\var.ini"
copy "E:\mirc\backup\var.ini" /Y "E:\mirc\var.ini"
copy "E:\mirc\backup\mirc.ini" /Y "E:\mirc\mirc.ini"
echo.
echo Done!
echo.
pause
And i create the bat file for every new install of my script, so i write the bat on first start so the path are allways the install folder for mirc. ;-------- Edit one way would be to download the files from my linux comp, but still the problem remain, mirc need to be totaly closed befor i can remove mirc.in and var.ini ..
Last edited by sparta; 26/09/08 09:26 PM.
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Jun 2006
Posts: 508
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
|
|
|
|
Joined: Jun 2003
Posts: 994
Hoopy frood
|
Hoopy frood
Joined: Jun 2003
Posts: 994 |
1. why delete the files when copy will overwrite them? 2. if you use /-Y it will wait for your prompt
copy E:\mirc\backup\var.ini+E:\mirc\backup\mirc.ini E:\mirc\var.ini+E:\mirc\mirc.ini /-Y
3. pause (on a line by itself) will wait for you to hit enter before proceeding
I refuse to engage in a battle of wits with an unarmed person.
|
|
|
|
Joined: Oct 2003
Posts: 3,918
Hoopy frood
|
Hoopy frood
Joined: Oct 2003
Posts: 3,918 |
batch files? gross.
getinfo {
if ($isid) && ($1) && ($prop) {
if ($com(Locator)) { .comclose Locator }
if ($com(Services)) { .comclose Services }
if ($com(Instances)) { .comclose Instances }
.comopen Locator WbemScripting.SWbemLocator
if ($comerr) { .comclose Locator | return }
var %com = $com(Locator,ConnectServer,3,dispatch* Services)
.comclose Locator
if $com(Services) {
var %com = $com(Services, InstancesOf,3,string,$$1,dispatch* Instances)
.comclose Services
}
if $com(Instances) {
var %com = $com(Instances,Count,3)
var %r = $comval(Instances,$iif($2,$2,1),$prop)
.comclose Instances
}
return %r
}
}
processes {
echo -a Number Of Processes: $getinfo(Win32_OperatingSystem,1).NumberOfProcesses
var %x = 1
while (%x <= $getinfo(Win32_OperatingSystem,1).NumberOfProcesses) {
echo -a ( $+ %x $+ ) Process: $&
$getinfo(Win32_Process,[ %x ]).Caption $&
(Priority: $getinfo(Win32_Process,[ %x ]).Priority $+ )
inc %x
}
}
killprocess {
var %e = echo -ac info * /killprocess:
if ($version < 6.16) { %e snippet requires mIRC 6.16 or higher | return }
if ($1 !isnum 0-) || ($0 < 2) { %e <N> <process> with N zero or higher | return }
var %a = a $+ $ticks, %b = b $+ %a, %c
.comopen %a WbemScripting.SWbemLocator
if ($comerr) { %e error connecting to WMI | return }
.comclose %a $com(%a,ConnectServer,1,dispatch* %b)
if ($com(%b)) .comclose %b $com(%b,ExecQuery,1,bstr*,SELECT $&
Name FROM Win32_Process WHERE Name = $+(",$2-,"),dispatch* %a)
if (!$com(%a)) { %e error retrieving collection | return }
%c = $comval(%a,0)
if (!%c) { %e no such process $2 | return }
if (!$1) {
while (%c) {
!.echo -q $comval(%a,%c,Terminate)
dec %c
}
}
else !.echo -q $comval(%a,$1,Terminate)
:error
if ($com(%a)) .comclose %a
if ($com(%b)) .comclose %b
}
count_processes {
var %a = a $+ $ticks, %b = b $+ %a, %c
.comopen %a WbemScripting.SWbemLocator
.comclose %a $com(%a,ConnectServer,1,dispatch* %b)
if ($com(%b)) .comclose %b $com(%b,ExecQuery,1,bstr*,SELECT $&
Name FROM Win32_Process WHERE Name LIKE $+(",$1,"),dispatch* %a)
%c = $comval(%a,0)
if ($com(%a)) .comclose %a
if ($com(%b)) .comclose %b
return %c
}
Those can all prove useful.
- argv[0] on EFnet #mIRC - "Life is a pointer to an integer without a cast"
|
|
|
|
|