/*
* JavaScript Windows ScriptingHost sample file to output .SVG and .HTML file
* usage cscript tryCscriptSVG.js
*
*
*/
var stdin = WScript.StdIn;
var stdout = WScript.StdOut;
/***************************************************
sec: String constants
****************************************************/
html_header = '\n'+
"\n"+
"\n"+
"
\n
try
\n\n"
html_footer = "\n\n\n"
header = '\n'
rect = ''
/***************************************************
sec: Comments
****************************************************/
/*
SVG Path -
The element is used to define a path.
The following commands are available for path data:
•M = moveto
•L = lineto
•H = horizontal lineto
•V = vertical lineto
•C = curveto
•S = smooth curveto
•Q = quadratic Bézier curve
•T = smooth quadratic Bézier curveto
•A = elliptical Arc
•Z = closepath
Note: All of the commands above can also be expressed with lower letters. Capital letters means absolutely positioned, lower cases means relatively positioned.
*/
/***************************************************
sec: Paths
****************************************************/
path = ''
path2 = ''
path3 = ''
fso = new ActiveXObject("Scripting.FileSystemObject");
var rx = 100
var ry = 100
/***************************************************
sec: Functions
****************************************************/
/*
Code explanation:
•The cx attribute defines the x coordinate of the center of the ellipse
•The cy attribute defines the y coordinate of the center of the ellipse
•The rx attribute defines the horizontal radius
•The ry attribute defines the vertical radius
*/
/* Yellow concentric discs */
function c(){
var cx = 100
var cy = 100
ry -= 10
rx -= 10
var opStr = '\n'
return opStr
}
/* Yellow concentric circles */
function c1(){
ry -= 10
rx -= 10
if ( n & mask ) {
var opStr = '\n'
} else {
var opStr = '\n'
}
mask = mask+mask
return opStr
}
var opStr = header
var rx = 100
var ry = 100
opStr += c()+c()+c()+c()+c()+c()+c()+c()+c()
var rx = 100
var ry = 100
var cx = 300
var cy = 100
n = 0x5A
mask=1
opStr += c1()+c1()+c1()+c1()+c1()+c1()+c1()+c1()+c1()
opStr += footer
function writeFile(){
var ForReading = 1, ForWriting = 2;
stdout.WriteLine( "outputting image " );
// Open the file for output.
var fop = fso.OpenTextFile(".\\tryCscriptSVG.svg", ForWriting, true);
if ( fop ) { fop.WriteLine( opStr ); }
if ( fop ) { fop.close(); }
var fop = fso.OpenTextFile(".\\tryCscriptSVG.html", ForWriting, true);
if ( fop ) { fop.WriteLine( html_header+opStr+html_footer ); }
if ( fop ) { fop.close(); }
}
writeFile()
/*
program to write circuit.
Grid:-
*/
/*
*/