Windows Script Host I need a .vbs script that reads
This script must run local on a windows 7 pc
I was thinking about a wsh script in combination with vb.
Files:
File 1 (template)= Template a fixed file containing a template that is to be replicated.
File 2 (var) = a file containing only a list off variables with a value this is not fixed
can be 1 or 9 or 100
File 3 (list) = a file containing a list of words or url’s
File 3 (list)
Has to be read line by line and for each single name make a new file under the name it
read out of the list.
Example File 3 (list)
mouse
cat
dog
Creates 3 files (here 3 files if the listing contained 50 or even 5000 it would create 5000 files)
mouse.txt
cat.txt
dog.txt
The extension txt is stored in the File 2 (var):
Example of File 2 (var):
filename_extension=”.txt”
Standard variables in the File 2 (var) are:
filename_extension=”.txt”
filename_before=”"
filename_after=”"
If filename_before and filename_after are given a value:
Eample:
filename_extension=”.txt”
filename_before=”aaaa_”
filename_after=”_zzzz”
OUTPUT wil be:
aaaa_mouse_zzzz.txt
aaaa_cat_zzzz.txt
aaaa_dog_zzzz.txt
If variables for front and after are empty nothing is appended to the file name
only before or only after is also possible ofcourse.
Eample:
filename_extension=”.txt”
filename_before=”"
filename_after=”thisstringisappended”
OUTPUT wil be:
mousethisstringisappended.txt
catthisstringisappended.txt
dogthisstringisappended.txt
Example off an template the template contains text and variables:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>var1</title>
</head>
<body>
<H1>var2</H1>
<p>This is some text for the var3 off template for file %filename%</p>
</body>
</html>
As you can see there are some var(x) declared in the template.
If the file 2 (var) would be like the following example:
filename_extension=”.html”
filename_before=”"
filename_after=”_animals”
var1=”These are all animals”
var2=”Big or small”
var3=”EXAMPLE”
The output off this would be for the first line = mouse the file will be mouse_animals.html
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>These are all animals</title>
</head>
<body>
<H1>Big or small</H1>
<p>This is some text for the EXAMPLE off template for file mouse</p>
</body>
</html>
As you can see the variables are replaced with the text declared in the file 2(var)
These variables can be anything.
var3=”EXAMPLE” could be fftt99=”EXAMPLE” or pat88=”EXAMPLE”
ATTENSION !!!
%filename% is File 3 (list) = a file containing a list of words or url’s
Example File 3 (list)
mouse
cat
dog
So if it was at the 3e in the list:
%filename% in the template wil be dog
Only the line as example of the template
<p>This is some text for the EXAMPLE off template for file dog</p>
File 3 (list) can also contain url’s
If it contains a list off urls.
Example
http://www.microsoft.com
http://www.google.co.uk
http://www.yahoo.com
Then I must be able to use
http://www.microsoft.com
www.microsoft.com
microsoft.com
microsoft
In the template appending
A solution is to cut the string in parts so I can place the following
http://www.microsoft.com = %filename_full%
www.microsoft.com = %filename_www%
microsoft.com = %filename_ext”
microsoft = %filname% this one is used for the creation of the filename
that would be microsoft.html
Moet nog bij een beschrijving van als de list urls bevatten dat er een optie is
om de url http://www.microsoft.com zo af te drukken of
www.microsoft.com of
microsoft.com of
microsoft
In short its basicly that:
File3(list) a list of names or url’s that is used to create the name off the
new file created from the template.
File2(var) are variables that I place in my template file so the value
of these variables are replaced in the text off this template.
Where only %filename% and the %filename_xxxx% are the name or url from the File3(list)
File2(template) is simple the template with the variables so I can replicate them
with the values I have given in the Fil2(var) and the names or url’s from file3(list).
I need to write the name off the template, list and var file in a box or
maybe it can be placed in the var file, in short I have to be able to give the location and name.