Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Script for launch program and close a window  (Read 4743 times)

0 Members and 1 Guest are viewing this topic.

Esgrimidor

    Topic Starter


    Hopeful

    Thanked: 1
    Script for launch program and close a window
    « on: January 01, 2011, 07:35:17 PM »
    Script for launch a program and close a window
    I need to identificate correctly a window appear when I open a program. This window is not configurable in this program, so I need close it with the script.



    How can I determine and force the closing of this window ?

    Best Regards
    happy New Year
    No dejes que tu felicidad dependa de lo que no depende de tí.

    donpage



      Rookie

      Thanked: 1
      • Computer: Specs
      • Experience: Experienced
      • OS: Windows XP
      Script for launch program and close a window
      « Reply #1 on: January 09, 2011, 10:11:09 AM »
      Code: [Select]
      @echo off

      start pair1.bat
      start pair2.bat

      sleep  6

      tasklist  |  findstr  "%1"

      tasklist  |  findstr  "%1"  > notepid.txt


      for /f  "tokens=1,2 delims= " %%i in (notepid.txt) do (
      echo pid=%%j

      taskkill /F  /pid %%j

      )

      Rem  We assume only pair1.bat and pair2.bat use sleep.exe
      Rem We taskkill sleep.exe

      Output:
      C:\test>killpair.bat  sleep
      sleep.exe                     3544 Console                    1      1,000 K
      sleep.exe                     2340 Console                    1      1,000 K
      pid=3544
      SUCCESS: The process with PID 3544 has been terminated.
      pid=2340
      SUCCESS: The process with PID 2340 has been terminated.


      Salmon Trout

      • Guest
      Re: Script for launch program and close a window
      « Reply #2 on: January 09, 2011, 10:19:19 AM »
      If I screw my eyes up I can see that the very fuzzy screen shot is showing Autohotkey, so I am surprised the OP isn't asking in a forum specialising in that tool. Looks a bit script-kiddyish to me.


      joebrown

      • Guest
      Script for launch program and close a window
      « Reply #3 on: January 13, 2011, 04:03:00 PM »
      Does start and taskkill  work

      Linux711



        Mentor

        Thanked: 59
        • Yes
        • Programming Blog
      • Certifications: List
      • Computer: Specs
      • Experience: Experienced
      • OS: Windows 7
      Re: Script for launch program and close a window
      « Reply #4 on: January 17, 2011, 01:02:06 PM »
      Something like that can usually be removed using a debugger, if you know what your doing. I can't read what the message says, but I trust you that it's not a registration prompt.
      YouTube

      "Genius is persistence, not brain power." - Me

      "Insomnia is just a byproduct of, "It can't be done"" - LaVolpe