Jump to content

I need help writing a script.....

So basically. I'm lazy, I run a program on a separate computer and every 5 or so hours it needs to be restarted just due to like performance type stuff. So I thought to myself why not write a script to automatically do that for me! But problem number 1 is that I know nothing about coding and couldn't find a article on it that would help me. So I go to the amazing LTT community. Basically I want a script that every 5 hours will close the program and reopen it basically, as for how to do that I'm not quite sure. So if someone could help me that would be amazing! Thank you! 

Link to comment
https://linustechtips.com/topic/855894-i-need-help-writing-a-script/
Share on other sites

Link to post
Share on other sites

Do you have a razer mouse or keyboard? 

My Rig

CPU - Ryzen 5 1600@3.8ghz          GPU - XFX XXX RX580 8g          Cooler - Arctic Freezer 33 eSports edition green          Motherboard - Gigabyte AB350 Gaming 3          Ram -  G.Skill 2x8 Ripjaws 5 2666                   Case - Pahntecs P400s TGE Modded with Green accents          PSU - Seasonic M1211 evo 620w          SSD - Samsung 960 evo 500 GB          HDD - Seagate Barracuda 7200rpm 2tb       

 Fans - 2 be quiet SilentWings 3         OS - Windows 10 Home 64-Bit         Cables - Cable Mod Green Cable Extension

 Peripherals

Mouse - Logitech G502          Keyboard - k95 Platinum Brown          Headset - Philips SHP9500s + Vmoda Boom Pro          Monitor - LG 29UM69GB

Webcam - USB webcam for Wii Fitness game xD

Link to post
Share on other sites

Create a batch file (open your editor, type stuff and save it as something.bat).

 

Then look here:

 

Executing program from batch file

Having a timer in your file

 

And I'd suggest plopping the finished file into your autostart folder, so it'll ahtomatically run on boot.

 

Alternatively you could ditch the timer and create a job on windows:

 

https://technet.microsoft.com/en-us/library/cc748993(v=ws.11).aspx

 

I don't have the time to put it together myself atm, but I can do that later if need be

 

Edited by myselfolli
Typo

75% of what I say is sarcastic

 

So is the rest probably

Link to post
Share on other sites

Just now, myselfolli said:

Create a batch file (open your editor, tyle stuff and save it as something.bat).

 

Then look here:

 

Executing program from batch file

Having a timer in your file

 

And I'd suggest plopping the finished file into your autostart folder, so it'll ahtomatically run on boot.

 

Alternatively you could ditch the timer and create a job on windows:

 

https://technet.microsoft.com/en-us/library/cc748993(v=ws.11).aspx

 

I don't have the time to put it together myself atm, but I can do that later if need be

 

Thanks so much! I'll try it and if I just can't seem to get it to work i'll requote this and ask for help! 

Link to post
Share on other sites

11 minutes ago, Bop said:

Thanks so much! I'll try it and if I just can't seem to get it to work i'll requote this and ask for help! 

I wsa thinking of a very getto way of using the razer synpanse macro feature to open the program and then after a crap ton of delay commands to left click(your mouse would be hobering over the x button at all times) to close the program. And you could set it to loop with a key press and turn it off with a key press. This way is much smarter tho. Good luck.

My Rig

CPU - Ryzen 5 1600@3.8ghz          GPU - XFX XXX RX580 8g          Cooler - Arctic Freezer 33 eSports edition green          Motherboard - Gigabyte AB350 Gaming 3          Ram -  G.Skill 2x8 Ripjaws 5 2666                   Case - Pahntecs P400s TGE Modded with Green accents          PSU - Seasonic M1211 evo 620w          SSD - Samsung 960 evo 500 GB          HDD - Seagate Barracuda 7200rpm 2tb       

 Fans - 2 be quiet SilentWings 3         OS - Windows 10 Home 64-Bit         Cables - Cable Mod Green Cable Extension

 Peripherals

Mouse - Logitech G502          Keyboard - k95 Platinum Brown          Headset - Philips SHP9500s + Vmoda Boom Pro          Monitor - LG 29UM69GB

Webcam - USB webcam for Wii Fitness game xD

Link to post
Share on other sites

On 11/6/2017 at 5:32 AM, myselfolli said:

Create a batch file (open your editor, type stuff and save it as something.bat).

 

Then look here:

 

Executing program from batch file

Having a timer in your file

 

And I'd suggest plopping the finished file into your autostart folder, so it'll ahtomatically run on boot.

 

Alternatively you could ditch the timer and create a job on windows:

 

https://technet.microsoft.com/en-us/library/cc748993(v=ws.11).aspx

 

I don't have the time to put it together myself atm, but I can do that later if need be

 

Don't forget he will also need to have a way of killing the program before he executes it again, that can get a little more complex due to the need to find the correct process to kill.

 

I would recommend doing it in a powershell script for that very reason as it has built in functions for handling the finding and killing of processes that work pretty well.

 

Let me know how it goes and if you are struggling might be able to help you out some more. :)

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×