All:
 
Here's the significant part of a script that I run nearly daily.  I've never had a problem with the printer choice.
 
Good luck!
 
Ernest
L&M Hospital
New London, CT
=====
    Pause "MIS Main Menu"
 
    ' Select the Spooling Menu.
    Enter "22"
 
    ' List the spool files.
    Note = "Listing spooled jobs ..."
 
    Pause "MIS Spooling Menu", "11~"
 
    ' BEGINNING is the default.
    Pause "From Spool File", "~"
 
    ' END is the default.
    Pause "To Spool File", "~"
 
    ' Make sure we download the report, no matter what the user wanted before.
    Pause "Print on", "DOWNLOAD~"
 
    ' What shall we suppress?
    Pause "Suppress", Chr(8) & "B~" ' Both page banners and form feeds.
 
    ' Calculate the name of the output file.
    ' First, get the date.
    sTemp = Date$
    ' Then parse the date, creating the file name "spool_all_YYMMDD.txt".
    sTemp2 = "spool_all_" & right(sTemp, 2) & Left(sTemp, 2) & Mid(sTemp, 4, 2) & ".txt"
    ' Now prepend a complete path.
    sTemp = "C:\Ernest\"
    sTemp2 = sTemp & sTemp2
 
    ' Clear the error flags.
    Err.Clear
    iTemp = 0 ' Set the counter to avoid an infinite loop.
 
    On Error Resume Next
    ' Make the Windows dialog box the active control.
    Activate "Save As"
 
' labelSpoolPreLoop:
    Do While True
        ' If we get into an essentially infinite loop, break out.
        If 27 = iTemp Then
            Exit Do
        End If
 
        If 0 = Err Then
            Err.Clear
            Exit Do
        End If
 
        If -2147463162 = Err.Number Then 'automation error
            Wait 1
            Err.Clear
            Activate "Save As"
            iTemp = iTemp + 1
        Else
            Err.Raise Err
            Exit Do
        End If
    Loop
 
    ' Either the Windows "Save As" dialog is active or we've errored out.
    Wait 1
 
    On Error GoTo 0
 
    ' Send the name of the output file.
    SendKeys sTemp2 & "~", True
 
    Wait 3
 
    sTemp = View()
    sTemp2 = View(, , 1, -5, 5)
 
    If At("Yes") Then
        SendKeys "Y", True
        Wait 1
    End If
    At ""
 
    If At("No") Then
        SendKeys "Y", True
        Wait 1
    End If
    At ""
 
    If At("replace it") Then
        SendKeys "Y", True
        Wait 1
    End If
    At ""
 
    ' After the report has been downloaded, back out ...
    Pause "End of report", "~"
 
    Note = "Finished listing spooled jobs."
 
    ' ...
    Pause "MIS Spooling Menu", "~"
 
    ' ... until we're at the common point.
    Pause "MIS Main Menu"
-----Original Message-----
From: Andy Griffin [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 30, 2004 2:45 PM
To: [EMAIL PROTECTED]
Subject: [Talk] Choosing a printer

I have my script written for a Meditech report with just one minor problem. When the print destination window appears, I cannot tab down to choose the printer I want to use. How is everyone else choosing a printer?

 

Thanks in advance,

 

Andy Griffin

Data Analyst

EMRMC

859.239.3429

 

Reply via email to