Some content on this site is available only to logged-in subscribers. Contact Us for information on becoming a subscriber.

InSource.Solutions | InSource Training | InSource Client Portal
InSource Solutions Logo
Log In Sign Up
InSource.Solutions InSource Training InSource Client Portal Log In Sign Up
  • Home
  • AVEVA Application Server
  • AVEVA Application Server Tech Notes

How to print a text file to an external printer from within a Wonderware Application Server script

Last updated: March 5th, 2025

Description

  • Author: Joe Hefner
  • Published: March 5th, 2025

Details:

Description

This article from InSource walks through an approach for printing a file to an external printer from within a Wonderware Application Server script.

  • Author: Joseph Hefner
  • Published: 7/15/2016
  • Application Server 2012 and above

Details

This approach has been tested but may not work in every scenario.

Step 1: Create an application server object and an attribute to trigger the script. In the example below, the object and script are both called PrintFile:

Step 2: Create the script to print the file. In order for this script to work, the printer you wish to print to will need to be setup as the default printer. In this example, I am using the attribute created in Step 1. In this example, the text file to be printed is located at "C:\SampleText.txt". The extra "\" in the script below is necessary for it to be passed properly from within the script:

Below is the script above in text format:

dim P1 as System.Diagnostics.Process;
dim psi as System.Diagnostics.ProcessStartInfo;
dim File as string;

P1 = new System.Diagnostics.Process();
File = "C:\\SampleText.txt";

psi = new System.Diagnostics.ProcessStartInfo(File);

psi.Verb = "PRINT";
psi.UseShellExecute = true;
psi.CreateNoWindow = true;
psi.Arguments = File;

P1.StartInfo = psi;

P1.Start();

Me.PrintFile = false;

Step 3: Save and close the object and then test triggering the print operation from within Object Viewer:

 

print text external printer
Give feedback about this article

Recommended articles

How to receive group emails

Read More

TN 1398 Determining Active Communications Server

Read More
Support Icon

CONTACT SUPPORT

How to reach us

10800 Midlothian Turnpike Tpke, Suite 209, Richmond, VA 23235

1.877.INSOURCE

Technical Support - 1.888.691.3858

Contact Us

  • InSource Solutions
  • InSource Training
  • InSource Client Portal
  • Log In
InSource Solutions Logo

© 2025 InSource Solutions. All Rights Reserved.

Knowledge Base Software powered by Helpjuice

Expand