|
|
|
Batch File Help?
Showing all messages in thread #1235237128 Windows 98 Annoyances Discussion Forum
The following are all of the messages in this thread (8 in all), shown in chronological order. Click any message subject to view that message by itself or to view the thread hierarchy.
|
Batch File Help?
Saturday, February 21, 2009 at 9:25 am Posted by Robert Blanda
(4 messages posted)
I was wondering if you gurus can give me some direction...
I run a Specials Menu on a large LCD TV at a restaurant using powerpoint. There are
two specials files (lunch.pps and dinner.pps)
When this system reboots, i want a batch file to determine which powerpoint file
to open based on what time it is.
ON BOOTUP: For instance, if it's anywhere between 11am and 3pm, open the lunch file.
If its any other time, run the dinner.pps file. Make sense?
Im already running a scheduled tasks application that shuts down one and starts up
the other based on what time. This works very well. Problem is, i frequently Remote
Desktop into this machine and make changes. Once those changes are made, i have to
reboot the system. I then want this batch file to start the appropriate presentation
since the scheduled task application only works when it sees 11am or 3pm (as in the
example above)
I figured since you can determine time and date within a batch file, can't you do
an if /then/else type script within a batch? (if its *this time* then load THIS application)
Does anyone know what the syntax is to do this?
[Reply or follow-up to this message]
| |
Branching in a Batch File based on the Real-Time Clock?
Saturday, February 21, 2009 at 11:39 am Posted by gewg_
(4444 messages posted)
Robert Blanda wrote:
|I run a Specials Menu on a large LCD TV at a restaurant using powerpoint.
|There are two specials files (lunch.pps and dinner.pps)
|When this system reboots,
|i want a batch file to determine which powerpoint file to open
|based on what time it is.
|[. . .]
|I figured since you can determine time and date within a batch file,
|can't you do an if /then/else type script within a batch?
|(if its *this time* then load THIS application)
|
Unfortunately, DOS can't do arithmetic from the command line
(not even greater than or less than commands--only equals).
To do what you asked, you would have to include
an IF statement for **every** possible iteration of the RTC.
What you need is a real programming language.
With every OS it shipped, M$ *used* to include a QBASIC interpreter
(a stripped-down version of its QuickBASIC compiler). No mas.[1]
cache of http://www.skeeterbytes.com/pc/cabs/981.htm
That's not really a huge deal, however:
http://www.google.com/search?q=Download-QBASIC
...or even
http://www.google.com/search?q=Download-QuickBASIC
Here in the 21st Century, there are many, many options, e.g.:
http://www.thefreecountry.com/compilers/basic.shtml
http://www.google.com/search?q=Python-for-Windows
[1] ...and to get in my usual dig at M$, the big general-purpose GNU/Linux distros
have ALWAYS shipped with GCC (the GNU Compiler Collection).
[Reply or follow-up to this message]
|
re: Branching in a Batch File based on the Real-Time Clock?
Saturday, February 21, 2009 at 12:46 pm Posted by Robert Blanda
(4 messages posted)
Oh wow, what a bummer. Im not much of a programmer and i looked out there to see
if there were any applications that would handle this for me, but sadly, none of
them will do this. I could really use some direction, but am lost!
[Reply or follow-up to this message]
|
re: Branching in a Batch File based on the Real-Time Clock?
Saturday, February 21, 2009 at 2:50 pm Posted by gewg_
(4444 messages posted)
Robert Blanda wrote:
|Oh wow, what a bummer. Im not much of a programmer and[...]
School children write programs in BASIC all the time. It's not that difficult
--especially if you were thinking about using Batch programming to do this.
The syntax is similar. If you were aware of using something as a variable,
http://www.google.com/search?q=SET-Command+environment-variable
you're able to do this. You *will* need to learn how to work with strings (data).
While there is a core set of instructions in BASIC,
http://www.google.com/search?q=intitle:BASIC+intitle:tutorial+BASIC-compiler
each compiler is a little different.
I've already shown you that the software is available gratis
and any good compiler has its own tutorial available.
Getting back to kids, there are probably youngsters
at your local community college or high school who could work with you on this.
...or perhaps a local computer club.
[Reply or follow-up to this message]
|
re: Batch File Help?
Wednesday, February 25, 2009 at 3:00 pm Posted by MartinM
(7551 messages posted)
You can get pretty creative with DOS's limited command set.
For instance, on boot run a batch file that deletes a file [nnn] if it exists (use
the IF EXIST command).
Then use the AT command to create file [nnn] at your crossover time.
Finally schedule a batch file to run at say 5 minute intervals and use the IF EXIST
command again to interrogate the existence of the file [nnn] to determine your time-related
course of action.
I hope this makes sense (its perfectly clear to ME !!). I'm sure you can improve
on what I cobbled together, and its instructive to get your own ingenuity going :-)
[Reply or follow-up to this message]
|
re: Batch File Help?
Thursday, February 26, 2009 at 5:33 pm Posted by gewg_
(4444 messages posted)
MartinM wrote:
You can get pretty creative with DOS's limited command set.
For instance, on boot run a batch file that deletes a file [nnn] if it exists
(use the IF EXIST command).
Then use the AT command to create file [nnn] at your crossover time.
Finally schedule a batch file to run at say 5 minute intervals
and use the IF EXIST command again to interrogate the existence of the file [nnn]
to determine your time-related course of action.
I hope this makes sense (its perfectly clear to ME !!).
I'm sure you can improve on what I cobbled together,
and [it's] instructive to get your own ingenuity going :-)
Nice try--but no cigar.
AT is *not* part of the DOS7 (Win98) command set.
cache of http://www.computerhope.com/at.htm
There is an add-on utility out there
cache of http://www.downloadthat.com/programs/At/Command
--but that doesn't support W98 either.
I think 4DOS includes an AT command
but since JP has made that freeware and stopped supporting it,
I'm not finding a listing for the command set.
To use 4DOS to replace COMMAND.COM,
you use the SHELL command in CONFIG.SYS.
http://www.google.com/search?q=SHELL-4DOS.COM+OR+SHELL-C-4DOS.COM
Your solution also requires creating TEMP files.[1]
This is getting to be even more hoops to jump thru
than would be constructing a compact, purpose-built app
and compiling it once with a freeware tool.
A compiled file would be MUCH more portable/maintainable than trying to use DOS
I do believe.
...and to Martin and the OP: Scheduled Tasks is one of the first things I disabled.
Those who ever looked at what a resource hog is,
want to get rid of that PoS real quick.
There *are* other (freeware) options:
http://www.google.com/search?q=Cron-for-Windows-*
[1] Not a great idea with an OS that uses a filesystem which requires defragging.
cache of http://www.whylinuxisbetter.net/items/defragment/index.php
[Reply or follow-up to this message]
|
re: Batch File Help?
Friday, February 27, 2009 at 2:36 pm Posted by Bill
(5 messages posted)
I think it could be done using VBScript or JScript, which are included with Windows
98. I was intrigued enough to try writing it myself, but I don't have PowerPoint,
and there doesn't seem to be a simple "open file" method that will launch its associated
application. It would have to be launched with a command line using the Run method.
Also, I'm not certain, but after the ILOVEYOU VBScript virus hit several years ago,
there may be a question whether using these languages is secure enough. If that
computer isn't used to connect to the Internet or get e-mail, it might be a good
way to go.
[Reply or follow-up to this message]
|
re: Batch File Help?
Saturday, February 28, 2009 at 10:39 am Posted by Robert Blanda
(4 messages posted)
Actually, a nice person on another board wrote me a batch file. Goes like this:
@Echo Off & Setlocal enableextensions enabledelayedexpansion
set _H1=N
set _H2=N
FOR /F "tokens=1 delims=:" %%A IN ('echo %time%') DO (
echo %%A
if %%A GEQ 11 set _H1=Y
echo !_H1!
if %%A LSS 15 set _H2=Y
echo !_H2!
if [!_H1!!_H2!] == [YY] (
start "" "C:\Documents and Settings\rblanda\Desktop\lunch\lunch.pps"
) ELSE (
start "" "C:\Documents and Settings\rblanda\Desktop\dinner\dinner.pps"
))
[Reply or follow-up to this message]
| |
| |
Tip: Use one of the [Reply or follow-up to this message] links above to add a message to this thread
| |
Return to the Windows 98 Discussion Forum
|
|
|
|