Help with this .bat

Silvio

Argentinean Dogo
Joined
18 Mar 2004
Messages
156
I made (well..not really, since i know nothing about programming, i just modified one that i found :D ) this little .bat.
################################

@echo off

if [%min%]==[1] goto 2
set min=1
start /min Opera.bat
goto end

:2
set min=
cls

cd "C:\Archivos de programa\Pop-Up Stopper Professional\"
start PopUpStopperProfessional.exe
cd "C:\Archivos de programa\Opera7\"
start opera.exe

:end
exit

#########################################

It opens Opera and a Pop up blocker.
I use it as a direct access to open both apps with just one click.
My question is:
Can it be modified in first place, to check if the Pop up blocker (PopUpStopperProfessional.exe) is running in the background and THEN not open it and open ONLY Opera.exe?
I mean something like this:
Start->check if the popup blocker is running->Yes->a) - No->b)
a)open ONLY opera.exe
b)open BOTH apps
Hope i made myself clear :rolleyes:
Thanks!
 

Petros

Thief IV
Joined
19 May 2003
Messages
3,038
Well, you can throw in "taskkill /f opera.exe" and "taskkill /f PopUpStopperProfessional.exe" before your start commands. Will that work just as well? /F is just to force it to close down without asking petty questions.
 

chaos945

OSNN Senior Addict
Joined
10 Feb 2003
Messages
934
Here is a quick little program I threw togeather just for you. I also included space for up to 2 other programs.

* up to 4 paths can be run in succession
* they can be in any order, but unused paths must be left blank
* a process can be defined alone if it is set in the system PATH
* if a running process is found it will not be made to run again
* see about for more details

Anyone can take advantage of this program, it is quite dynamic.

** see below for updated link **
 

yoyo

_________________
Joined
29 Jul 2002
Messages
1,557
Chaos, nice program. But it doesn't seem to really check if the process already runs. Tried with notepad.exe and calc.exe.

For a batch file solution, to start two programs this one would do.

start "" "C:\Archivos de programa\Pop-Up Stopper Professional\PopUpStopperProfessional.exe" /min
start "" "C:\Archivos de programa\Opera7\opera.exe"


Does PopUpStopper run two instances? If not it wouldn't be necessary to check if the program already runs.

In XP Pro (or if you have borrowed the tasklist utility from a Pro installation) this batch will check

tasklist | find "PopUpStopperProfessional.exe"
if errorlevel 1 start "" "C:\Archivos de programa\Pop-Up Stopper Professional\PopUpStopperProfessional.exe" /min
start "" "C:\Archivos de programa\Opera7\opera.exe"


Why do you need a popupstopper in Opera?
 

Silvio

Argentinean Dogo
Joined
18 Mar 2004
Messages
156
Wow, thanks for your help.
Let me see,
Unwonted; good idea about Taskkill, its so simple and i didnt think about, i think i´ll work if there is one proccess working, i ll try it and see what happens when there is not one. ;)
Chaos; Thanks for the zip, im sure i´ll use it. :p
Yoyo; why i need a popupstopper in Opera...mmm...im just used to it! :D :D
Again THANKS!
 

chaos945

OSNN Senior Addict
Joined
10 Feb 2003
Messages
934
yoyo said:
it doesn't seem to really check if the process already runs.
Changed a few things, this new about file should explain how to get the detection to work properly.

If a PATH is defined in the system the process can be named alone. If an invalid path is defined the script will display an error dialog with the name of the failed operation and continue to the next process.

Concerning the system PATH, if you use for instance "notepad" instead of "notepad.exe" the script will not detect the program to be runnning since it is looking for an active process which is actually "notepad.exe". If you want the script to check to see if a process is running before executing a new process then put the extension of the file you are trying to run.

Some valid examples are listed below:



- EXAMPLES -

; is defined in the system PATH, will not detect process
Process=Notepad
Path=

; is defined in the system PATH, detects process
Process=Notepad.exe
Path=

; this is the ideal way to use the program, detects process
Process=Notepad.exe
Path=C:\Windows\system32\

; in both cases below, although the extention there, the process will not be detected since the program is now searching for an entire path, not just the process

Process=
Path=C:\Windows\system32\Notepad.exe

Process=C:\Windows\system32\Notepad.exe
Path=

; this will not work because the way I have defined the running of a process is $path & $process, so it would be trying to run 'C:\windows\system32\Notepad.exeNotepad.exe'
Process=Notepad.exe
Path=C:\Windows\system32\Notepad.exe
**outdated link removed, this file is now part of 'My Scripts & Regs'**
Download Part 1
Download Part 2
 
Last edited:

chaos945

OSNN Senior Addict
Joined
10 Feb 2003
Messages
934
I wanted a program to begin all the programs I update regularly. Its very similar coding but you can start up to 7 processes, the program will wait for each previous process to end before starting the next.

For things like updating the antivirus in my case I had to define the FULL PATH of the program, otherwise it would be waiting indefinitely for the process to end since it runs resident. Just modify the INI file how you want, same restrictions as 'go'.

The INI comes with my predefined programs so you can get a feel for how you could put your own.

**outdated link removed, this file is now part of 'My Scripts & Regs'**
Download Part 1
Download Part 2
 
Last edited:

Silvio

Argentinean Dogo
Joined
18 Mar 2004
Messages
156
Hey Chaos, what about something like this?:
1)Kill proccess X
2)Start proccess Y
3)WHEN i close proccess Y THEN start back proccess X
I have a .bat for doing that and works great but can it be done with AUTO-IT?
I use that for starting games after closing some apps so i can free some resources.

Here is my .bat:
Example:
X=YzDock and Coolmon
Y=Contract Jack Game

###########################
taskkill /F /IM CoolMon.exe
taskkill /F /IM YzDock.exe
cd "C:\Contract JACK\"
start /wait ContractJack.exe
cd "C:\Archivos de programa\CoolMon\"
start Coolmon.exe
cd "C:\Archivos de programa\Yzdock\"
start YzDock.exe
:end
exit
#############################
 

chaos945

OSNN Senior Addict
Joined
10 Feb 2003
Messages
934
This program was a giant pain in the ass, but I learned alot. :)
An infinite number of kill_processes and start_processes can be defined, albeit following strict input guidelines.

The default INI is listed below; I’ve set it to the standards requested above. They can be modified for any program, make sure there are no spaces in between values. All paths must be defined for the program to work properly, and you must define the number of processes to kill/start.

The DEBUG tool can be used to check your INI if you choose to modify it.


[config]

**careful not to put ANY spaces between values**

Number_To_Kill=2 ; 2 processes wanted to terminate must put 2 here
Kill_Programs=CoolMon.exe,YzDock.exe ; processes are separated only by a ‘,’ no spaces!
Kill_Path_Programs=C:\Archivos de programa\CoolMon\,C:\Archivos de programa\Yzdock\ ; if more than one process is defined above then it’s path must be defined here, no spaces!!

Number_To_Start=1 ; all the same rules apply for any processes defined here
Start_Programs=ContractJack.exe
Start_Path_Programs=C:\Contract JACK\
**outdated link removed, this file is now part of 'My Scripts & Regs'**
Download Part 1
Download Part 2
 
Last edited:

Silvio

Argentinean Dogo
Joined
18 Mar 2004
Messages
156
All i can say is...WOW! :eek:
It works as sweets as a candy!!! :D
Chaos, you rule!
I guess we all learn something with this post, i sure did too!!
Again thanks!
 

Members online

No members online now.

Latest profile posts

Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.
Terrahertz wrote on Electronic Punk's profile.
Yo fellas!
Electronic Punk wrote on Sazar's profile.
Where are you buddy?
Perris Calderon wrote on Electronic Punk's profile.
Hey EP! All good with me, applying for Microsoft MVP right now, should have done this a while ago.

Notifications don't work, I only found your response by coming back to hunt up some threads, if you want, give me your email address so we can keep in touch easier!
Perris Calderon wrote on Electronic Punk's profile.
EP, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there!

Forum statistics

Threads
61,997
Messages
673,400
Members
5,586
Latest member
PseudoKiller