Jump to content

Recommended Posts

Posted

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.

Posted

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."

Posted

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
Posted (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 by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Posted

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. :)

Posted

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.

Posted (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)
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.

Edited by dantay9
Posted

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.

Posted

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.

Posted

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...

Posted

@ryan909,

Read this page and complete the tutorial. After that comeback when you still have questions.

Jos

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.

Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...