Print a label?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Print a label?

Post by pgriffin » Mon Aug 15, 2005 5:07 pm

I'd like to prompt the user for an Address ID number (easy enough) then call some SQL code (also easy to do) show the address to the user (probably in an MDL) then (here's the part I am not sure how to do in MacroSched) Let the user choose a printer and send the formatted output to that printer.

Do I use VBScript for the printing portion of this?

SkunkWorks

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Aug 15, 2005 6:36 pm

Easiest way is to use WriteLn to write the text to a .txt file and use Notepad:

Let>RP_WAIT=1
Run>Notepad /p %filename%

That will print to the default printer. You can show a list of printers and set/change the default with VBscript. There's an example here:
http://www.mjtnet.com/forum/viewtopic.php?t=1465

Or how about just open the file in Notepad, send keystrokes to invoke the print dialog and leave it to the user to select a printer and hit ok. Wait for the print window to close and then close Notepad and continue with the script?

There are probably other ways to do it in VBScript using the FileSystem object. You could also maybe use the DOS PRINT command or just COPY the file to the printer device. But why bother with all that when the above works fine and is nice and easy?
MJT Net Support
[email protected]

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts