FAQsOther Legacy Products

How can I print out something from a ScalaScript?

By July 23, 2012 No Comments

Often times, it is desirable to be able to, for example, print a coupon in a kiosk application from a ScalaScript. Here’s a way to do that today.

Here is what you need: – Windows Scripting Host Installed (www.microsoft.com/scripting) – Microsoft Word (I used Office 2000) – Designer – Small VB Script Here is the ScalaScript: !ScalaScript EVENT Group: Integer(x, n); Boolean(status); BackgroundSettings(Size(640, 480)); Config.SaveOpts(SaveEditable(On)); Sequence: x = Open(“test.doc”,write); status = WriteStr(x,”Hello World!”); n = Close(x); Launch(“c:print.vbs”); Quit(1); END This is a very simple example that uses the File I/O EX to write “Hello World” to a file no disk. IC Designer will put this file in the Data: directory. You can not write outside of that directory btw. The Launch command will execute this VBScript that in this example is located at C: but could be anywhere. Set app = Wscript.CreateObject(“Word.Application”) app.Documents.Open(“c:program filesscalaicdesignerdatatest.doc”) app.Options.PrintBackground = False app.ActiveDocument.PrintOut So this script opens Word and uses the Documents.Open method to bring in the text file created in the Scala Script. Then it sets some options and executes the method that actually prints the file. I hope this helps. Maybe in the future we will add a ScalaScript function for printing.