Help with this .bat

Discussion in 'Web Design & Coding' started by Silvio, May 21, 2004.

  1. Silvio

    Silvio Argentinean Dogo

    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!
     
  2. Petros

    Petros Thief IV

    Messages:
    3,038
    Location:
    Pacific Northwest
    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.
     
  3. chaos945

    chaos945 Moderator

    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 **
     
  4. yoyo

    yoyo _________________

    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?
     
  5. Silvio

    Silvio Argentinean Dogo

    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!
     
  6. chaos945

    chaos945 Moderator

    Messages:
    934
    Changed a few things, this new about file should explain how to get the detection to work properly.

    **outdated link removed, this file is now part of 'My Scripts & Regs'**
    Download Part 1
    Download Part 2
     
    Last edited: Apr 25, 2005
  7. chaos945

    chaos945 Moderator

    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: Apr 25, 2005
  8. Silvio

    Silvio Argentinean Dogo

    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
    #############################
     
  9. chaos945

    chaos945 Moderator

    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.


    **outdated link removed, this file is now part of 'My Scripts & Regs'**
    Download Part 1
    Download Part 2
     
    Last edited: Apr 25, 2005
  10. Silvio

    Silvio Argentinean Dogo

    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!