Announcement

Collapse
No announcement yet.

Using AutoHotKey with Irfanview

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Using AutoHotKey with Irfanview

    I've been using this amazingly useful free automation program with IV for years. I wonder if anyone else has and if so, would they like to share their scripts or ideas with this forum?



    For example I can right click an image within IV to get a AHK menu window open and choose from a wide selection of different options I've set up.

    Also I've got AutoHotKey (AHK) auto detecting when a IV Save as box opens and ensures the lettercase of the file name is to my style or it adds a crop word to the crop option and autosaves it for me.

    Just allows me to be more more productive.
    Attached Files
    Stuart Halliday

    #2
    sharing scripts

    Can you share your scripts, please

    Comment


      #3
      Ctrl+Shift+C --> copy file path to clipboard

      I use Autohotkey to make Ctrl+Shift+C copy file path to clipboard. That involve sending I and Tab three times, so it's a dirty solution so to speak - but it works

      Exept from that I really haven't found that many useful ways to utilise ahk on Irfanview. Well, exept I have a plan to make a script with shortcuts for faster toggling between most used wiew/zoom. However, it still does involve the menu actually pops up, just much faster than I do manually.

      Marti - what is described above isn't that much to share. You will get much more back if you just read the ahk help file and find out how to make a simple script.
      If it hurts not to drint, don't waste the bottle then.

      Comment


        #4
        What would be very useful (but that feature doesn't exist) is to be able to retreive the image path for currently opened file - using methods that doesn't relies of using visible menus.
        If that was possible, I would try to make a sort of database (plain text) where images had categories.
        If it hurts not to drint, don't waste the bottle then.

        Comment


          #5
          If that was possible, I would try to make a sort of database (plain text) where images had categories
          Some years back I wrote a Visual Basic Script file to extract information using the Irfanview \info command line option from files in a list in order to put them into an Excel database. It is still on the forum here (post number 4) .
          It might give you some ideas for using AHK to do something similar.
          Last edited by Mij; 29.10.2016, 09:50 PM.

          Comment


            #6
            Does the /info command gives info about the file that is currently displayed by IV?

            My goal is to have a system that make me able to add categories for each single file (not thumbnail mode).
            If it hurts not to drint, don't waste the bottle then.

            Comment


              #7
              This AHK code demonstrates how to get path of the currently opened file (by pressing F10 key when IrfanView window is active).
              Code:
              F10::
              	WinGet, IView_pid, PID, A
              	WinGetClass, Var , ahk_pid %IView_pid%
              	If var=IrfanView
              		MsgBox % RTrim(GetArrProcComLine(IView_pid)[2], """")
              	Return
              GetArrProcComLine(PID_Target){
              	ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process WHERE ProcessId = " . PID_Target)._NewEnum.next(x)
              	Return StrSplit(x.CommandLine , ["""" A_Space """", """" A_Tab """"])
              }

              Comment


                #8
                Code doesn't work for me

                Thanks for trying, kay - but I dodn't get it to work. I modified it slightly to read the result for every window - but whenever IrfanView is active window, it returns nothing.

                The OS language is norwegian - does the dll call fail for other language os?

                Code:
                #persistent
                SetTimer, justDoIt, 200
                	
                justDoIt:
                	WinGet, IView_pid, PID, A
                	WinGetClass, Var , ahk_pid %IView_pid%
                	If (var="IrfanView") {
                		T := RTrim(GetArrProcComLine(IView_pid)[2], """")	; Error - returns empty whenever IV is running.
                		TrayTip, IrfanView open file, E %T%
                	}
                	Else
                		TrayTip, Funker IKKE, Variabelen var er`n%var%
                Return
                
                GetArrProcComLine(PID_Target){
                	ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process WHERE ProcessId = " . PID_Target)._NewEnum.next(x)
                	Return StrSplit(x.CommandLine , ["""" A_Space """", """" A_Tab """"])
                }
                [edit]
                The only purpose for letter E is that TrayTip goes away if second parameter is an empty string. This way, I'll see the traytip also when empty string.
                Last edited by Sprintdriver; 31.10.2016, 12:51 AM. Reason: letter e
                If it hurts not to drint, don't waste the bottle then.

                Comment


                  #9
                  Sprintdriver,
                  I tested your code.
                  The OS language does not matter.
                  In your case it does not work, because you start IrfanView without opening a file and then you open some file. This code is specified for showing what file the instance of IrfanView is started with.

                  Comment


                    #10
                    Code is ment for a different task

                    Okay thanks for explanation, kay.

                    So when scrolling througt files within a folder the following statement is most often true:
                    Code:
                    "currently displayed file" != "file path passed to irfanview.exe from start"
                    Therefore the code have no use for me at the moment, because it doesn't solve the problem.
                    If it hurts not to drint, don't waste the bottle then.

                    Comment


                      #11
                      Sprintdriver

                      The \info option is not much help if all you want to record is the path and name of the image being viewed.

                      The option has to be part of a Command line which opens Irfanview with an image (either visible or not). A set of information is saved into your specified textfile for each image you open this way with the same fields that are shown in the Information dialog. One of those fields is the full path and filename but of course it is the same as what you have just put into your command line to tell Irfanview which file to open in the first place. The usefulness of that script file I wrote is in all the other data fields that are saved in the text file.

                      If you just want to log the path and filename of selected files as you view them you can use the slideshow dialog. To start press W to open the Slideshow dialog and click Remove All to clear the list. Close the Slideshow dialog and start browsing. Every time you find a file that you want to log just press F4. When you have finished open the Slideshow dialog again and all the files with paths are listed there ready to be saved as a text file.

                      Comment


                        #12
                        Sprintdriver,
                        I modified your code, so that it displays a name of the current file opened in IrfanView.
                        Code:
                        #persistent
                        SetTimer, justDoIt, 200
                        	
                        justDoIt:
                        	WinGet, IView_pid, PID, A
                        	WinGetClass, Var , ahk_pid %IView_pid%
                        	If (var="IrfanView"){
                        		WinGetTitle, title, ahk_pid %IView_pid%
                        		TrayTip, IrfanView open file, % "E " SubStr(title, 1, InStr(title, " - ", , 0))
                        	}
                        	;Else
                        		;TrayTip, Funker IKKE, Variabelen var er`n%var%
                        Return
                        Last edited by kay; 01.11.2016, 10:09 AM.

                        Comment

                        Working...
                        X