summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2011-05-13 20:49:53 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2011-05-13 20:49:53 +0000
commit6a77761429c553827b6d9429a1a0580332e5f3bf (patch)
treeb7ca336293a34b05de9dd17d7f2e5a11691c2376
parenta342e1349d55273171dde77acbcb6d975bb2e46d (diff)
Open dialog when double-clicked (only for XP); cosmetic changes
git-svn-id: svn://tug.org/texlive/trunk@22458 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf/scripts/bitmap2eps/bitmap2eps.vbs39
1 files changed, 22 insertions, 17 deletions
diff --git a/Master/texmf/scripts/bitmap2eps/bitmap2eps.vbs b/Master/texmf/scripts/bitmap2eps/bitmap2eps.vbs
index 331b379badb..fbfc850e851 100644
--- a/Master/texmf/scripts/bitmap2eps/bitmap2eps.vbs
+++ b/Master/texmf/scripts/bitmap2eps/bitmap2eps.vbs
@@ -1,30 +1,34 @@
option explicit
On Error Resume next
-dim oWsh, oArgs, oFS, oTS, infile, outfile, f, c, result
+dim oWsh, oArgs, oFS, oDia, oTS, infile, outfile, f, c, result
-', oFS, oEnv, tlroot, script_path, Return, cmd
set oWsh = createobject( "wscript.Shell" )
Set oFS = CreateObject("Scripting.FileSystemObject")
-'Set oEnv = oWsh.Environment("PROCESS")
Set oArgs = wscript.arguments
-'tlroot = (oFS.GetParentFolderName(oFs.GetParentFolderName( _
-' oFS.GetParentFolderName(WScript.ScriptFullName))))
-'If Right(tlroot,1) <> "\" Then
-' tlroot = tlroot & "\"
-'End If
' assume sam2p and bmeps on searchpath
If oArgs.count = 0 Then
- messageBox "Nothing to do"
- wscript.quit
+ ' This appears to fail on win7: 'No file to convert' messagebox
+ Set oDia = CreateObject("UserAccounts.CommonDialog")
+ 'oDia.InitialDir = oWsh.SpecialFolders("MyDocuments")
+ oDia.filter = _
+ "Bitmaps|*.bmp;*.png;*.gif;*.bmp;*.jpg;*.jpeg;*.tif;*.tiff|All files|*.*"
+ oDia.filterindex = 1
+ oDia.flags = 1
+ If oDia.ShowOpen = False then
+ msgBox "No file to convert"
+ wscript.quit
+ End If
+ infile = oDia.filename
+ ' MsgBox "infile: " & infile
+Else
+ ' may have to flip slashes if the file was on a network drive !!!
+ infile = replace(oArgs(0), "/", "\")
+ infile = ofs.getabsolutepathname(infile)
End If
' name of output file
-
-' may have to flip slashes if the file was on a network drive !!!
-infile = replace(oArgs(0), "/", "\")
-infile = ofs.getabsolutepathname(infile)
outfile = ofs.buildpath(ofs.getparentfoldername(infile), _
ofs.getbasename(infile) & ".eps")
@@ -37,7 +41,7 @@ If ofs.fileexists(outfile) Then
oFS.deletefile(outfile)
Err.clear
If ofs.fileexists(outfile) Then
- MsgBox "Unable to memove old " & outfile, vbcritical
+ MsgBox "Unable to remove old " & outfile, vbcritical
wscript.quit
End If
End If
@@ -46,6 +50,8 @@ End If
' MsgBox "trying sam2p"
owsh.run "sam2p """ & infile & """ EPS: """ & outfile & """", 0
If Err Then
+ ' This is a failure of this script to start sam2p,
+ ' not just a failure of sam2p to do its job
MsgBox "Unspecified failure", vbcritical
wscript.quit
End If
@@ -72,8 +78,7 @@ Else
wscript.sleep(1000)
If ofs.fileexists(outfile) Then
result = True
- ' check the eps file.
- ' bmeps may have written an error message to it.
+ ' check the eps file; it may contain just an error mesage from bmeps
Set oTS = ofs.opentextfile (outfile, 1)
If Err Then
result = False