Announcement

Collapse
No announcement yet.

Batch command

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • alanc007
    replied
    Morning,
    I as well had similiar issues and went down the following path Contained within my Provided code, but im have an even larger issue. My application was designed to run as a service under windows. When i try to run the conatined code i get Squat.... if the app is running as a desktop app everything work great. Any thought as to why i might not be able to execute the print from under a Service would be extremely helpful.
    thanks..
    Code below.........
    Dim nHandle
    Dim vFilePath
    Dim vPrinterName
    Dim vPrinterIP
    Dim vFoxitPath
    Dim vFoxitStatement
    Dim vSwitches
    Dim vStatement
    Dim vFileToFind,vFileFoundName,vBoxFileToFind,vLitFile ToFind
    Dim vPatientNum,vStage,vAlignerType
    'The code configured here is executed while the condition configured in the Execution field is TRUE.
    'Inform The Beginning Of The Script
    funcLog 1,"Print Bag labels","Script starting"

    'Clear Print Que Buckets on First Entry To Prevent Double Printing
    $MultiVac.hiReprintLabels = 0
    $MultiVac.iPrintLBLReq = 0

    'Define Print Variables
    vFoxitStatement = """Foxit Reader.exe"""
    vSwitches = "/t "
    vPrinterName = "BAG"
    'Hack Remove Once Real Data is Presented
    $cPouch[2].FULLAID = "171517409N"
    '$cPouch[36].FULLAID = "2561298U01N"
    $cPouch[2].SalesOrder = 1715174
    '$cPouch[36].SalesOrder = 6310865
    'Hack End

    ' Check that The Actual Print Request Was Initiated
    If $MultiVac.hoPrintLabelLoad Then
    'vPatientNum =
    funcLog 1,"Print Bag labels","Parsing The bag Print request For FULLAID->" +CStr($cPouch[2].FULLAID)
    vStage = $StrLeft($StrRight($StrRight($cPouch[2].FULLAID,$Strlen($cPouch[2].FULLAID)),3),2)
    vAlignerType = $StrLeft($StrRight($StrRight($cPouch[2].FULLAID,$Strlen($cPouch[2].FULLAID)),1),1)
    ' lets Check to make sure the Requested File Exists
    vFileToFind = $AppConfig.PDFFILESPATH +"\"+CStr($cPouch[2].SalesOrder)+"\"+CStr($cPouch[2].SalesOrder)+""+CStr(vStage)+CStr(vAlignerType)+". pdf"
    $SQLSTRINGTEST = vFileToFind
    $bFileExists = $FindFile(vFileToFind,"vBagFoundName",1000)
    $vPrintString = vFileToFind
    If $bFileExists Then
    vPrinterIP = "\\127.0.0.1\"
    Select Case $MultiVac.hoPrintLabel
    Case 0 'temp Holder
    vFilePath = """"&CStr(vFileToFind)&""""
    Case 1
    vFilePath = """"&CStr(vFileToFind)&""""
    Case 2
    vFilePath = """D:\PRINTFILES\REJECT FILES\RejectMissingAligner.pdf"""
    Case 3
    vFilePath = """D:\PRINTFILES\REJECT FILES\RejectMissingLabel.pdf"""
    Case 4
    vFilePath = """D:\PRINTFILES\REJECT FILES\RejectUnloadableBag.pdf"""
    Case 5
    vFilePath = """D:\PRINTFILES\REJECT FILES\RejectUnloadableBag.pdf"""
    Case Else
    vFilePath = """D:\PRINTFILES\REJECT FILES\RejectMissingLabel.pdf"""
    End Select
    Else
    vFilePath = """D:\PRINTFILES\REJECT FILES\RejectMissingLabel.pdf"""
    End If
    $bFileExists = 0
    End If
    'create the Print Statement for the Method to use it
    vStatement = vFoxitStatement+" "+vSwitches+ " " +vFilePath
    $MyTrigger = 1
    'Call the method to Globals to Que the Print
    funcPrintPDF vPrinterName, vStatement

    ' Set the Bit Loaded based on Who Called the Method
    $MultiVac.hiBagFileLoaded = 1

    'Clear our fso Object to Prevent memory leaks.
    $vBagFoundName = ""

    'Inform The End Of The Script
    funcLog 1,"Print Bag labels","Script Completed"

    '************************************************* ***********************************
    Function funcPrintPDF (sPrinter, vStatement)
    'Description: Read 01 print a PDF file to The Default Printer
    'Function Number: 13
    'Parameters:
    'External Variables:
    'Comments:

    'History:
    ' 31 Jan 2013 - Creation of the Function by Alan Cannon

    'Variable Declaration
    Dim objshell
    Dim vFoxitCDPath

    'Set The Default printer by Caller
    If sPrinter <> $AppConfig.Curr_Printer Then
    funcSetDefprinter sPrinter
    End If
    'Defined path to the PDF Printing Agent
    vFoxitCDPath = "C:\Program Files (x86)\Foxit Software\Foxit Reader\"
    'Inform the Start of the Funciton Execution
    funcLog 1,"funcPrintPDF","Execution Started"
    Set objshell = CreateObject("WScript.Shell")
    objshell.CurrentDirectory = vFoxitCDPath
    objshell.Run ""&CStr(vStatement)&""
    funcLog 1,"funcPrintPDF","Statement Was->" +vStatement
    Set objshell = Nothing
    'Inform the End of the Funciton Execution
    funcLog 1,"funcPrintPDF","Execution Finish"

    End Function
    '************************************************* ***********************************

    Leave a comment:


  • drjonesx
    replied
    Oke richell

    But it's doesn't work the ip of the computer where the printer is installed ans sahred is 192.168.1.100
    So the path have to look like this right?

    "C:\Program Files (x86)\Foxit Software\Foxit Reader\Foxit Reader.exe" /t "..\PDF\doc.pdf" "\\192.168.1.100\oki microline 1120"
    But when i do this nothing print

    We are agree that the ip of the printer share is the ip of the computer where the printer is install with cable right?
    We are agree that on each computer i have to install the share printer + foxit pdf reader?

    Hope u help me to find a solution for this problem

    Leave a comment:


  • richell_huang
    replied
    As cherry said, it’s required to specify the full path for the printer. For instance:
    "c:\foxit reader.exe" /t "c:\user\11.pdf" \\192.168.0.160\hp color laserjet 3800 ps

    Leave a comment:


  • drjonesx
    replied
    Thanks for your answers but when i m using the share printer i used this code

    @ECHO OFF
    "C:\Program Files (x86)\Foxit Software\Foxit Reader\Foxit Reader.exe" /t "..\PDF\doc.pdf" "\\Serveur-hp\oki microline 1120"
    But my problem is if the printer is not the default printer, it doesn't work!
    Where did i made a mistake?
    Is a way to used it whit a non defaut printer?

    thanks alot for your precious help

    Leave a comment:


  • lsystems
    replied
    You could use the /p option instead to print to the default printer, i.e:-

    "C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe" /p k:\reports\5.pdf

    Leave a comment:


  • cherry
    replied
    To print to a network with /t command line utility, it’s required to specify the full path for the printer. For instance:
    "c:\foxit reader.exe" /t "c:\user\11.pdf" \\192.168.0.160\hp color laserjet 3800 ps

    Please help to check the printer name again. Currently it doesn't support the mentioned printing parameters (scaling, auto center,...)

    Leave a comment:


  • drjonesx
    started a topic Feature Batch command

    Batch command

    Hi everyone
    It's my first post and i trying after reading here to create a batch print
    But it doesn't work

    Here is my command line and i don't see what is wrong
    @ECHO OFF
    "C:\Program Files (x86)\Foxit Software\Foxit Reader\Foxit Reader.exe" /t "c:\test.pdf" \\192.168.0.199\Oki ML3390
    I tried also
    @ECHO OFF
    "C:\Program Files (x86)\Foxit Software\Foxit Reader\Foxit Reader.exe" /t "c:\test.pdf" Oki ML3390
    but those two examples doesn't work
    When i don't give a printer name it's work but doesn't take the good printer
    @ECHO OFF
    "C:\Program Files (x86)\Foxit Software\Foxit Reader\Foxit Reader.exe" /t "c:\test.pdf"
    Is there a way to make it work in a local environnement or in a lan?
    Is there a place where a ican find examples?
    Last question it's also possible to choice other paramaters as scaling, auto center,...?

    Thanks for your precious help and sorry for my bad english
Working...
X