1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Auto-restart a Program 30 min

Discussion in 'General Programming Chat' started by mylikes786, Mar 16, 2014.

  1. mylikes786

    mylikes786 Registered Member

    Joined:
    Oct 31, 2013
    Messages:
    80
    Likes Received:
    6
    I'm looking for a script who can realize this sequence.

    1. Close the Program every 30 minute;
    2. Wait 30 seconds;
    3. Relaunch the Program;
    Can you help me manage this problem ? Thanks a lot !
     
  2. Chris22

    Chris22 Regular Member

    Joined:
    Sep 29, 2010
    Messages:
    400
    Likes Received:
    1,059
    Are you on windows, osx, linux or what?
     
  3. mylikes786

    mylikes786 Registered Member

    Joined:
    Oct 31, 2013
    Messages:
    80
    Likes Received:
    6
    i am using window xp
     
  4. foodtrip

    foodtrip Jr. VIP Jr. VIP Premium Member

    Joined:
    Sep 20, 2011
    Messages:
    1,022
    Likes Received:
    189
    Download autohotkey

    copy code:

    replace 'Notepad.exe' with your program. eg. 'C:\firefox.exe'
     
    • Thanks Thanks x 1
  5. mylikes786

    mylikes786 Registered Member

    Joined:
    Oct 31, 2013
    Messages:
    80
    Likes Received:
    6
    I want that it kill my application and then open it again. because sometime it not responding
     
  6. foodtrip

    foodtrip Jr. VIP Jr. VIP Premium Member

    Joined:
    Sep 20, 2011
    Messages:
    1,022
    Likes Received:
    189
    Yes that is what it does.

    Loop
    {
    Run Notepad.exe,,, pid ;--> run program
    WinWait ahk_pid %pid%
    Sleep 1800 ;--> wait 30 minutes
    WinClose ;--> close program
    Sleep 30 ;--> wait 30 seconds
    }

    Loop ;--> repeat forever. After waiting 30 seconds it repeats the entire process.

    edit:

    what is your program?
     
  7. neutralhatter

    neutralhatter Jr. VIP Jr. VIP Premium Member

    Joined:
    Jun 23, 2010
    Messages:
    430
    Likes Received:
    330
    Instead of creating a script that is constantly running...You could make a bat file or script that stops and starts your application and then schedule it in windows scheduler ...
     
  8. mylikes786

    mylikes786 Registered Member

    Joined:
    Oct 31, 2013
    Messages:
    80
    Likes Received:
    6
    I ran a script in firefox is there any way my firefox auto restart when it is not responding

    because my firefox always not responding after every 20-30 min
     
  9. THUNDERELVI

    THUNDERELVI Elite Member

    Joined:
    Sep 12, 2009
    Messages:
    2,203
    Likes Received:
    1,732
    Gender:
    Male
    Location:
    W3
    Get WinAutomation and automate the task of killing firefox in the task manager (really easy) then use the scheduler to do this every 30min!