Hi,
i have to replace a variable or a line in an textfile (unformated) with the actual date.
into the file there are some lines like:
ORDER: { Nr 1 }
ORDERNUMBER:"";
DATE:%date%;
CURRENCA:"EUR";
RELATION:95;
.............
I want to replace every day the word %date% or the complete line with the actual day date. the result should like this:
ORDER: { Nr 1 }
ORDERNUMBER:"";
DATE:11.08.2006;
CURRENCA:"EUR";
RELATION:95;
There are more orders in the file and at every line, where the variable is %date% the result should be there the actual day date.
I have made some scripts with Macro Scheduler but not any replacing any text into a file. smile....
Please give me any idea....
thanks
Peter
replacing field in textfile with date
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Just use the StringReplace function:
Something along these lines:
Year>yyyy
Month>mm
Day>dd
Let>TheDate=%yyyy%.%mm%.%dd%
ReadFile>...
StringReplace>thetext,%date%,TheDate,thetext
Something along these lines:
Year>yyyy
Month>mm
Day>dd
Let>TheDate=%yyyy%.%mm%.%dd%
ReadFile>...
StringReplace>thetext,%date%,TheDate,thetext
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Hello Marcus,
thanks a lot for your help. It's great to get anytime help from you!!!
Here is my result, it's the complet macro because i have had difficulty for the exact defination of every command:
Year>yyyy
Month>mm
Day>dd
Let>TheDate=%yyyy%.%mm%.%dd%
ReadFile>c:\input.txt,file
StringReplace>file,%date%,TheDate,newfile
WriteLn>c:\output.txt,wresult,%newfile%
finished...
best regards
Peter
thanks a lot for your help. It's great to get anytime help from you!!!
Here is my result, it's the complet macro because i have had difficulty for the exact defination of every command:
Year>yyyy
Month>mm
Day>dd
Let>TheDate=%yyyy%.%mm%.%dd%
ReadFile>c:\input.txt,file
StringReplace>file,%date%,TheDate,newfile
WriteLn>c:\output.txt,wresult,%newfile%
finished...
best regards
Peter