Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
fppno
- Newbie
- Posts: 3
- Joined: Tue Dec 02, 2003 4:55 pm
- Location: Overland Park, KS
-
Contact:
Post
by fppno » Tue Dec 02, 2003 5:01 pm
Hello-
Could anyone show me how to create a script to automatically print a .rtf document to a remote printer or network printer using the Macro Scheduler.
Thanks!

-
Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
-
Contact:
Post
by Bob Hansen » Tue Dec 02, 2003 6:23 pm
Try this quick and dirty basic sample to default printer:
//Could use Input> commands for prompts vs. hard coded document.
Let>Path=C:\My Documents
Let>Filename=Document01.rtf
Let>Window=%Filename% - Wordpad*
//Start WordPad with selected document
Run Program>C:\WINDOWS\WRITE.EXE "%Path%\%FileName%"
WaitWindowOpen>%Window%
//Call Print Dialog
Press ALT
Send Character/Text>FP
Release ALT
//Send Print commands
WaitWindowOpen>Print*
// Use one of the following lines to select a printer different from default printer.
// Change "n" to the number of Up/Down commmands needed.
//Press UP*n
//Press DOWN*n
PushButton>Print,OK
//Close Wordpad
Press ALT
Send Character/Text>Fx
Release ALT
If using Cut/Paste into Macro Scheduler Editor, be sure to remove any trailing spaces on lines. After Paste, from the Main Menu, click on Edit, Remove Trailing Spaces. Then Save before executing macro.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
-
fppno
- Newbie
- Posts: 3
- Joined: Tue Dec 02, 2003 4:55 pm
- Location: Overland Park, KS
-
Contact:
Post
by fppno » Wed Dec 03, 2003 9:13 pm
Thank you for your help Bob! Unfortnately the print command dosn't work at all! I tried to used the MouseOver over PushButton command and still not working. Any more suggestions?
Thanks once again!
FP
-
support
- Automation Wizard
- Posts: 1450
- Joined: Sat Oct 19, 2002 4:38 pm
- Location: London
-
Contact:
Post
by support » Wed Dec 03, 2003 11:33 pm
Hi,
How about a little VBScript:
VBSTART
Sub PrintRTF(RTFFile)
Dim wrd 'As Word.Application
Dim doc 'As Word.Document
Set wrd = CreateObject("Word.Application")
wrd.application.Visible = False
'Set the printer here
wrd.ActivePrinter = "HP DeskJet 610C"
Set doc = wrd.Documents.Open(RTFFile)
doc.PrintOut
doc.Close
wrd.Quit
Set wrd = Nothing
End Sub
VBEND
VBRun>PrintRTF,C:\blablabla\somedoc.rtf
Set the printer in the subroutine and pass the RTF file to the PrintRTF function.
-
Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
-
Contact:
Post
by Bob Hansen » Thu Dec 04, 2003 12:23 am
Thank you for your help Bob! Unfortnately the print command dosn't work at all! I tried to used the MouseOver over PushButton command and still not working.
Surprised.....I actually ran that script and read rtf rresults on the paper that came out of my printer. Repeats with no problem. WordPad with WIN98SE, Macro Scheduler 7.2.043.
Can you provide copy of script that does not work?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
-
fppno
- Newbie
- Posts: 3
- Joined: Tue Dec 02, 2003 4:55 pm
- Location: Overland Park, KS
-
Contact:
Post
by fppno » Thu Dec 04, 2003 3:32 pm
I used the Microsoft Word instead of WordPad in my script. The VB Script mentioned above is working!
Thank you very much for all your help!
FP