ryan909 Posted October 8, 2009 Posted October 8, 2009 Hi everybody my name is Ryan. I am a bit new to scripts. I really don't plan on writing anything major at all. I have a program that keep shutting off every 15 minutes. I would like to create a script that opens it every 15 minutes by opening it through a link. What I am trying to say is that I don't want it to open it by clicking, but it needs to find the file by itself. Is this even possible? I am sure it is simple for just about all of you but I really don't understand how to write a script for a timer.
dot45 Posted October 8, 2009 Posted October 8, 2009 look at the functions listed below loop sleep run Tools I've Created & Shared[/url][url="http://www.autoitscript.com/forum/index.php?showtopic=97177&st=0&p=698665&hl=printer&fromsearch=1&#entry698665"]Printer Migration Tool
sias Posted October 8, 2009 Posted October 8, 2009 Hi everybody my name is Ryan. I am a bit new to scripts. I really don't plan on writing anything major at all. I have a program that keep shutting off every 15 minutes. I would like to create a script that opens it every 15 minutes by opening it through a link. What I am trying to say is that I don't want it to open it by clicking, but it needs to find the file by itself. Is this even possible? I am sure it is simple for just about all of you but I really don't understand how to write a script for a timer.Firstly welcome to the forum; you will find that everyone here is extremely helpful in helping you with your problems. We just ask that you post some sample code of your design, and we will help you from there.Take a look in the helpfile for timerinit() and if the link you are wanting to click is in a webpage, try some of the _IE functions. "The true measure of a man is how he treats someone who can do him absolutely no good."
ryan909 Posted October 8, 2009 Author Posted October 8, 2009 Firstly welcome to the forum; you will find that everyone here is extremely helpful in helping you with your problems. We just ask that you post some sample code of your design, and we will help you from there. Take a look in the helpfile for timerinit() and if the link you are wanting to click is in a webpage, try some of the _IE functions. This is where I am stuck. As you can see I am very new to this.(hoping to get better though) So the first command is run and I have the file name go after that. Then I want it to sleep for 15 min. How would I insert 15mins? Last command is to start the whole process over again until I shut down the program. Where is this help file you are talking about? Run(filename) Sleep(15 minutes) Loop EndFunc
somdcomputerguy Posted October 8, 2009 Posted October 8, 2009 (edited) Where is this help file you are talking about?There is an online help file here, AutoIt. If you have installed AutoIt, there is one in the install directory, or hit F1 in the SciTE editor.<br> Edited October 8, 2009 by snowmaker - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
ryan909 Posted October 8, 2009 Author Posted October 8, 2009 There is an online help file here, AutoIt. If you have installed AutoIt, there is one in the install directory, or hit F1 in the SciTE editor.<br>Thanks for the link. Looking into it now. Will be back for more questions in a few.
ryan909 Posted October 8, 2009 Author Posted October 8, 2009 I am a bit confused on which loop to use. The following loop statements are available in AutoIt: * For...Next * While...WEnd * Do...Until * With...Endwith * For...In...Next I am think it can only be the second and third one from the list. But have no idea how to input this into my script.
dantay9 Posted October 8, 2009 Posted October 8, 2009 (edited) In my experience, there isn't a whole lot of difference in the performance of a do...until loop and a while loop. Personally, I almost always use while loops. Here is how you would do it in an infinite while loop. To make this a finite loop, replace the 1 with a boolean expression.While 1 Run($filename) Sleep(1000 * 60 * 15) WEndA With...EndWith loop is for objects, so that won't help at all.A For...In...Next loop is to do a set of actions on every element in an array, so that isn't it.A For...Next Loop repeats a set of actions a given number of times. Edited October 8, 2009 by dantay9
somdcomputerguy Posted October 8, 2009 Posted October 8, 2009 You would probably want a While...WEnd loop, with Sleep in it. See the function examples for more info. The local help file has examples also, and if AutoIt is installed, with the SciTE editor, the 'open this script' button is very helpful as the example can be opened and run in the editor. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
ryan909 Posted October 8, 2009 Author Posted October 8, 2009 In my experience, there isn't a whole lot of difference in the performance of a do...until loop and a while loop. Personally, I almost always use while loops. Here is how you would do it in an infinite while loop. To make this a finite loop, replace the 1 with a boolean expression. While 1 Run($filename) Sleep(1000 * 60 * 15) WEnd A With...EndWith loop is for objects, so that won't help at all. A For...In...Next loop is to do a set of actions on every element in an array, so that isn't it. A For...Next Loop repeats a set of actions a given number of times. Ok I think I am starting to understand a little more now. Assuming you put in the correct time than 1000 would be a millisecond and 60 would be 1 minute times 15, Giving me a total sleep of 15 mins.
ryan909 Posted October 8, 2009 Author Posted October 8, 2009 How would I put the file name in. This is the file name: C:\Documents and Settings\Admin\Desktop\New Folder (2)\New Folder (2)\file name The "and" is turned bold, like a command. And a few others as well...
somdcomputerguy Posted October 8, 2009 Posted October 8, 2009 Function Run - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
Developers Jos Posted October 8, 2009 Developers Posted October 8, 2009 @ryan909,Read this page and complete the tutorial. After that comeback when you still have questions.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ryan909 Posted October 8, 2009 Author Posted October 8, 2009 @ryan909,Read this page and complete the tutorial. After that comeback when you still have questions.JosThanks Jos. I have figured out my mistake. Will see if I can find a few good tutorial vids on youtube. Thanks for all of the help folks.
AdmiralAlkex Posted October 8, 2009 Posted October 8, 2009 Thanks Jos. I have figured out my mistake. Will see if I can find a few good tutorial vids on youtube. Thanks for all of the help folks.The youtube tutorials are linked to from the page Jos gave you just scroll down to the video section .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now