2012-10-23 6 views
0

임 난 내 VBS 스크립트를 실행하려고하면이 오류가 발생,VBS 스크립트 오류

개체가이 속성 또는 메서드를 지원 나던

내 VBS 코드는

Rem -- This example will show you how to create a very simple runonce configuration. 

Rem -- Get current path of this script. 
Set fso = CreateObject("Scripting.FileSystemObject") 
currentdir = fso.GetAbsolutePathName(".") 

Rem -- Read the info xml 
Set xmldom = CreateObject("MSXML.DOMDocument") 
xmldom.Load("c:\Montupet\PDF" & "\info.xml") 

Rem -- Get the program id of the automation object. 
progid = xmldom.SelectSingleNode("/xml/progid").text 

Rem -- Create the COM object to control the printer. 
set obj = CreateObject(progid) 

Rem -- Get the default printer name. 
Rem -- You can override this setting to specify a specific printer. 
printername = "PDF Writer - bioPDF" 

runonce = obj.GetSettingsFileName(true) 
      ^
       Error here 


set oArgs=wscript.Arguments 

Rem -- Print all the files in the 'in' folder 

dim file_name, template 
dim command_line_args 

set command_line_args = wscript.Arguments 

'Check if any Arguments have been passed to our script. 
if command_line_args.count > 0 then 
file_name = command_line_args(0) 
template = command_line_args(1) 

Set oWd = CreateObject("Word.Application") 
oWd.Visible = False 
wordname = """" & "c:\MTMS\MTMSPRT\" & file_name & """" 
    wscript.echo wordname 
Set oDoc = oWd.Documents.Open(wordname) 
    Set oPS = oDoc.PageSetup 

    ' Reduce the margins to .5" (36 points) 
oPS.LeftMargin = 8.4 
    oPS.RightMargin = 0.2 

'Save changes to doc on closing and quit Word 
oDoc.Saveas wordname , 0 
wscript.echo "Saved" 
oDoc.Close 
wscript.echo "close" 
oWd.Quit 
wscript.echo "Quit" 
Set oWd = Nothing 
Set objShell = Nothing 

wscript.echo "Cleared Word" 
Set oWd = Nothing 
Set objShell = Nothing 




output = "c:\MTMS\MTMSPRT\PDFs\" & Replace(ucase(file_name), "DOC", "") & "PDF" 

Rem -- Set the values 
obj.Init 
obj.SetValue "Output", output 
obj.SetValue "ShowSettings", "never" 
obj.SetValue "ShowPDF", "no" 
obj.SetValue "ShowProgress", "no" 
obj.SetValue "ShowProgressFinished", "no" 
obj.SetValue "SuppressErrors", "no" 
obj.SetValue "ConfirmOverwrite", "no" 
obj.SetValue "superimpose", template 



Rem -- Write settings to the runonce-Invoice.ini 
obj.WriteSettings True 
wscript.echo "runonce created" 
Rem -- Print the document 
printfile = "c:\MTMS\MTMSPRT\" & file_name 
cmd = """" & "c:\Montupet\PDF\printto.exe"" """ & printfile & """ """ &  printername & """" 
wscript.echo "printfile line setup" 
Set WshShell = WScript.CreateObject("WScript.Shell") 
ret = WshShell.Run(cmd, 1, true) 
wscript.echo "shell run start" 
Rem -- Wait until the runonce is removed. 
Rem -- When the runonce is removed it means that the gui.exe program 
rem -- has picked up the print job and is ready for the next. 
While fso.fileexists(runonce) 
wscript.echo "checking for runonce" 
    Rem -- Wait for some milliseconds before testing again 
    wscript.sleep 100 
Wend 
wscript.echo "runonce gone" 
end if 

Rem -- Dispose the printer control object 
set obj = Nothing 
+0

'set obj = CreateObject (progid)'의 progid는 무엇입니까? 생성 된 객체가'GetSettingsFileName()'메소드를 지원합니까? –

+0

무엇을 의미합니까? –

+0

'set obj = CreateObject (progid)'줄에서'progid'의 값은 무엇입니까? –

답변

1

는 판단이다 에 의해 this blog post for VB6,

runonce = obj.GetSettingsFileName(true) 

대신 BioPDF 웹 사이트가 더 도움이 수도 reference

runonce = obj.GetSettingsFilePath(true) 

해야한다.

관련 문제