Page 2 of 2 FirstFirst 1 2
Results 11 to 19 of 19

Thread: Batch files and Scripts

  1. #11
    Plugin Author
    Join Date
    Jun 2007
    Posts
    341
    OS
    Win 7 Professional SP1

    Default

    Sorry for that. It's working on our Vista test bench, but this does not mean that it is not buggy.
    Does it also die if you just call "imdib" or "imdib /copy"? You may also add a "/verbose" in front of the "/edit".
    If you prefer we could shift the discussion to the private area of the forum so that this thread will not be miss-used.

  2. #12
    Professional User Mij's Avatar
    Join Date
    Mar 2007
    Location
    Camberley, Surrey, UK
    Posts
    2,758
    Version
    IrfanView 4.51
    OS
    32-bit Win 10
    CPU Cores
    3

    Default

    The ordinary copy and paste operations work fine. So far it is just the /edit= feature that is giving trouble. I will look at it more closely to see if I can tell where it goes wrong.

    Yes, it would be better to move to the private area for detailed discussion.

    Footnote for information: The problem was resolved in private discussion with impdf and the current version of the program does now work on my Vista machine.
    Last edited by Mij; 22.07.2010 at 05:50 PM. Reason: Added footnote

  3. #13
    IV Newbie
    Join Date
    Nov 2010
    Location
    Nashville, TN, USA
    Posts
    2

    Default

    Has anybody had trouble with pausing after a command line process complets? I use the command line to process PNG files but the command window allways closes after completion. It works, I would just like it to not close.

  4. #14
    Professional User Mij's Avatar
    Join Date
    Mar 2007
    Location
    Camberley, Surrey, UK
    Posts
    2,758
    Version
    IrfanView 4.51
    OS
    32-bit Win 10
    CPU Cores
    3

    Default

    If you are using Command prompt to run the command line then the Command prompt window will close when the action is complete. If you Call Irfanview then the Command prompt will wait for Irfanview to close before closing the window but if you want to keep the window open after that then you will have to write a batch file and add a Pause line after the Irfanview one.

    e.g
    Code:
    "C:\program files\irfanview\i_view32.exe" "C:\users\me\*.tif" /convert="C:\users\him\*.jpg"
    Pause

  5. #15
    IV Newbie
    Join Date
    Nov 2010
    Location
    Nashville, TN, USA
    Posts
    2

    Smile

    This is in a batch file; only in DOS would these two seemingly equal commands not function the same. Thanks for the tip.



    Code:
    :: this line will exit the batch when complete no matter what so it is commented out
    :: irfanview %~dp0\Panels\*.png /advanvedbatch /convert=%~dp0\RFIRM\*.png
    
    :: this line will proced to the next command and not exit the batch
    "C:\program files\irfanview\i_view32.exe"  %~dp0\Panels\*.png /advanvedbatch /convert=%~dp0\RFIRM\*.png
    
    PAUSE
    FYI
    The %~dp0 tag allows this batch file to make use of the local directory structure. When the batch is executed it will look for the folders Panels and RFIRM in the folder that the batch file resides. It will convert all the raw PNG files in the Panels folder using the stored parameters for PNG to the RFIRM folder.

  6. #16
    Professional User Mij's Avatar
    Join Date
    Mar 2007
    Location
    Camberley, Surrey, UK
    Posts
    2,758
    Version
    IrfanView 4.51
    OS
    32-bit Win 10
    CPU Cores
    3

    Default

    Sorry. I am giving you the wrong information here. The Command prompt window should not close when the operation is complete. It should just display another prompt.

    I just tried a big multiple file /advancedbatch operation like the one being discussed and the new prompt appeared after a very short delay. The Irfanview operation went on for several minutes before completion but the Command prompt window remained open even after it was all finished.

    On the other hand the window for a batch file doing the same job remained open until Irfanview had completed the whole task and then closed. I had to include a Pause line to keep it open after Irfanview had finished.

  7. #17
    IV Newbie
    Join Date
    Jun 2010
    Posts
    3

    Default Batch Batch?

    I would like to use IrfanView to convert files in various directories. Can I use a batch script for this? It might contain lines like this:

    IrfanView convert D:\Folder1\File1.jpg to be D:\Folder2\File1.pdf
    IrfanView convert D:\Folder3\File1.pdf to be E:\Folder7\Filex.bmp

    I would have located my source files by running DIR File*.* /s > FileList.txt at the D:\ prompt. I would then alter the lines in FileList.txt to produce FileList.bat, with lines like those shown above.

  8. #18
    Professional User Mij's Avatar
    Join Date
    Mar 2007
    Location
    Camberley, Surrey, UK
    Posts
    2,758
    Version
    IrfanView 4.51
    OS
    32-bit Win 10
    CPU Cores
    3

    Default

    Yes. You will find the Command line options in the Overview chapter of the Irfanview help file. Read the examples for Conversion to see the format for command lines that you can put into a batch script. Were you thinking of creating a long batch file with a separate command line for each conversion you want or are you aiming for the batch file to read each path and filename from the text file as it does the conversions?

  9. #19
    Professional User Mij's Avatar
    Join Date
    Mar 2007
    Location
    Camberley, Surrey, UK
    Posts
    2,758
    Version
    IrfanView 4.51
    OS
    32-bit Win 10
    CPU Cores
    3

    Default Sending key strokes to Irfanview

    There are many actions that are possible in the Irfanview GUI but not from a Command line option. In that case it may be necessary to send keystrokes to Irfanview from outside the program. So I thought I would just record here how I do that using a Visual Basic script (VBS).
    VBS runs under Wscript.exe and it is necessary to first create a Wscript shell object to use its sendkeys function. In the VBS script below the keys Alt+i, f and b are sent to produce the Blur effect. Since a second dialog is opened after the f is sent a 100msec delay has been put in before sending the b. This may not be needed but does illustrate how it is done if necessary.
    Code:
    Set Shell=WScript.CreateObject("WScript.Shell")
    Shell.Sendkeys "%if"
    Wscript.Sleep 100
    Shell.Sendkeys "b"
    Set Shell = Nothing
    This works fine if the Irfanview window was opened from the script since the focus is in that window and the key strokes are sent to the right place. If the VBS script is to be started from a shortcut after the Irfanview window has been opened though, the action of starting the script will have moved the focus away from Irfanview. The focus then needs to be switched back to Irfanview before sending the keystrokes. This presents a problem because it is necessary to know the name of the application window and Irfanview creates a complex name such as "image1.jpg - Irfanview (Zoom: 1100 x 820)" so that it can be displayed in the Caption bar above the image.
    If you have a program like Microsoft Word installed you can borrow its ability to supply the names of all the application windows currently running on the computer and search for one that contains the word "Irfanview" in it, and that is what I have done in the script below which sends the keys e, Alt+g and Esc to automatically open Google Earth to show the GPS position recorded in the Exif data.
    Code:
    Set Shell=WScript.CreateObject("WScript.Shell")
    Set Word = CreateObject("Word.Application")
    Set Tasks = Word.Tasks
    For Each Task in Tasks
     If Task.Visible And instr(Task.name, "IrfanView") >0 then Shell.AppActivate Task.name : Exit for
    Next
    Wscript.Sleep 10
    Shell.Sendkeys "e%g{esc}"
    Set Shell = Nothing
    Word.Quit
    As usual just copy and paste the code into Notepad and Save as, for example, "Google_earth.vbs" making sure that you select "All files" from the drop down so that Notepad does not automatically add ".txt" to it.
    I made Google_earth.vbs my second External editor and could then call it (from Irfanview v4.30) by pressing the hotkey Shift+2. You could equally well call it from a desktop shortcut that uses a hotkey as long as it does not conflict with any in Irfanview.

    Here is a link to information about the Windows Script Host Sendkeys function.
    Last edited by Mij; 29.09.2011 at 09:44 PM. Reason: Added link at bottom.

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
  •