Results 1 to 10 of 13

Thread: Automatic printing

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Question Automatic printing

    Hello together,

    I have a question regarding the printing functionalities in Irfanview. Is there the possibility that Irfanview monitors a directory on a PC and automatically starts to print new pictures?

    A short process description :

    - digital camera takes a photo
    - photo will be transfered to the PC in a defined directory
    - Irfanview checks permanently for new pictures in this directory and prints this picture once on a printer

    Thanks for your help!

    Ciao Goose777

  2. #2
    Moderator
    Join Date
    Aug 2007
    Location
    Germany
    Posts
    855
    Version
    IrfanView 4.51
    OS
    64-bit Win 10
    CPU Cores
    8

    Default

    Hi,

    IrfanView won't do this.
    It should be possible with a windows batch file to do this since IrfanView can be started from command line and triggerd to print a file.
    There are some few things which have to be checked, i.e. how fast are the images copied there, so there might be a timing problem.
    What should be done with the printed images? Deleted or moved?

    I think I can write you a script.

    Regards
    Nils

  3. #3

    Default

    Hi Nils,

    and thanks for your quick answer. The "program" or batch file should do the following steps:

    It should

    - the batch file should scan a defined directory every 10 seconds for jpg/jpeg files
    - in an additional txt file all printed pictures a saved with their filename
    - if the script detects a new file resp. a file which has not been save in the txt-file, it will save the printed file in the texfile for later checks (just the name) and afterwards sends the picture to the standard printer
    - the pictures should not be touched by the script (delete or move), because the should be displayed via a TFT-screen / Irfanview at the same time.

    I think, that are all necessary steps to steer the printing. Generelly 16 megapixel picture will be processed.

    If you need more infos, feel free to ask :-)

    Ciao Goose777

  4. #4
    Moderator
    Join Date
    Aug 2007
    Location
    Germany
    Posts
    855
    Version
    IrfanView 4.51
    OS
    64-bit Win 10
    CPU Cores
    8

    Default

    Hi,

    try this script.
    You have to modify some lines.
    The directory which you like to have scanned:
    Code:
    rem Directory to be scanned
    set scandir=R:\Pictures
    Maybe the name and path of the text files used for logging the printed files:
    Code:
    rem Text file to keep file names of printed files
    set printed="%scandir%\PrintedWithIrfanView.txt"
    If you have a special path running IrfanView then the detection will fail. So remove the "rem" and modify the path to the i_view32.exe:
    Code:
    rem set iview="D:\tools\i_view32.exe"
    Save this script as something like "PrintLoop.cmd"
    Code:
    @echo off
    rem ******************************
    rem * IrfanView PrintLoop script *
    rem ******************************
    rem This script checks a given directory for given picure types and print them.
    setlocal
    
    rem ************
    rem * Settings *
    rem ************
    
    rem Path to Irfan view
    rem If IrfanView is installed in the common program files folder this part
    rem should be usable.
    rem If you have installed IrfanView elsewhere, i.e. in D:\Tools\IV then
    rem just delete these lines and uncomment and modify the set iview line.
    if /i "%PROCESSOR_ARCHITECTURE%" equ "AMD64" (
     rem Path to IrfanView on x64 Windows
     set iview="%ProgramFiles(x86)%\IrfanView\i_view32.exe"
    ) else (
     rem Path to IrfanView on x86 Windows
     set iview="%ProgramFiles%\IrfanView\i_view32.exe"
    )
    rem set iview="D:\tools\i_view32.exe"
    if not exist %iview% goto noIview
    
    rem Configure variables
    rem Delay in seconds
    set delay=10
    
    rem Directory to be scanned
    set scandir=R:\Pictures
    
    rem File types (seperate with colon)
    set filetypes=.jpg:.jpeg
    
    rem Text file to keep file names of printed files
    set printed="%scandir%\PrintedWithIrfanView.txt"
    
    rem Use default printer
    set print=/print
    rem Or set a special printer, just replace the printer name and remove the "rem"
    rem set print=/print="My special printer"
    
    
    rem Additional tools
    set choice="%SystemRoot%\system32\choice.exe"
    if not exist %choice% goto nochoice
    set find="%SystemRoot%\system32\find.exe"
    if not exist %find% goto nofind
    
    rem Check if the directory exists
    if not exist "%scandir%" goto noscandir
    rem Change to the input directory
    pushd "%scandir%"
    
    echo Scanning directory
    echo  %scandir%
    echo for new pictures and print them.
    echo.
    rem Do the loop
    :loop
    for /f "delims=" %%a in ('dir /b') do call :check "%%~fa" "%%~xa"
    
    rem Ask for exit or continue scanning
    %choice% /T %delay% /C XC /D C /M "X for exit, C for immediate checking."
    if errorlevel 2 goto loop
    
    rem After finishing go to the end
    popd
    goto end
    
    rem Check file
    :check
    echo %time% Checking...
    rem Check the file type
    echo %filetypes% | %find% /i "%~2" >nul
    if errorlevel 1 goto :eof
    
    rem File type ok
    rem If the text file does not exist, print
    if not exist %printed% call :print %1
    
    rem Check if the file name is already in the text file
    type %printed% | %find% /i %1 >nul
    if errorlevel 1 call :print %1
    goto :eof
    
    :print
    rem Print the picture
    echo Printing %1
    start "IrfanView" /wait %iview% %1 %print% /ini="%scandir%"
    
    rem Appending file name
    (echo %~1)>>%printed%
    goto :eof
    
    :noscandir
    echo %scandir% not found.
    goto end
    
    rem IrfanView could not be found.
    :noiview
    echo IrfanView not found in the given path:
    echo   %iview%
    goto end
    
    rem choice could not be found.
    :nochoice
    echo choice.exe not found in the given path:
    echo   %choice%
    goto end
    
    rem find could not be found.
    :nofind
    echo find.exe not found in the given path:
    echo   %find%
    goto end
    
    rem End of the script
    :end
    endlocal

    You also should have a special ini file, so save this as i_view32.ini into your picture directory:
    Code:
    [Print]
    AutoRotate=1
    Option=1
    Left=0.00
    Top=0.00
    Inches=0
    ScaleX=1.00
    ScaleY=1.00
    Centered=1
    Copies=1
    Orient=1
    Hope this helps.

    Regards
    Nils

  5. #5

    Default

    Hi Nils,

    and wow!!!!!! Thanks a lot for your work. I will try your script at the weekend, because I have to setup a new PC for the Photobox I want to built. I will let you know if everthing is working fine (and I think it will).

    Thanks a lot again and have a nice week.

    Ciao Goose777

  6. #6

    Default

    This is a great script and i use it to print png UPS labels to a Dymo.
    However i get an error when printing multiple images.

    Is it possible to modify the script so it only prints one image at a time, moves it and than scans the folder again or only move the files after they have been printed?
    Last edited by Wilbur13; 09.04.2015 at 03:35 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •