![]()
[<<]Message[>>] [<<]Author[>>] [<<]Subject [<<]Thread
Number : 4574 Date : 2003-05-12 Author : Garry Deane Subject : Re: DOS Automatic DOS Keystroke tool Size(KB) : 3
--- In xxcopy@yahoogroups.com, "yodaslo" wrote: > Hello, > garrydeane wrote- > >I'm surprised that you > >couldn't get Autoit to work > > Well, I could get it to work, > but I couldn't figure out how > to tell Autoit to enter yesterdays date. > > Yes, I do have to enter a date for > which day I want the information for, > and since it's always yesterdays sales > I need the transaction report for, I > have to tell it yesterdays date. > > Thanks for taking the time to reply. I'll look into your > suggestions OK I suggest that you stick with autoit. I suspect that the delay while the report is being generated would be impossible to handle with key-fake or a similar keyboard "stuffer" because presumably sending an while the report is being generated would cause it to abort. When I was looking for a download site for key-fake, I noticed the following program at that site: ftp://ftp.externet.hu/pub/mirror/sac/utiltask/m403.zip. It is called M.exe and is intended for DOS/W9x/ME. It is a batch file enhancer which includes date manipulation, arithmetic, value comparisons, file properties, string functions, input prompts and a bunch of other things for extending the capabilities of batch files. It looks very polished. Of significance to your problem are the extensive date functions. By default, the program uses a US date format of mm/dd/yy so I'll assume that you need to enter yesterday's date in the form of (say) dd-mm- yy. To assign that to an environment variable called yestday you could simply do: m/set yestday=[dd`[pdate`yesterday]]-[mm`[pdate`yesterday]]-[yy` [pdate`yesterday]] So then the issue is how to modify the autoit file so that it has this new value for yesterday's date. I suggest that the easiest way is to create 2 .aut files. The first would have all your static autoit commands up to the point where you need to enter the date (say printit1.aut). The second would have all your static autoit commands after you have entered the date (say printit2.aut). Then you would build the final autoit file on the fly within your batch file by starting with the first .aut file, appending the commands which include the %yestday% value then appending the second .aut file. So your batch file might be something like: @echo off m/set yestday=[dd`[pdate`yesterday]]-[mm`[pdate`yesterday]]-[yy` [pdate`yesterday]] copy printit1.aut printit.aut echo Send, %yestday%{enter}>> printit.aut type printit2.aut >> printit.aut autoit printit.aut xxcopy If you don't want to use M.exe, you can use Xxcopy to do the date maths for you! The following batch file will use xxcopy to format a date to your requirements and offset the date as required. It sets the result to %xxdate% which can be used in the calling batch file. If you call the following xxdate.bat, you can do this in your main batch file. call xxdate dd-mm-yy -1 echo Yesterday was %xxdate% :: xxdate.bat @echo off :: Use xxcopy to carry out date calculations and set %xxdate% :: Optionally specify the date format and the date offset :: e.g. xxdate dd-mm-yy -2 will give the date 2 days ago :: Defaults to yyyy-mm-dd for today set xxdate= set dmacro=/$%1$ if %dmacro%==/$$ set dmacro=/$yyyy-mm-dd$ set offset=/tm%2 if %offset%==/tm set offset= :: Test for valid syntax xxcopy %dmacro% /l/ec%offset% > nul if errorlevel 34 if not errorlevel 35 goto :error :: Capture output from Xxcopy macro expansion (the next line may wrap) xxcopy %dmacro% /l/ec%offset%|find /i "/l/ec"|find /v "$" > ~getdate.bat :: create a replacement xxcopy command if exist xxcopy.exe ren xxcopy.exe ~xxcopy1.exe echo @echo off>xxcopy.bat echo set xxdate=%%1>>xxcopy.bat call ~getdate.bat :: Tidy up if exist ~xxcopy1.exe ren ~xxcopy1.exe xxcopy.exe del xxcopy.bat goto :end :error echo Syntax error! echo Usage is %0 [date format [date offset]] echo [date format] must be a valid Xxcopy date macro echo e.g. %0 dd-mm-yy -2 :end if exist ~getdate.bat del ~getdate.bat set dmacro= set offset= Garry
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.