I don't really know how to phrase what it is that i want but I hope
that someone understands what I'm trying to do.

I can generate a input file that will look something like this:

T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3282kmg01s1
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3293kmg01s1
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3304kmg01s1
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3315kmg01s1
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3326kmg01s1
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3585kmg01s1

and generate a .bat file that will look like this:

start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
Plots Data\dA3532kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3532kmg01s1.pdf
pause
start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
Plots Data\dA3536kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3536kmg01s1.pdf
pause
start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
Plots Data\dA3540kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3540kmg01s1.pdf
pause
start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
Plots Data\dA3544kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3544kmg01s1.pdf
pause
start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
Plots Data\dA3548kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3548kmg01s1.pdf
pause

Re: Using Script from Input File to Write Output File by James

James
Thu Jan 24 21:54:11 CST 2008

"Paul" <izzo.paul@gmail.com> wrote in message
news:6db25065-b4cd-43ac-8b8b-ed4a4705dfd0@f47g2000hsd.googlegroups.com...
>I don't really know how to phrase what it is that i want but I hope
> that someone understands what I'm trying to do.
>
> I can generate a input file that will look something like this:
>
> T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3282kmg01s1
> T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3293kmg01s1
> T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3304kmg01s1
> T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3315kmg01s1
> T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3326kmg01s1
> T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3585kmg01s1
>
> and generate a .bat file that will look like this:
>
> start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
> Plots Data\dA3532kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3532kmg01s1.pdf
> pause
> start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
> Plots Data\dA3536kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3536kmg01s1.pdf
> pause
> start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
> Plots Data\dA3540kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3540kmg01s1.pdf
> pause
> start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
> Plots Data\dA3544kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3544kmg01s1.pdf
> pause
> start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
> Plots Data\dA3548kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3548kmg01s1.pdf
> pause

I think I understand.

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Option Explicit
Dim oFSO, sInpFile, sOutFile, sBatchLine, sInpLine
Dim sOutLine, oInpFile, oOutFile

Set oFSO = CreateObject("Scripting.FileSystemObject")

sInpFile = "Input.txt"
sOutFile = "Output.bat"
sBatchLine = "start C:\Isoplotec\PloView\PloView.exe /p " _
& "§InpLine§ T:\CMM\Zeiss Data\PDF Plots\§FileName§.pdf"

Set oInpFile = oFSO.OpenTextFile(sInpFile, 1)
Set oOutFile = oFSO.OpenTextFile(sOutFile, 2, True)

Do Until oInpFile.AtEndOfStream
sInpLine = oInpFile.ReadLine
If Len(Trim(sInpLine)) > 0 Then
sOutLine = Replace(sBatchLine, "§InpLine§", sInpLine)
sOutLine = Replace(sOutLine, "§FileName§", _
oFSO.GetFileName(sInpLine))
sOutLine = sOutLine & vbNewLine & "pause"
oOutFile.WriteLine sOutLine
End If
Loop
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Re: Using Script from Input File to Write Output File by axtens

axtens
Thu Jan 24 22:17:24 CST 2008

On Jan 25, 10:47 am, Paul <izzo.p...@gmail.com> wrote:
> I don't really know how to phrase what it is that i want but I hope
> that someone understands what I'm trying to do.

Okay, given plots.dat containing

T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3282kmg01s1
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3293kmg01s1
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3304kmg01s1
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3315kmg01s1
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3326kmg01s1
T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3585kmg01s1

this bit of vbscript, in plots.vbs,

option explicit

dim oFSO
set oFSO = CreateObject( "Scripting.FileSystemObject" )

dim oInStream
dim oOutStream

set oInStream = oFSO.OpenTextFile( "plots.dat", 1, false )
set oOutStream = oFSO.CreateTextFile( "plots.bat", true )

dim sInLine
const sTemplate = "start C:\Isoplotec\PloView\PloView.exe /p ""$F$""
""$F$.pdf""$N$pause"

dim sOutLine

do while oInStream.AtEndOfStream <> True
sInLine = oInStream.ReadLine
sOutLine = Replace( sTemplate, "$F$", sInLine )
sOutLine = Replace( sOutLine, "$N$", vbNewLine )
oOutStream.WriteLine sOutline
loop

oInStream.Close
oOutStream.Close


gives this as plots.bat

start C:\Isoplotec\PloView\PloView.exe /p "T:\CMM\Zeiss Data\HPGL
Large Plots Data\dA3282kmg01s1" "T:\CMM\Zeiss Data\HPGL Large Plots
Data\dA3282kmg01s1.pdf"
pause
start C:\Isoplotec\PloView\PloView.exe /p "T:\CMM\Zeiss Data\HPGL
Large Plots Data\dA3293kmg01s1" "T:\CMM\Zeiss Data\HPGL Large Plots
Data\dA3293kmg01s1.pdf"
pause
start C:\Isoplotec\PloView\PloView.exe /p "T:\CMM\Zeiss Data\HPGL
Large Plots Data\dA3304kmg01s1" "T:\CMM\Zeiss Data\HPGL Large Plots
Data\dA3304kmg01s1.pdf"
pause
start C:\Isoplotec\PloView\PloView.exe /p "T:\CMM\Zeiss Data\HPGL
Large Plots Data\dA3315kmg01s1" "T:\CMM\Zeiss Data\HPGL Large Plots
Data\dA3315kmg01s1.pdf"
pause
start C:\Isoplotec\PloView\PloView.exe /p "T:\CMM\Zeiss Data\HPGL
Large Plots Data\dA3326kmg01s1" "T:\CMM\Zeiss Data\HPGL Large Plots
Data\dA3326kmg01s1.pdf"
pause
start C:\Isoplotec\PloView\PloView.exe /p "T:\CMM\Zeiss Data\HPGL
Large Plots Data\dA3585kmg01s1" "T:\CMM\Zeiss Data\HPGL Large Plots
Data\dA3585kmg01s1.pdf"
pause


Hope that helps.

Kind regards,
Bruce.

Re: Using Script from Input File to Write Output File by Tom

Tom
Fri Jan 25 07:43:55 CST 2008

On Jan 24, 6:47 pm, Paul <izzo.p...@gmail.com> wrote:
> I don't really know how to phrase what it is that i want but I hope
> that someone understands what I'm trying to do.
>
> I can generate a input file that will look something like this:
>
> T:\CMM\Zeiss Data\HPGL Large Plots Data\dA3282kmg01s1
{snip}
>
> and generate a .bat file that will look like this:
>
> start C:\Isoplotec\PloView\PloView.exe /p T:\CMM\Zeiss Data\HPGL Large
> Plots Data\dA3532kmg01s1 T:\CMM\Zeiss Data\PDF Plots\dA3532kmg01s1.pdf
> pause
{snip}

Question? Would a 'pure' VBScript solution that performs the same
actions as the batch work for you, instead of just creating a batch
file as the output?

For example, maybe something like this ...

sInpFile = "Input.txt"
with CreateObject("Scripting.FileSystemObject")
aInput = split(.OpenTextFile(sInpFile, 1).ReadAll, vbNewline)
end with

sCmd = "C:\Isoplotec\PloView\PloView.exe /p "
sInMask = "HPGL Large Plots Data"
sOutMask = "PDF Plots"
with CreateObject("Wscript.Shell")
for each sLine in aInput
sOutFile = Replace(sLine, sInMask, sOutMask) & ".pdf"
.run sCmd& chr(34) & sLine& chr(34) & " " _
& chr(34) & sOutFile & chr(34), 0, true
wsh.echo sLine
next
end with

BTW, why the 'pauses' after each translation? Is that to cause the
next translation to wait for the previous one to end? If so, you
should be able to remove the PAUSE and add the /WAIT switch to the
'START' part of the command in the batch. Then it would operated
sequentially without requiring user interaction after each
translation. In the VBScript version, just remove the WSH.ECHO line
or else run it at the command prompt under cscript.exe.

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/