Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Need help writing a batch that will open a txt file, find a date (that is in an http address), then change that date to current. Possible?

Possible, not with batch files though. You want HTML Applications. You should give me an idea of what you want to do and I might be able to help you better.

#1 is right; a BAT won't work. Try:
http://golden-triangle.com/change91...
=====================================
If at first you don't succeed, you're about average.M2

Maybe that is possible even by a batch using
Set VAR=%VAR:<old date>=<new date>%
The key point is the structure of the date and if its value is known.

Well, the txt file is an html source page that has date specific links that are referrenced to outside links. Was looking for a better way to update those rather than tedious, daily manual update.

Some are a href......org/070509.html - Some are img src.......com/070509.gif, where the outside links change their date format daily. Was hoping there was a quick and dirty to find the dates in my source file and update them to current date. Don't know if that can be done... Thanks guys for your time.

I will show you an easy way to do this. First, for everything that you want the source to point to:
a href="#" ID="datepage"You don't initally need a source, but you need the ID with a name in it for it to work. Same with anything with a tag:
img src="" ID="dateimage"
Now add this HTML Code to the BOTTOM of your page (but before the end </HTML> tag):
<script>
var now = new Date();
var day = now.getDate();
var month = now.getMonth()+1;
var year = now.getYear();
year = year.toString().charAt(2)+""+year.toString().charAt(3);
if(month < 10) { month = "0"+month; } if(day < 10) { day = "0"+day; }
function pointRef(objectid,filetype,editwhat,location) {
eval("document.all."+objectid+"."+editwhat+"=\""+location+year+month+day+"."+filetype+"\""); }pointRef("datepage","html","href","http://blahblah.com/folder/");
pointRef("dateimage","gif","src","http://blahblah.com/folder/");
</script>
Those two pointRef things have all you will need to use to get the script working with different things. Try it out though, it works.P.S.
When changing the folder, don't forget to include the / at the end or it won't work.

![]() |
play video file mfc progr...
|
Reverse batch file needed
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |