Belini Posted May 8, 2016 Share Posted May 8, 2016 I saved photos that need to print, I can do this using Autoit? My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
AutoBert Posted May 8, 2016 Share Posted May 8, 2016 Shellexecute("YouPhotoDisplayAndPrinting.exe","","","print") Link to comment Share on other sites More sharing options...
TheDcoder Posted May 8, 2016 Share Posted May 8, 2016 A polished version of AutoBert's reply: Use ShellExecute with the $SHEX_PRINT verb, Example: #include <AutoItConstants.au3> Global Const $IMAGE = "C:\Users\TheDcoder\Pictures\TheDcoder.png" ; Location of the image file to print ShellExecute($IMAGE, "", "", $SHEX_PRINT) TD EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Belini Posted May 8, 2016 Author Share Posted May 8, 2016 @AutoBert Thus opened the print window and select the photo but not automatically printed the picture and I have more than one printer must then choose the printer instead of indicating the executable it! My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
TheDcoder Posted May 8, 2016 Share Posted May 8, 2016 If that is the case then ShellExecute won't work for you, you need a more advanced code. EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
dmob Posted May 9, 2016 Share Posted May 9, 2016 Try Irfanview. It has a nice command line interface that will let you do what you want. Link Belini 1 Link to comment Share on other sites More sharing options...
Belini Posted May 9, 2016 Author Share Posted May 9, 2016 @TheDcoder The image was printed but opened the photoshop window before printing, I can print without associating the image to another program? Spoiler @dmob I'll download Irfanview and I will experiment with it by command line! My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
TheDcoder Posted May 9, 2016 Share Posted May 9, 2016 @Belini You would have to work with the print API in windows, I don't know much about it It would best if you follow @dmob's suggestion . EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Gianni Posted May 9, 2016 Share Posted May 9, 2016 also... Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Belini Posted May 9, 2016 Author Share Posted May 9, 2016 @TheDcoder If I do not find another way I will try this option! Thank @Chimp I'll read these topics you indicated! My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
TheDcoder Posted May 9, 2016 Share Posted May 9, 2016 Good luck @Belini EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
UEZ Posted May 9, 2016 Share Posted May 9, 2016 RunWait('Rundll32.exe "' & @SystemDir & '\mshtml.dll",PrintHTML "' & $tempFile & '"', @SystemDir) ;replace $tempFile with the file which should be printed Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Belini Posted May 10, 2016 Author Share Posted May 10, 2016 @UEZ This way does not automatically prints it opens the printer configuration box before printing! My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
UEZ Posted May 10, 2016 Share Posted May 10, 2016 3 minutes ago, Belini said: @UEZ This way does not automatically prints it opens the printer configuration box before printing! Sorry, I misunderstood your issue. I thought you will be able to select the printer. Currently I don't know how to send the file directly to the default printer. Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
UEZ Posted May 10, 2016 Share Posted May 10, 2016 What about this here? Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Belini Posted May 10, 2016 Author Share Posted May 10, 2016 With this does not print and also did not open the printer configuration window! My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Gianni Posted May 13, 2016 Share Posted May 13, 2016 you could do this way: Create a pdf file containing all the pictures you want to print and use SumatraPDF.exe to print the pdf file silently on a printer of your choice or on the default printer. in short do like this: download SumatraPDF.exe (portable version) from here: http://www.sumatrapdfreader.org/download-free-pdf-viewer.html and save the exe to your script dir. This is a very nice tool that allows also to print pdf files silently. (moer command line arguments here: https://github.com/sumatrapdfreader/sumatrapdf/wiki/Command-line-arguments) Download this very nice UDF from here: and save it to your script dir (this is used to create the pdf that contains the images to be printed) use this draft script posted here as an example to see how to print silently one ore more pictures of your choice. expandcollapse popup#include "MPDF_UDF.au3" _SelectImages() ; select images and create a temporary pdf file containing all the selected images ; now print selected images silently using sumatraPDF.exe Run(@ScriptDir & '\SumatraPDF.exe -silent -print-to-default ' & @ScriptDir & "\Image2PDF.pdf", "", @SW_HIDE) ; use -print-to "printername" to select another printer ; delete temporary file ; FileDelete (@ScriptDir & "\Image2PDF.pdf" ) Func _SelectImages() Local $var = FileOpenDialog("Select images", @ScriptDir & "\", "Images (*.jpg;*.bmp;*gif;*png;*tif;*ico)", 4) If @error Then MsgBox(4096, "", "No File(s) chosen") Exit Else If not StringInStr($var, '|') Then ; only one file selected $var = StringReplace($var, '\', '|', -1) EndIf EndIf Local $aImgs = StringSplit($var, "|", 3) Local $aIMG_Params ;set the properties for the pdf _SetTitle("Image2PDF") _SetSubject("Convert image(s) to pdf") _SetKeywords("pdf, AutoIt") _OpenAfter(True);open after generation _SetUnit($PDF_UNIT_PT) ; 1 _SetPaperSize("a4") _SetZoomMode($PDF_ZOOM_CUSTOM, 100) _SetOrientation($PDF_ORIENTATION_PORTRAIT) _SetLayoutMode($PDF_LAYOUT_CONTINOUS) ;initialize the pdf FileDelete(@ScriptDir & "\Image2PDF.pdf") _InitPDF(@ScriptDir & "\Image2PDF.pdf") ;=== load resources (images) used in pdf === For $i = 1 To UBound($aImgs) - 1 $aIMG_Params = _LoadResImage_MOD("img" & $i, $aImgs[0] & "\" & $aImgs[$i]) _BeginPage() ; load each image on it's own page ;scale factors $iScaleFactorX = _GetPageWidth() / $aIMG_Params[1] $iScaleFactorY = _GetPageHeight() / $aIMG_Params[2] if $iScaleFactorX >= 1 And $iScaleFactorY >= 1 Then ; The image is smaller than the sheet, no need to rescale _InsertImage("img" & $i, ( _GetPageWidth() - $aIMG_Params[1]) / 2, (_GetPageHeight() - $aIMG_Params[2]) / 2) ; center image in the page Else ; the image is bigger than the sheet, it needs to be reduced to fit (maintaining proportions) If $iScaleFactorX < $iScaleFactorY Then $iScale = $iScaleFactorX Else $iScale = $iScaleFactorY EndIf _InsertImage("img" & $i, ( _GetPageWidth() - $aIMG_Params[1] * $iScale) / 2, (_GetPageHeight() - $aIMG_Params[2] * $iScale) / 2, $aIMG_Params[1] * $iScale, $aIMG_Params[2] * $iScale) ; Rescale and center image in the page EndIf _EndPage() Next ; finally, write the buffer to disk _ClosePDFFile() EndFunc ;==>_SelectImages ; #FUNCTION# ==================================================================================================================== ; Name ..........: _LoadResImage ; Description ...: Load a image in the pdf (if you use it multiple times it decreases the size of the pdf) ; Syntax ........: _LoadResImage( $sImgAlias , $sImage ) ; Parameters ....: $sImgAlias - an alias to identify the image in the pdf (e.g. "Cheese"). ; $sImage - image path. ; Return values .: Success - True ; Failure - False ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: By Cimp (returns an 3 element array where: [0]$_Image , [1] $_iImageW , [2] $_iImageH instead of just $_Image ; Remarks .......: Image types accepted: BMP, GIF, TIF, TIFF, PNG, JPG, JPEG (those are tested) ; Related .......: ; Link ..........: http://www.autoitscript.com/forum/topic/118827-create-pdf-from-your-application/ ; Example .......: No ; =============================================================================================================================== Func _LoadResImage_MOD($sImgAlias, $sImage) Local $iW, $iH, $ImgBuf, $hImage, $hImageExt, $newImg, $hClone, $hGraphics, $iObj, $aReturn[3] If $sImgAlias = "" Then __Error("You don't have an alias for the image", @ScriptLineNumber) If $sImage = "" Then __Error("You don't have any images to insert or the path is invalid", @ScriptLineNumber) Else $hImageExt = StringUpper(StringRight($sImage, 3)) $newImg = _TempFile(@ScriptDir, "~", ".jpg") Switch $hImageExt Case "BMP", "GIF", "TIF", "TIFF", "PNG", "JPG", "JPEG", "ICO" _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($sImage) $iW = _GDIPlus_ImageGetWidth($hImage) $iH = _GDIPlus_ImageGetHeight($hImage) $hClone = _GDIPlus_BitmapCloneArea($hImage, 0, 0, $iW, $iH, $GDIP_PXF24RGB) $hGraphics = _GDIPlus_ImageGetGraphicsContext($hClone) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2) _GDIPlus_GraphicsClear($hGraphics, 0xFFFFFFFF) _GDIPlus_GraphicsDrawImage($hGraphics, $hImage, 0, 0) _GDIPlus_ImageSaveToFile($hClone, $newImg) $ImgBuf = __ToBinary($newImg) $_iImageW = $iW $_iImageH = $iH $iObj = __InitObj() __ToBuffer("<</Type /XObject /Subtype /Image /Name /" & $sImgAlias & " /Width " & $_iImageW & " /Height " & $_iImageH & " /Filter /DCTDecode /ColorSpace /DeviceRGB /BitsPerComponent 8" & Chr(10) & "/Length " & StringLen($ImgBuf) & ">>stream") __ToBuffer($ImgBuf) __ToBuffer("endstream") __EndObj() $_Image &= "/" & $sImgAlias & " " & $iObj & " 0 R " & Chr(10) __InitObj() __ToBuffer(StringLen($ImgBuf)) __EndObj() _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hClone) _GDIPlus_Shutdown() FileDelete($newImg) Case Else __Error("The image is invalid", @ScriptLineNumber) Exit EndSwitch EndIf ; Return $_Image $aReturn[0] = $_Image $aReturn[1] = $_iImageW $aReturn[2] = $_iImageH Return $aReturn EndFunc ;==>_LoadResImage_MOD Func _Iif($vExpression, $vTrue, $vFalse) Return $vExpression ? $vTrue : $vFalse EndFunc ;==>_Iif This script uses a little modified version of the function _LoadResImage() from the MPDF_UDF.au3. if you use an old version of AutoIt and get an error about the _Iif() function then just rename or delete the _Iif() function located at the end of this script. Belini 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Belini Posted May 13, 2016 Author Share Posted May 13, 2016 Thank @chimp I will test these things you gave me! My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
AdamUL Posted May 13, 2016 Share Posted May 13, 2016 You can also try using IrfanView with command line options. You can use the /print or the /print="Name" options. From the IrfanView help file. Quote /print - print input image to default printer and close IrfanView /print="Name" - print input image to specific printer and close IrfanView - Wildcards supported only for /convert, /multitif, /multipdf, /panorama, /print, /info, /jpg_rotate and /extract. - Most settings are loaded from the INI file. Using prepared INIs and /ini=folder option, you can extend the possibilities. Example for /print: i_view32.exe c:\test.jpg /print Open 'c:\test.jpg', print the image to default printer and close IrfanView. i_view32.exe c:\test.jpg /print="Printer Name" Open 'c:\test.jpg', print the image to specific printer and close IrfanView. i_view32.exe c:\*.jpg /print Print all JPGs from "C:\" and close IrfanView. Note: The actual settings from the INI file are used. You can be run without installation, download the ZIP. Irfanview is available in 32 and 64 bit. Adam Belini 1 Link to comment Share on other sites More sharing options...
Belini Posted May 14, 2016 Author Share Posted May 14, 2016 (edited) Thank @dmob and @AdamUL by IrfanView's tip because he solved my problem! @Chimp I chose to use IrfanView because he did not need to create a PDF of the images but thank you very much for the tips you gave me! Edited May 14, 2016 by Belini dmob 1 My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ 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