How could you close a program after a certain amount of time? Can't explain it too well; so here's the code that I think may work:
OPEN filename.exe for INPUT as #1
SLEEP 2000
CLOSE <somethin' here>
And one more thing: For Windows XPs' disk defragmenter, you can get it to start by doing this:
taco$ = "thepath.exe /start"
SHELL taco$
Right? Thanks.
closing programs
Moderators:Administrator, Global Moderator
- frankiebaby
- Global Moderator
- Posts:95
- Joined:Tue Apr 30, 2002 1:38 am
- Location:Pennsylvania
- Contact:
Re: closing programs
well, that close you put in there simply closes the file you opened. To end the program, use END. Also, you may not want to use SLEEP 2000, becuase sleep waits for 2000 seconds OR a keypress, whichever comes first.
Instead, use something like this
T! = TIMER
DO: LOOP UNTIL TIMER > T! + 2000
this will wait approximately 2000 seconds, unless those
2000 seconds span midnight, as TIMER returns the seconds past midnight.
to midnight proof it:
TIMEPASS% = 0
T% = INT(TIMER)
DO
IF INT(TIMER) <> T% THEN TIMEPASS+ TIMEPASS + 1
LOOP UNTIL TIMEPASS = 2000
this simply checks to see if the seconds are different, and if they are, count one second. Hope this helps, and happy programming!
Instead, use something like this
T! = TIMER
DO: LOOP UNTIL TIMER > T! + 2000
this will wait approximately 2000 seconds, unless those
2000 seconds span midnight, as TIMER returns the seconds past midnight.
to midnight proof it:
TIMEPASS% = 0
T% = INT(TIMER)
DO
IF INT(TIMER) <> T% THEN TIMEPASS+ TIMEPASS + 1
LOOP UNTIL TIMEPASS = 2000
this simply checks to see if the seconds are different, and if they are, count one second. Hope this helps, and happy programming!
Re: closing programs
but how can you close another program, like internet explorer or something?
- frankiebaby
- Global Moderator
- Posts:95
- Joined:Tue Apr 30, 2002 1:38 am
- Location:Pennsylvania
- Contact:
Re: closing programs
well, you cant quite do that through DOS that i kno of... you'd have to call a 'helper' program written for windows i think, like one that you pass in the program name to kill, and then it kills it. To close a window would require the use of windows api 's