Wonderware to Printer

tmcduffie

Member
Join Date
Jul 2016
Location
Florida
Posts
4
I'm a beginner to wonderware so excuse the ignorance, but I need to connect an InTouch application to an old Slip Printer. I've installed the drivers and configured the printer to one of the COM ports. I don't know how to create an Access that tags can be connected to. Any help would be greatly appreciated!
 
If I remember correctly, using the PrintScreen or PrintWindow quickfunctions will print to a default printer. I am pretty sure that for a ticketing system we have here, we create a window that looks like the ticket, and when conditions are met, we print it to that printer. I also believe that you can change what printer you use with QuickScript scripting, but I would have to get back with you on that.

I am sorry if I am misunderstanding your question or what you are trying to do.
 
PrintWindow() Function

In a script, you can print an InTouch window with the PrintWindow() function.

Syntax
[result = ] PrintWindow (windowname, leftmargin, topmargin, width, height, options);

Parameters
windowname

The name of the window to be printed. A literal string value, message tagname, or string expression.

leftmargin

Left margin offset (in inches). A literal numeric value, analog tagname, or numeric expression.

topmargin

Top margin offset (in inches). A literal numeric value, analog tagname, or numeric expression.

width

Printout width (in inches). Set this value to 0 for largest aspect ratio. A literal numeric value, analog tagname, or numeric expression.

height

Printout height (in inches). Set this value to 0 for largest aspect ratio. A literal numeric value, analog tagname, or numeric expression.

options

A discrete value, 0 or 1, that is only used if width and height are 0. A literal Boolean value, discrete tagname or Boolean expression. Set to:

1 - The window is printed with the largest aspect ratio that is an integer multiple of the window size.

0 - The window is printed with the largest aspect ratio that fits on the page.

Note If the window contains a bitmap, set options to 1 to prevent the bitmap from being stretched.
 
Last edited:
PrintScreen() Function

You can write a script to print the entire WindowViewer screen with the PrintScreen() function.

Syntax
PrintScreen (ScreenOption, PrintOption)

Parameters
ScreenOption

Determines how much of the WindowViewer screen is to be printed. A literal integer value, integer tagname, or integer expression.

1 - Print the client area, no menus (default)

2 - Print the entire window area, including menus

PrintOption

Determines how the printed image is to be stretched to fit on the printout.

1 - Best Fit:
image is stretched so that it fits either horizontally or vertically on the printout without changing the aspect ratio. (default)
2 - Vertical Fit:
image is stretched so that it fits vertically on the printout without changing the aspect ratio. The image may be cut off horizontally.
3 - Horizontal Fit:
image is stretched so that it fits horizontally on the printout without changing the aspect ratio. The image may be cut off vertically.
4 - Stretch to Page:
image is stretched so that it fits horizontally and vertically on the printout. The aspect ratio may change but the image is not truncated.
Invalid options, including 0, default to Best Fit.
Note Popup windows that extend beyond the WindowViewer screen area are cut off.

Example(s)
This script sends a printout of the current entire WindowViewer screen area without menus to the printer queue. The printout contains the screen area stretched so that it fills the printout dimensions.

PrintScreen(1,4);
 
Thanks Conor, that might be what I was looking for. For some reason when I try PrintWindow(); I get the error: "Expecting another operand", though I check documentation and it looks like that should be fine.
 
To print the complete window in best aspect:
PrintWindow( "Window", 0, 0, 0, 0, 0);

If the window has color and is using a lot of ink...
I usually make another "Window" and name it "Window Print".
Window Print I make with white background. When the user presses print button, I print the "Window Print" page.

For example....your window is named "Data", I make a duplicate window (using "save as") called "Data Print" and make its window color white.
When the user presses the print button on the "Data" window, I print the "Data Print" window.
 
To print the complete window in best aspect:
PrintWindow( "Window", 0, 0, 0, 0, 0);

If the window has color and is using a lot of ink...
I usually make another "Window" and name it "Window Print".
Window Print I make with white background. When the user presses print button, I print the "Window Print" page.

For example....your window is named "Data", I make a duplicate window (using "save as") called "Data Print" and make its window color white.
When the user presses the print button on the "Data" window, I print the "Data Print" window.

That's exactly how we do ours here, with a just a white background where the entire window is the size of what we are trying to print, in our case it's receipts/tickets. +1 to your post, Nathan.

tmcduffie, When it returns an error of "Expecting another operand", it's expecting some values that you didn't set. So in the example that Nathan used, each of those zeroes is a different parameter that can be set, most of them are offsets and what not, stuff you normally wouldn't have to set anyways. WonderWare is kind of funny about that, Like if you make your own QuickFunction, even though it doesn't have any arguments, it will still make you put a set of parenthesis at the end. For instance, if I have the quickfunction QuickFunction1, even though it doesn't have any arguments, It wont accept "CALL QuickFunction1;". It has to be "CALL QuickFunction1();". One of wonderware's funny little quirks.
 

Similar Topics

Hi, I have some problems with the alarm printer in wonderware intouch. There are alarms coming up on the printer but it is not coming up in the...
Replies
8
Views
3,155
i created bat file that activate alarm printer automaticly when the view screen come up.. but even the alarm printer is minimized the operator can...
Replies
1
Views
2,755
Hi, We are using wonderware intouch alarm printer to print out alarms to a dot matrix printer and to log to file and i have discovered a problem...
Replies
15
Views
12,723
Hi guys, I have experience with PLC to Excel etc...just starting on using intouch scada screens. I have an Excel sheet that uses mainly...
Replies
1
Views
129
Hello everyone, Recently, my Archestra IDE shut down while I was editing. After restarting the IDE, I noticed warning symbols under my opened...
Replies
1
Views
96
Back
Top Bottom