/* * JavaScript Windows ScriptingHost sample file * usage cscript tryCscriptSVG.js * * * this could be useful. I could use this insteal of Awk. */ var stdin = WScript.StdIn; var stdout = WScript.StdOut; /*************************************************** ****************************************************/ header = '<svg width="580" height="400" xmlns="http://www.w3.org/2000/svg"><g>' footer = '</g></svg>' rect = '<rect height="100.48" width="260.67" y="195.22" x="244.85" stroke-width="1.5" stroke="#000" opacity="0.5" fill="#7fff00" id="svg_68"/>' /* SVG Path - <path> The <path> 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. */ path = '<path d="m66.34665,193.77779c-1.63545,103.43126 253.72461,-88.90665 147.05779,-90.5067c-106.66684,-1.60004 137.36858,185.88452 137.38658,84.05342c0.01801,-101.8311 -284.4621,129.27995 -138.98665,124.42653c145.47548,-4.85342 -143.82227,-221.40435 -145.45772,-117.97325z" stroke-width="5" stroke="#000000" fill="#ff0000" opacity="0.5" id="svg_1"/>' path2 = '<path d="m100,100c-1.63545,103.43126 253.72461,-88.90665 147.05779,-90.5067c-106.66684,-1.60004 137.36858,185.88452 137.38658,84.05342c0.01801,-101.8311 -284.4621,129.27995 -138.98665,124.42653c145.47548,-4.85342 -143.82227,-221.40435 -145.45772,-117.97325z" stroke-width="5" stroke="#000000" fill="#ff0000" opacity="0.5" id="svg_1"/>' path3 = '<path d="m100,100" stroke-width="5" stroke="#000000" fill="#ff0000" id="svg_1"/>' var opStr = header+rect+path+path2+footer fso = new ActiveXObject("Scripting.FileSystemObject"); 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(); } } writeFile() /* program to write circuit. Grid:- */ /* <svg width="521" height="392" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> <!-- Created with SVG-edit - https://github.com/SVG-Edit/svgedit--> <g> <title>Layer 1</title> <rect height="323.64" width="449.09" y="34.985" x="36.14" stroke-width="5" stroke="#000000" fill="#ff7f00" opacity="0.5" id="svg_1"/> <ellipse ry="31.815" rx="33.185" cy="34.99" cx="35.685" stroke-width="5" stroke="#000000" fill="#ffff00" opacity="0.5" id="svg_2"/> <ellipse ry="31.815" rx="33.185" cy="357.935" cx="485.68" stroke-width="5" stroke="#000000" fill="#ffff00" opacity="0.5" id="svg_3"/> <ellipse ry="31.815" rx="33.185" cy="34.315" cx="485.69" stroke-width="5" stroke="#000000" fill="#ffff00" opacity="0.5" id="svg_4"/> </g> </svg> <svg width="640" height="480" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> <!-- Created with SVG-edit - https://github.com/SVG-Edit/svgedit--> <g> <title>Layer 1</title> <rect height="323.64" width="449.09" y="74.075" x="104.32" stroke-width="5" stroke="#000000" fill="#ff7f00" opacity="0.5" id="svg_1"/> <ellipse ry="31.815" rx="33.185" cy="72.27" cx="102.045" stroke-width="5" stroke="#000000" fill="#ffff00" opacity="0.5" id="svg_2"/> <ellipse ry="31.815" rx="33.185" cy="398.845" cx="552.95" stroke-width="5" stroke="#000000" fill="#ffff00" opacity="0.5" id="svg_3"/> <ellipse ry="31.815" rx="33.185" cy="73.405" cx="553.87" stroke-width="5" stroke="#000000" fill="#ffff00" opacity="0.5" id="svg_4"/> </g> </svg> */