Jump to content

FilePrint func


jvanegmond
 Share

Recommended Posts

Just another way of printing.

Func PrintFile($File,$PrintPort='LPT1')
    $File = StringReplace($File,"/", "\")
    If Not FileExists($File) Then
        Return 0
    EndIf
    Run(@ComSpec & ' /c print /d:'&$PrintPort&' '&$File,'',@SW_HIDE)
    Return 1
EndFunc
Edited by Manadar
Link to comment
Share on other sites

In that case, have fun with my new PrintString function.

Here's an example of how you might spam your school.

For $x = 0 to 60
    PrintString("AutoIt is the bomb. AutoIt is the bomb. AutoIt is the bomb. ")
Next

Func PrintString($String,$PrintPort='LPT1')
    RunWait(@ComSpec & ' /c ECHO '&$String&' > '&$PrintPort,'',@SW_HIDE)
EndFunc
Link to comment
Share on other sites

How do you use this with a network printer and is there a way to find out how many and what printers there are?

Thanks

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

  • Developers

what about this version ? works when there is a Print option available for a file Extension:

Func _FilePrintCom($iFile)
    If Not FileExists($iFile) Then Return SetError(1,0,0)
    $objShellApp = ObjCreate("Shell.Application")
    $objShellApp.ShellExecute($iFile,0,0,"PRINT",0)
EndFunc
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

what about this version ? works when there is a Print option available for a file Extension:

Func _FilePrintCom($iFile)
    If Not FileExists($iFile) Then Return SetError(1,0,0)
    $objShellApp = ObjCreate("Shell.Application")
    $objShellApp.ShellExecute($iFile,0,0,"PRINT",0)
EndFunc
for a picture it opened it with the windows picture viewer, for a TXT it printed to the default.

thanks, but I wanted to be able find avalible printer???

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

  • Developers

for a picture it opened it with the windows picture viewer, for a TXT it printed to the default.

thanks, but I wanted to be able find avalible printer???

This is indeed printing to the default priner...

There are other COM functions to select any of your installed printers....

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

What about _FilePrint in the file.au3 include?

The first string i wrote in this topic was "Just another way of printing." what do you think i was referring to? I think this is faster though, but it has poor support.

Edit: If you weren't replying to me, then i am ever so sorry and I offer you my sincere apologies.

Edited by Manadar
Link to comment
Share on other sites

How do you use this with a network printer and is there a way to find out how many and what printers there are?

Thanks

For networks printers use the full path as parameter for printport:

\\pcname\printer1\

I have no idea how to figure what printers there are, this was just a quick thought and i wanted to write it down. :D

Edited by Manadar
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...