Wolvereness Posted December 17, 2004 Share Posted December 17, 2004 I have a script that I need it to print out a file (without the hassle of the user). It must print out in portrait, black/white, and default printer. Does anyone have anything they could hook me up with? Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote] Link to comment Share on other sites More sharing options...
normeus Posted December 17, 2004 Share Posted December 17, 2004 depends on the file. If it is a text file you could call it with "NOTEPAD.EXE /P filename.txt" ;note the /P for print but if you have "textpad" you could define your document type and it will remeber the settings for printing ( font etc... ) and you would call the program the same as notepad (scite might be able to do it ) http://www.autoitscript.com/autoit3/scite/...iTe4AutoIt3.exe Link to comment Share on other sites More sharing options...
Groumphy Posted May 5, 2005 Share Posted May 5, 2005 Hello, Thanks for your tips. I modified the line like this (for print on the network) : copy filename.txt \\server\printers exit When I use this method, I obtain illegible (not readeable) characters for the accentuated characters. The printer (HP LaserJet2300L) has last the drivers (HP LaserJetCompatible 2100/2200/2300 Serie 5). Can you help me ? ----------------------GroumphyMore information about me [Fr] Link to comment Share on other sites More sharing options...
SvenP Posted May 5, 2005 Share Posted May 5, 2005 Hello, Thanks for your tips.I modified the line like this (for print on the network) :copy filename.txt \\server\printers exitWhen I use this method, I obtain illegible (not readeable) characters for the accentuated characters. The printer (HP LaserJet2300L) has last the drivers (HP LaserJetCompatible 2100/2200/2300 Serie 5).Can you help me ?<{POST_SNAPBACK}>With the "copy" command, you bypass the windows printer drivers. Before you can print anything, the format of the text must be converted by the printer driver (in your case I guess the printer language is PCL5 or PCL6).It also depends on the source format of the text. You have to print the text using the program in which it has been written. for instance if it's an MS-Word text, then you must use MS-Word to convert and print the text.So it's not that easy to print something. Microsoft has only solved this partly by adding a 'print' action on some file extensions in the Windows Shell. But not many file extensions support this.Here's a code snippet that you can use if your file has a 'Print' association:Func FilePrint($FileName) ; Prints a file using the default File Association ; See also: http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/functions/shellexecute.asp Const $SW_SHOWNORMAL=1 ;ShellExecute(NULL, "print", <fully_qualified_path_to_folder>, NULL, NULL, SW_SHOWNORMAL); $aResult=DllCall("shell32.dll","int","ShellExecute","hwnd",0,"str","print","str",$FileName,"str","","str","","int",$SW_SHOWNORMAL) return $aResult[0] EndFuncRegards,-Sven Link to comment Share on other sites More sharing options...
Groumphy Posted May 5, 2005 Share Posted May 5, 2005 Hello, Thanks for your help. I try this solution tomorow ! ----------------------GroumphyMore information about me [Fr] Link to comment Share on other sites More sharing options...
Groumphy Posted May 7, 2005 Share Posted May 7, 2005 (edited) Hello, Thank you for your assistance. The Script functions very well if a default printer is installed. But on the PC where script is installed, no printer can be installed (the end-user can nothing see or knowing [network security]). I identified the problem. It comes from the bypass of the drivers and coding of Windows is not compatible with MS-DOS... The file filename.txt is in ASCII... And it is necessary that it arrives in ANSI. (with your assistance on the management of printer and charactères accentuated via MS-DOS) I use net use lpt3 \\Server\Printers copy filename.txt lpt3 net use lpt3 /delete exit Or copy filename.txt \\Server\Printers2 exit Simplest is that I code a small function, who replaces the accentuated characters of the textual file (produced by AutoIt) when this last is finished and right before sending it towards the printer. Edited May 7, 2005 by Groumphy ----------------------GroumphyMore information about me [Fr] 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