Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Using AutoHotKey with Irfanview

  1. #1
    IV Beginner quatermass's Avatar
    Join Date
    Feb 2006
    Location
    Livingston, UK
    Posts
    36
    Version
    IrfanView 4.51
    OS
    64-bit Win 10
    CPU Cores
    4

    Default 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?

    https://autohotkey.com/

    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 Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Clipboard06.png 
Views:	587 
Size:	13.4 KB 
ID:	4337  
    Stuart Halliday

  2. #2
    IV Beginner
    Join Date
    Aug 2011
    Posts
    58
    Version
    IrfanView 4.38
    OS
    64-bit Win 7 Professional SP1
    CPU Cores
    8

    Default sharing scripts

    Can you share your scripts, please

  3. #3
    Hobby User Sprintdriver's Avatar
    Join Date
    Aug 2006
    Location
    Norway
    Posts
    157
    OS
    32-bit Linux Distribution
    CPU Cores
    4

    Talking 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.

  4. #4
    Hobby User Sprintdriver's Avatar
    Join Date
    Aug 2006
    Location
    Norway
    Posts
    157
    OS
    32-bit Linux Distribution
    CPU Cores
    4

    Default

    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.

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

    Default

    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 at 09:50 PM.

  6. #6
    Hobby User Sprintdriver's Avatar
    Join Date
    Aug 2006
    Location
    Norway
    Posts
    157
    OS
    32-bit Linux Distribution
    CPU Cores
    4

    Default

    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.

  7. #7
    IV Amateur
    Join Date
    Jun 2016
    Location
    Rostov-on-Don
    Posts
    13
    Version
    IrfanView 4.50
    OS
    64-bit Linux Distribution

    Default

    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 """"])
    }

  8. #8
    Hobby User Sprintdriver's Avatar
    Join Date
    Aug 2006
    Location
    Norway
    Posts
    157
    OS
    32-bit Linux Distribution
    CPU Cores
    4

    Default 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 at 12:51 AM. Reason: letter e
    If it hurts not to drint, don't waste the bottle then.

  9. #9
    IV Amateur
    Join Date
    Jun 2016
    Location
    Rostov-on-Don
    Posts
    13
    Version
    IrfanView 4.50
    OS
    64-bit Linux Distribution

    Default

    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.

  10. #10
    Hobby User Sprintdriver's Avatar
    Join Date
    Aug 2006
    Location
    Norway
    Posts
    157
    OS
    32-bit Linux Distribution
    CPU Cores
    4

    Default 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.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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