Kiai Posted March 17, 2009 Share Posted March 17, 2009 I have a script that exports an rtf from on application, does some mail-merge type of work, then I print out the final version. Currently I am using wordpad with the /pt command line option to print the rtf file to a specified printer. This works fine except for 2 things: Even though I run wordpad in hide mode, it flashes up on the screen momentarily (confusing users). Because wordpad page margins are stored in the registery (and wordpad ignores html page margin commands) I have to adjust the registry settings at every printing. Any suggestions about how to silently print an rtf file? I'm also still trying to figure out how to put formatted text in to the clipboard via an autoit script -- not copying existing formatted text, I want to clipput("/bBold/b") or something and be able to paste in to word or wordpad and have the text come out bold. Suggestions? Link to comment Share on other sites More sharing options...
Andreik Posted March 17, 2009 Share Posted March 17, 2009 Did you tried _FilePrint()? When the words fail... music speaks. Link to comment Share on other sites More sharing options...
martin Posted March 17, 2009 Share Posted March 17, 2009 Did you tried _FilePrint()? From the help Function _FilePrint Prints a plain text file.so maybe best not to try. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
erik7426 Posted March 17, 2009 Share Posted March 17, 2009 I have a script that exports an rtf from on application, does some mail-merge type of work, then I print out the final version. Currently I am using wordpad with the /pt command line option to print the rtf file to a specified printer. This works fine except for 2 things:Even though I run wordpad in hide mode, it flashes up on the screen momentarily (confusing users). Because wordpad page margins are stored in the registery (and wordpad ignores html page margin commands) I have to adjust the registry settings at every printing. Any suggestions about how to silently print an rtf file?I'm also still trying to figure out how to put formatted text in to the clipboard via an autoit script -- not copying existing formatted text, I want to clipput("/bBold/b") or something and be able to paste in to word or wordpad and have the text come out bold. Suggestions?Is opening the rtf with Word an option? Link to comment Share on other sites More sharing options...
Andreik Posted March 17, 2009 Share Posted March 17, 2009 Maybe _WordDocPrint(). When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Bowmore Posted March 17, 2009 Share Posted March 17, 2009 This should work on most windows PCs $sRTFfilename = "C:\data\test.rtf" ;Change this path to one of your own ShellExecute('"' & $sRTFfilename & '"', "", @ScriptDir, "print", @SW_HIDE) "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
Kiai Posted March 18, 2009 Author Share Posted March 18, 2009 This should work on most windows PCs $sRTFfilename = "C:\data\test.rtf" ;Change this path to one of your own ShellExecute('"' & $sRTFfilename & '"', "", @ScriptDir, "print", @SW_HIDE) That does work -- opens the default program for the file, in this case Word. Unfortunately, even with the @SW_HIDE the program still opens on the desktop (confusing the user). I really want a truly background print with nothing flashing on the screen. Thanks for your help! Link to comment Share on other sites More sharing options...
Bert Posted March 18, 2009 Share Posted March 18, 2009 If I remember right, someone made a print udf. I would have to search for it... The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
martin Posted March 18, 2009 Share Posted March 18, 2009 If I remember right, someone made a print udf. I would have to search for it...Prog@ndy wrote some printer udfs using some work by GRS, which include getting the DC of the printer. I think it's in example scripts. I also have a printer udf but there is no access the the printer DC and no way to deal with rtf.With Prog@ndy's udf you could do what you want bycreate a gui with a rich edit, but not show it. Try this UDF. There are others around.Then see msdn here on how to print it to a DC. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now