Page 1 of 1

print files

Posted: 28 Aug 2015 18:14
by lian00
Hello,
I wanted to print some images and I did not find any way to do so in XYplorer. Did I miss something ?

Re: print files

Posted: 28 Aug 2015 18:44
by highend

Code: Select all

    $files    = "<get SelectedItemsPathNames |>";
    $printers = replace(regexmatches(runret("wmic path win32_printer get name /format:list"), "Name=.*?$", "|"), "Name=");
    $printer  = quote(popupmenu($printers, -1, -1, , , 0, "|"));
    foreach($file, $files) {
        $file = quote($file);
        run "rundll32.exe %SystemRoot%\System32\shimgvw.dll,ImageView_PrintTo /pt $file $printer", "<curpath>", 0, 0;
    }

Re: print files

Posted: 28 Aug 2015 19:11
by lian00
OK, thank you. Too bad it's not in the core. Will it work in 64 bits ?

Re: print files

Posted: 28 Aug 2015 19:26
by highend
Yeah, I'm using it on Windows Server 2012 R2 (x64)...

Re: print files

Posted: 28 Aug 2015 19:49
by lian00
It works ! Thanks a lot.

Re: print files

Posted: 31 Aug 2015 12:31
by admin
I say WOW. :shock: :appl:

Re: print files

Posted: 31 Aug 2015 12:37
by lian00
admin wrote:I say WOW. :shock: :appl:
So it could be put in core :-)

Re: print files

Posted: 31 Aug 2015 12:41
by admin
It could. Not sure about the demand though.

Re: print files

Posted: 31 Aug 2015 13:15
by lian00
admin wrote:It could. Not sure about the demand though.
Well, as it's a very good image browser - I used XYplorer as image browser - this could be a nice feature. But if I'm fhe fist one asking for such a feature, I suppose there is not a lot of people interested in...

Re: print files

Posted: 13 Feb 2019 01:04
by ColdNose
highend wrote: 28 Aug 2015 18:44

Code: Select all

    $files    = "<get SelectedItemsPathNames |>";
    $printers = replace(regexmatches(runret("wmic path win32_printer get name /format:list"), "Name=.*?$", "|"), "Name=");
    $printer  = quote(popupmenu($printers, -1, -1, , , 0, "|"));
    foreach($file, $files) {
        $file = quote($file);
        run "rundll32.exe %SystemRoot%\System32\shimgvw.dll,ImageView_PrintTo /pt $file $printer", "<curpath>", 0, 0;
    }
Highend, is there way to modify this to print any filetype (.pdf, .docx, etc.)? If not any filetypes, how about just .pdfs?

I think shimgvw.dll only works with image files, right?

Re: print files

Posted: 13 Feb 2019 01:10
by jupe
You definitely can't print PDFs with the above method, but if you use SumatraPDF you can print them via command line, I gave a small example how here:

viewtopic.php?t=19957#p166324