summaryrefslogtreecommitdiff
path: root/Master/bin
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2008-09-22 13:14:40 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2008-09-22 13:14:40 +0000
commitac8452266e5f940f88f1e39f742c7c557c9cd960 (patch)
tree2f8078c6aa97a85cdab643dfff0ef2805ec99640 /Master/bin
parent5f0d9b3637110e17ca3eda1bd3409c3982bebf28 (diff)
Dviout integration
git-svn-id: svn://tug.org/texlive/trunk@10686 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/bin')
-rw-r--r--Master/bin/win32/dviout.vbs125
1 files changed, 125 insertions, 0 deletions
diff --git a/Master/bin/win32/dviout.vbs b/Master/bin/win32/dviout.vbs
new file mode 100644
index 00000000000..79c411edfe2
--- /dev/null
+++ b/Master/bin/win32/dviout.vbs
@@ -0,0 +1,125 @@
+' Call dviout with an optional dvi-file parameter
+' and font search configuration parameters.
+
+option explicit
+On Error Resume Next
+
+dim oWsh, oEnv, oFS, oArgs, oExec, sTmp, bFirst
+Dim sTL, oTL, sGS, sCmd, oTmp, i, s
+
+set oWsh = wscript.createobject( "wscript.Shell" )
+Set oArgs = wscript.Arguments
+Set oEnv = oWsh.Environment( "PROCESS" )
+Set oFS = CreateObject("Scripting.FileSystemObject")
+
+If wscript.version < 5.6 Then
+ MsgBox "Need VBScript 5.6 or later. Aborting...", vbOKOnly+vbCritical, "Error"
+ Wscript.Quit
+Else
+ sTmp = ""
+ ' ask kpathsea
+ Set oExec = oWsh.Exec("kpsewhich -var-value=SELFAUTOPARENT")
+ sTmp = oExec.StdOut.ReadLine
+ Err.clear()
+ If sTmp <> "" then
+ sTL = replace(sTmp, "/", "\")
+ End If
+End If
+If sTL = "" Then
+ MsgBox "TeX Live not found; aborting...", vbOKOnly+vbCritical, "Error"
+ wscript.quit
+End If
+If InStr(sTL, " ") <> 0 Then
+ Set oTL = oFS.GetFolder(sTL)
+ sTL = oTL.ShortPath
+End If
+
+' Ghostscript environment settings
+sGS = sTL & "\tlpkg\tlgs"
+oEnv("PATH") = sGS & "\bin;" & oEnv("PATH")
+oEnv("GS_LIB") = sGS & "\fonts;" & sGS & "\lib;" & sGS & "\Resource"
+
+sCmd = sTL & "\dviout\dviout.exe -TEXROOT="
+
+'add font trees to command-Line
+
+'first make sure %TEXMFVAR%\fonts exists
+sTmp = ""
+' ask kpathsea
+Set oExec = oWsh.Exec("kpsewhich -var-value=TEXMFVAR")
+sTmp = oExec.StdOut.ReadLine
+If Not oFS.FolderExists(sTmp) Then
+ s = oFS.GetParentFolderName(sTmp)
+ If Not oFS.FolderExists(s) Then
+ Err.clear()
+ oFS.CreateFolder(s)
+ If Not oFS.FolderExists(s) Then
+ MsgBox "No place to put bitmaps; aborting...", _
+ vbOKOnly+vbCritical, "Error"
+ wscript.quit
+ End If
+ End If
+ oFS.CreateFolder(sTmp)
+ If Not oFS.FolderExists(sTmp) Then
+ MsgBox "No place to put bitmaps; aborting...", _
+ vbOKOnly+vbCritical, "Error"
+ wscript.quit
+ End If
+End If
+If Not oFS.FolderExists(sTmp & "\fonts") Then
+ Err.clear()
+ oFS.CreateFolder(sTmp & "\fonts")
+ If Not oFS.FolderExists(sTmp & "\fonts") Then
+ MsgBox "No place to put bitmaps; aborting...", _
+ vbOKOnly+vbCritical, "Error"
+ wscript.quit
+ End If
+End If
+
+
+Set oExec = oWsh.Exec("kpsewhich -show-path=tfm")
+sTmp = oExec.StdOut.ReadLine
+bFirst = True
+For Each s in Split(sTmp, ";", -1, 1)
+ s = Trim(s)
+ If s<>"." Then
+ If InStr(s, "!!")=1 Then
+ s = Mid(s, 3)
+ End If
+ i = InStr(s, "/fonts/tfm")
+ If i<>0 then
+ s = Mid(s, 1, i+5)
+ Else
+ s=""
+ End If
+ s = Trim(s)
+ If s<>"" then
+ s = replace(s, "/", "\")
+ If oFS.FolderExists(s) Then
+ If InStr(s," ")<>0 Then
+ Set oTmp = oFS.GetFolder(s)
+ s = oTmp.ShortPath
+ End If
+ If Not bFirst Then
+ sCmd=sCmd & ";"
+ Else
+ bfirst=False
+ End If
+ sCmd = sCmd & s
+ End If
+ End If
+ End If
+Next
+sCmd = sCmd & " -TEXPK=""^r\pk\\^s.^dpk;^r\tfm\\^s^tfm;" & _
+ "^r\vf\\^s.vf;^r\ovf\\^s.ovf;^r\tfm\\^s.tfm"""
+
+' assume argument either short or already quoted
+If (oArgs.length > 0) Then
+ For i = 0 To (oArgs.length - 1) Step 1
+ sCmd = sCmd & " " & oArgs(i)
+ Next
+End If
+
+' 2nd arg 1: normal window
+oWsh.run sCmd, 1
+'wscript.echo sCmd \ No newline at end of file