Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

FAQ.How do I get the printer name?
Answer: For Mac OS Classic see the code below and for Mac OS X use the Carbon Print Manager Classes from the MBS Plugin.
Example:
dim s as String
dim i as Integer

s=app.ResourceFork.GetResource("STR ",-8192)
if s<>"" then
i=ascb(leftb(s,1))
s=mid(s,2,i)

MsgBox s
end if
Notes:
A note from Craig Hoyt:

After looking at your example I had a little deja-vu experience. Several
years ago I played around with this same code if FutureBasic. I discovered
that it did not and still doesn't provide the 'Printer Name', it does
return the print driver name. If it returns 'LaserWriter 8' as the print
driver you can look into this file and get the 'PAPA' resource #-8192 to
get the actual Printer Name. Unfortunately this does not hold true for
other printers. My Epson and HP Printers (the Epson has an Ethernet Card
and the HP is USB) do not provide this info in their drivers. As far as I
can tell it only returns the name by polling the printer itself.

Feedback, Comments & Corrections




Links
MBS Xojo tutorial videos