English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

9 answers

Well the actual code for this application would certainly depend on the language you choose.. here's something you could do

(assuming '%' is the modulus function)

* Include statements
* Initialize variables
* Ask user for file name(s) to open
* Find the current time in seconds or the seconds portion of the current time and then find what the remainder is by 'startTimeSeconds % 10'
* Either loop or wait with a listener and calculate 'currentTimeSeconds % 10'
* Whenever 'currentTimeSeconds%10 = startTimeSeconds%10' open the file

and that's basically it. One thing to keep in mind is that you'll also need to close the file and watch your memory management so you don't face a memory leak from opening all these files (or single file multiple times)

Does this help?
Happy coding!

2007-05-11 04:40:40 · answer #1 · answered by chssmaniac 2 · 0 0

If you have XP, you can use a Visual Basic Script. Copy the code below to Notepad. Modify the first line by removing the spaces before and after the '.' character. (I put the spaces there because this site replaces a long typed in word with '...')
Change the 'calc.exe' text to whichever program that you wish to run. If the program needs to open a specific file, then put the drive letter, path, and name of the file after the program name. Change the '2000' to the number of milliseconds that you wish to wait between running the program. Change the '3' to the number of times you want to run the program, and then wait. Save the file to whereever you want, but make the file extension, .vbs. (Example: my file.vbs) You can also create a shortcut to the script file if you want.

Set WshShell = WScript . CreateObject ("WScript.Shell")
dim crap
crap=1

Do While crap < 3
WshShell.Run "calc.exe"
WScript.Sleep(2000)
crap=crap+1
Loop

2007-05-11 04:38:55 · answer #2 · answered by Balk 6 · 0 0

"Every 10 second" is very complicated because it will very much depend upon (1) the size of the file - which may vary from time to time (2) the fact that you *may not* open a data file on the web page viewer's computer, if that's what you mean, (3) a web page file will very much depend upon either the speed of the web page viewer's computer or the web page server's computer or the speed of the connection..."every 10 second" is just about impossible to guarantee

2007-05-11 05:39:41 · answer #3 · answered by fjpoblam 7 · 0 0

We need to know what languages and OS you intend to use. You will do this with a Windows Service on Windows, and the new .Net Service class makes that very easy.

You need to say more about what you are doing. Is it a logging operation or what?

2007-05-11 03:30:35 · answer #4 · answered by polly_peptide 5 · 2 0

create a counter, and on every 600 seconds do the action, return.

2007-05-11 03:27:24 · answer #5 · answered by words_smith_4u 6 · 2 0

Language, operating system?

2007-05-11 03:19:04 · answer #6 · answered by Enfold IT 2 · 2 0

In C:
#include
#include
int main()
{
clock_t t = 0;
while(1)
{
/* do something useful here */
/* then check the time */
if(clock()-t>=10*CLOCKS_PER_SEC)
{
FILE * tf = fopen("myfile.txt","rb");
/* work with the file */
fclose(tf);
t = clock();
}
}
}

2007-05-11 04:20:49 · answer #7 · answered by wschmerz 5 · 1 0

Why? This seems a pointless exercise.

2007-05-11 03:23:39 · answer #8 · answered by Anonymous · 2 0

if you are using linux....... put a line in your crontab.

2007-05-11 04:22:41 · answer #9 · answered by sheer_brilliance 2 · 1 0

fedest.com, questions and answers