Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attachmate Extra Printer Session Automation

Status
Not open for further replies.

Mikemix

Programmer
Feb 25, 2003
5
0
0
US
Hi, I am trying to read the status of a printer session in order to automate downloading reports using Excel VBA.
I have been so far unsuccessful in retrieving the OIA (operator information) area or presentation space of a print session with OLE and ehlapi32.dll API to inquire if the session is "idle" (Finished downloading a report).
I want to capture the "Device busy" bit in Byte 90 of the OIA string so I my program will know when the printer session is not busy so I can send the next print job to the printer session.
Ideally, I would also like to capture the page count in a variable that is displayed in the printer session window as well to kept track of the number of pages printed.

My printer session connects via a SNA connection using LU3.
Any help would be greatly appreciated.


'My Excel VBA code
'Make a worksheet named "HLL_Test"

'- Declarations -
Private Declare Function HLLAPI Lib "C:\Program Files\Attachmate\E!E2K\ehlapi32.dll" (Func&, ByVal DataStr$, DataLgth&, Retc&) As Long


Sub HLL()
WkBkName_Prgm = ActiveWorkbook.Name
Set WksHLLTest = Workbooks(WkBkName_Prgm).Worksheets("HLL_Test")

'Connect to printer session "A"
Call HLLAPI(1, "A", 1, Retc)
WksHLLTest.Cells(1, 1).Value = Retc 'Display returned Code in excel sheet Cell A1

'Get OIA
DataLgth = 103
rc = 0
Call HLLAPI(13, DataStr, DataLgth, rc)

WksHLLTest.Cells(1, 2).Value = rc 'Display OIA returned Code in Excel sheet Cell A2
WksHLLTest.Cells(1, 3).Value = DataStr 'Display returned OIA data string in Cell A3

End Sub



***** EHLLAPI LANGUAGE REFERENCE *****
Prepared by Attachmate Technical Support 104
Group 8: Input inhibited
This group consists of bytes 89 through 93 in the OIA data, and indicates why input
is inhibited in the current PS.
Byte# / Bit# Description
Byte 1 (89)
0 Non–resettable machine check
1 Reserved for security key
2 Machine check
3 Communications check
4 Program check
5 Retry
6 Device not working
7 Device very busy
Byte 2 (90)
0 Device busy
1 Terminal wait
2 Minus symbol
3 Minus function
4 Too much entered
5 Not enough entered
6 Wrong number
7 Numeric field
Byte 3 (91)
0 Reserved
1 User not authorized
2 User not authorized (minus function)
3 Invalid dead key combination
4 Wrong place
5-7 Reserved
Byte 4 (92)
0 Message pending
1 Partition wait
2 System wait
3 Hardware mismatch
4 Logical terminal not configured at control unit
5-7 Reserved
Byte 5 (93)
0 Autokey inhibit
1 Application program has inhibited operator input
2-7 Reserved
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top