Photo viewer and paint

Get help with using AutoHotkey and its commands and hotkeys
pinetec
Posts: 1
Joined: 29 Jan 2019, 13:14

Photo viewer and paint

29 Jan 2019, 13:17

Hi,

I have quite a few images that I need to QC. I like viewing them in Windows Photo Viewer and when I see an issue I open the file in Paint to fix. Is it possible to write a script that I can activate that opens the current image in photo viewer into paint for editing?

Thanks
Michael
gregster
Posts: 2658
Joined: 30 Sep 2013, 06:48

Re: Photo viewer and paint

30 Jan 2019, 00:20

Welcome to the forum, Michael!

Well, the standard photo viewer is quite simplistic and shows the current photo's file name in the window header, but... there is no full path shown and it seems the file name cannot even be determined via the Wintitle of the viewer window (this seems to always show just "Photo"), at least on Win 10 - you can check with winspy.exe in your Autohotkey folder... Perhaps it can be done with the Microsoft Active Accessibility interface (see Acc.ahk), but I am not sure and I am not a fan of this method.
I also assume that you want to flip through more than one photo - so reading the file path of the first opened photo from file explorer wouldn't really help either.

I would rather take some other viewer like Irfanview which shows the filename in its Wintitle (and can be changed via its settings to show the full file path) - which can be read easily by Autohotkey; then you just could define a hotkey to run (open) this photo in mspaint.exe or whatever you like.

Btw, Irfanview even offers this feature already - in its settings you can define three editors/viewers which can be used to open the current photo (via fixed hotkeys: Shift+1... Shift+3 - these could be tweaked by AHK, if needed).
User avatar
Xtra
Posts: 1370
Joined: 02 Oct 2015, 12:15

Re: Photo viewer and paint

30 Jan 2019, 03:50

Code: Select all

$Up::
    ControlClick, Photos_ButtonEx5, ahk_class Photo_Lightweight_Viewer,, Left
    ControlClick, Photos_ButtonEx5, ahk_class Photo_Lightweight_Viewer,, Right
    /*
    Open With Menu:
    --------------------
    65001   1st menu item: Paint (on my system)
    65002   2nd menu item: etc..
    65003   3rd menu item:
    65004   4th menu item:
    65005   5th menu item:
    --------------------
    Change wParam as needed below using above list:
    */
    PostMessage, 0x111, 65001, 0, Photos_CommandBar1, ahk_class Photo_Lightweight_Viewer
return

Esc::ExitApp
; Notes:
; Needs BCN_HOTITEMCHANGE so cheesing it with clicks to save setup time.
; This is needed to update viewer so the current image opens in editor.
; Tested only on Win7 Pro

HTH
gregster
Posts: 2658
Joined: 30 Sep 2013, 06:48

Re: Photo viewer and paint

30 Jan 2019, 05:53

Ah, interesting, Xtra... yeah, we don't know what Windows version the original poster is using. But on Win10 with the new (metro) app and its ApplicationFrameHost.exe, it might be trickier...

But I just discovered that the Win10 viewer actually shows the file name in its WinTitle, but only after using at least once the right/left arrow for navigation. So, if the folder can be determined independently (by opening the first photo in file explorer) or is known anyways, this would be another way to go...

Also, it seems that in Win 10 you can re-activate the "old" photo viewer (Win 7 style) via changing the registry: https://winaero.com/blog/how-get-windows-photo-viewer-working-in-windows-10/
(But as I always hated this program, I personally wouldn't bother :shifty: )
User avatar
Xtra
Posts: 1370
Joined: 02 Oct 2015, 12:15

Re: Photo viewer and paint

30 Jan 2019, 13:34

@gregster personally i would use GDIP and automate it all.
(finding and fixing problem or at least pulling the problem ones out of the pile)
swagfag
Posts: 2718
Joined: 11 Jan 2017, 17:59

Re: Photo viewer and paint

30 Jan 2019, 14:02

use gdip to do what exactly? he says he "fixes" them in paint. this could range from resizing them to god knows what
User avatar
jeeswg
Posts: 6538
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Photo viewer and paint

30 Jan 2019, 14:58

I use this (tested on Windows 7) to get the path via the clipboard, you can then use that with Run.
How can you extract the full path of the photo visible in photo gallery? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=48993&p=218126#p218126
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Xtra
Posts: 1370
Joined: 02 Oct 2015, 12:15

Re: Photo viewer and paint

30 Jan 2019, 15:26

swagfag wrote:
30 Jan 2019, 14:02
use gdip to do what exactly? he says he "fixes" them in paint. this could range from resizing them to god knows what

Anything you can do in paint can be done using gdip.
What the problems are who knows? :roll:
AHKStudent
Posts: 472
Joined: 05 May 2018, 12:23

Re: Photo viewer and paint

30 Jan 2019, 17:28

jeeswg wrote:
30 Jan 2019, 14:58
I use this (tested on Windows 7) to get the path via the clipboard, you can then use that with Run.
How can you extract the full path of the photo visible in photo gallery? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=48993&p=218126#p218126
Tested your code on windows 10, works wonderful, I only added one line so the photo opens in paint

Code: Select all

#IfWinActive ahk_class Photo_Lightweight_Viewer ;windows photo viewer / windows live photo gallery
^p:: ;windows photo viewer - get file path
Clipboard := ""
SendInput, ^c
ClipWait, 3
vPath := Clipboard
run, mspaint %vpath%
;MsgBox, % vPath
return
#IfWinActive

Return to “Ask For Help”

Who is online

Users browsing this forum: afe, Bing [Bot], cyruz, Odlanir, vsub and 136 guests