[<<]Message[>>]    [<<]Author[>>]        Subject        [<<]Thread[>>]

Number : 4575 Date : 2003-05-12 Author : Garry Deane Subject : Re: DOS Automatic DOS Keystroke tool - OT Size(KB) : 3
--- In xxcopy@yahoogroups.com, meirman@e... wrote: > But first I would ask the whole question above at > alt.msdos and hope that William Allen or someone > can tell you how to do it. You may have to read > the .bat file course, maybe an hour if you know a > little already, like how to use parameters in a > bat file, and only look at what applies to your > problem. More time if you don't know much, but > it should have other benefits over the years. > > If they can't answer the whole question, maybe > they can answer how to get yesterday's date using > only MSDOS. I have seen the solution to this posted in the group before so a Google search will find it. IIRC the standard method involves briefly setting the system clock back one day then restoring it so is probably not desirable. In light of my other post, it's also not needed - just let Xxcopy do the date maths for you. > Every answer William has given me (2 or 3) plus all the > examples on his webpage have been recursive or reentrant > or whatever they call this stuff in the PC or DOS world. > That is, the program is called (maybe without any parameters) > and it runs for 5 or 10 lines than calls *itself* with > parameters set up the way it wants. The second time > through it runs a different part of the code. I'm not > sure why he does it this way, but I assume the course > will say. I would still assume for simple uses, one > could skip the first part. This is done so that you don't have to have lots of small intermediate batch files to do the work. You can include the complete self-contained code in a single file and use the re-entrant techniques to execute those small sections as sub-routines. > Then there is the data manipulation like Gary has in his > example. I have trouble following that, but I need to have > a goal. Maybe after William Allen answers, you can bring > the answer back here, if Kan does't object. > We can mark the thread OT. Or you can just put Gary and me > on a cc: list. (As I volunteer Gary.) I would like to learn > this stuff, but I need a goal. Probably no longer relevant in light of my batch file to extract the date maths results using Xxcopy but here's what that previous code was doing: > echo:|date|lmod /s/- key-fake "P" [$6]-[$5]-[$7] 13 "Q">>printit.bat > echo yourprog>>printit.bat > call printit.bat > echo:|date This pipes a blank line to the DATE command. The result (depending on the system) is that DATE will output 2 lines like: Current date is: Mon 05-12-2003 Enter the new date: (dd-mm-yy) >|lmod /s/- key-fake "P" [$6]-[$5]-[$7] 13 "Q" The output from the DATE command is piped to LMOD, a utility program which parses input text and outputs the modified text to standard out (the screen or the next command). In this case, the LMOD command reads the first line, uses "/" and "-" as word separators and extracts the 6th, 5th and 7th "word". The other text which is not enclosed in [] is simply copied to the output stream. Therefore the above would output: key-fake "P" 12-05-2003 13 "Q" (There was a slight error in the above, it should have resulted in: key-fake "P" "12-05-2003" 13 "Q") >>printit.bat The output from LMOD is re-directed to printit.bat. When printit.bat is executed, it would execute KEY_FAKE to place the characters above into the keyboard buffer when the next program (the POS application) requests keyboard input. I hope this helps a little. LMOD is very useful in batch programs as it can take the output from all sorts of commands (including xxcopy) and massage the output so you can do something useful with that output. In NT/W2k/XP this isn't generally needed as the new "FOR /F" command can handle those tasks but it is handy for complex parsing cases and for DOS/W9x/ME environments. Of course there are also plenty of other similar alternatives around. The ones that are specific to DOS/W9x/ME can usually also set environment variables directly. Garry
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.