need some programming/automation help/advice

i have a visual basic script that grabs files everyday, and copies them to a back up folder named for that days date

i'd like to add some search and replace to it - but i don't know how
can it be done in the same script?
can visual basic grab a file, replace specified code with new code?
is there a better way?
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
CAn you write a program that the script can fire off.
The program can do the search and replace that you desire
 

Whitecloak

Diamond Member
May 4, 2001
6,074
2
0
it is possible. the ease of doing this depends on the kind of file you want to manipulate. if its excel or word , i would recommend that you use the corresponding excel/word objects. if its a text file, you can use the generic "open" statement with the "for input" etc clause.
 

the files are shtml files
i'm not an expert programmer...it took me two weeks to figure out how to make the vbs file to copy the files :(
i have it set as a scheduled task, runs every night
 

Whitecloak

Diamond Member
May 4, 2001
6,074
2
0
you have already done most of the hard work by writing the script for moving the files. i presume that you want to modify the contents within the shtml file. correct me if i am wrong but i think you can open shtml in notepad , right ie it is a text file. in that case all you have to do is to open the file for input, use the built in vb function "replace" (which finds and replaces substrings) and save the file before moving it. i would advise you to make a back-up the first time you are running this script once its finished. :)
 

tryin to find some references to the open for input stuff

also is it possible to replace using todays date (using FormatDateTime(Date, vbLongDate))
i'm new to VB (and i haven't done any non-web programming since high school)
 

Whitecloak

Diamond Member
May 4, 2001
6,074
2
0
<< also is it possible to replace using todays date (using FormatDateTime(Date, vbLongDate)) >>

i am not able to figure out what is required - you want to replace all occurences of a previous date with today's date? i think it should be possible. but if there is not correlation between the date( something like it will always be yesterday when you replace it) you want to replace with today's date you might have to recode your program everyday. i havent done this before but i guess it should be possible.
 

i want to replace a line of code that outputs the current days date with THAT days date
(replace dynamic date with static date thats outputted with the script runs)