Q: How do you make EBL-Plus wait for 60 minutes before entering some keystroke to do something?
A: Waiting for seconds is easy and described in the documentation, however waiting for many minutes is a bit tricker. It involves stuffing some assembly language magic into the keyboard stack so it will run in the background while your other applications or DOS is running. Without going into the details, the following code will wait for 60 minutes before entering the keystrokes. It is important to copy this exactly as shown.
BAT /n * Start EBL but keep logo silent... BEGSTACK Load Signal 1st portfolio \f0\02\45; \EB\04\00\00\00\00\06\B8\40\00\8E\C0\83\7C\02\00; \75\1C\83\7C\04\00\75\16\26\A1\6C\00\05\07\00\89; \44\04\26\A1\6E\00\15\01\00\89\44\02\EB\12\26\A1; \6E\00\3B\44\02\72\09\26\A1\6C\00\3B\44\04\73\03; \BE\00\00\07\C3; These are the application keystrokes.. END
For more details on this technique, there is a real world example of how this is used, plus the source code for hackers that corresponds to the hex values shown in this example.
A: When EBL programs larger than 64K, EBL starts reading parts of the batch file from the disk. Naturally disk access is slower than the computer's own memory speed. If this speed difference is unacceptable, either you can put your batch file on a "RAM Disk" (like the VDISK.SYS program that comes with DOS), or you can split up the program into several smaller portions.
The reason 64K was chosen is to limit the amount of memory taken away from applications that EBL starts. If the buffer was an unlimited size, then other applications would have difficulty working.
Q: When my computer starts, how can I change what it does by pressing a special key as it boots?
A: Use the KEYPRESSED() function to see if a key has been pressed. It will not make the batch file pause like the READ command. KEYPRESSED() will return a 'true' flag if you press a key that hasn't been read in yet. If this function says a key is waiting, then use the INKEY and IF commands to see which key it was. A sample is below:
BAT IF NOT(KEYPRESSED()) THEN GOTO -Default INKEY %0 IF %0 = "A" THEN GOTO -Accounting IF %0 = "D" THEN GOTO -Data.base-Default ..commands to execute default application.. Bat Exit
-Accounting ..commands to execute accounting application.. Bat Exit
-Data.base ..commands to execute Data Base application.. Bat Exit
Q: How can I delay a program from starting until a certain time with EBL-Plus?
A: Making a delay for a specific time is possible with just one EBL statement. It's accomplished by understanding how to use the WAIT command, the TIME() function, and the locate operator '?'. Assuming the program you want to delay is XYZ, then it can be done with the program below.
The first step is to put the startup time for the program into a variable %0. This is mainly for convenience. Although we do this by asking for it from the user, it could have also be an assignment. Note that the format of the value put into %0 must match the civil time format that we are testing against. There are of course many other formats that could be used. Refer to the TIME() function in your EBL manual for examples.
The command that does the time delay will be the WAIT UNTIL command. It will execute an expression over and over until it is true or non-zero. The expression is simply the locate operator '?' that compairs the current time of day in TIME() with the %0 variable. When it is different, the '?' operator results in zero (0). When it is the same, it results in the value one (1) (ie. the first position of the match). Because the WAIT UNTIL command waits for any non-zero expression, it will move on when the time arives.
BAT * Delay a program until some time.... * * Hold the start time in a variable for convenience. * %0 = "2:00pm" * * We'll use the TYPE command to give us some feedback * that things aren't broken. * TYPE "Waiting until" %0 "..." * * Now wait until the TIME() function contains the value in %0 * with the '?' operator. When it is different, the '?' operator * results in zero (0). When it is the same, it results in one (1) * which is the first position of the match. The WAIT UNTIL * looks for any non-zero expression. * WAIT UNTIL (TIME() ? %0) * * Now simply start the application. * XYZ