コマンドラインでPDFファイルを印刷する。
/cjsオプションが7.0で追加されたものの、8.1で廃止されたので、スクリプト。
Adobe Reader 6.0 - 8.1 用
PDF印刷.VBS PDFファイル...
Set fso=CreateObject("Scripting.FileSystemObject")
Set wShell=CreateObject("WScript.Shell")
Path=wShell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\acrord32.exe\")
Path=Replace(Path,"""","")
Path=wShell.ExpandEnvironmentStrings(Path)
Printer=Split(wShell.RegRead("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"),",")(0)
Set PDF=CreateObject("AcroExch.Document")
For Each File In WScript.Arguments
File=fso.GetFile(File).Path
' Set PDF=GetObject(File)
wShell.Run """"&Path&""" /n /t """&File&""" """&Printer&"""",,True
Next
Adobe Reader 7.0 - 8.1 用
PDF印刷.VBS PDFファイル...
Set fso=CreateObject("Scripting.FileSystemObject")
Set wShell=CreateObject("WScript.Shell")
Path=wShell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\acrord32.exe\")
Path=Replace(Path,"""","")
Path=wShell.ExpandEnvironmentStrings(Path)
Set PDF=CreateObject("AcroExch.Document")
For Each File In WScript.Arguments
File=fso.GetFile(File).Path
' Set PDF=GetObject(File)
wShell.Run """"&Path&""" /n /t """&File&"""",,True
Next
/tオプションは、他にAdobe Readerがないと、終了せずに残ります。
CreateObject("AcroExch.Document")や、GetObject(File)で、
Adobe Readerが起動し、参照の解放で終了することを利用します。
もし、CreateObjectが使えないときは、GetObjectに変えてください。
GetObjectだと、ちょっと遅いかも。
« Adobe Reader 8.1の起動オプション(その2) | トップページ | コマンドラインでPDFファイルを印刷する。(その2) »