#IfWinActive Microsoft Photos full screen Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Mutinous
Posts: 30
Joined: 02 Jun 2022, 06:56

#IfWinActive Microsoft Photos full screen

03 Apr 2024, 08:44

Hello, i have this script working on Microsoft photos on windowed mode but not working if photos on full screen mode, using windows 11..

How i can make it work on full screen mode?

Code: Select all

#IfWinActive ahk_exe ApplicationFrameHost.exe, Photos
XButton2::
Send, {Right Down}
KeyWait, XButton2
Send, {Right Up}
Return

XButton1::
Send, {Left Down}
KeyWait, XButton1
Send, {Left Up}
Return
Best Wishes

[Mod edit: Replaced quote tags with [code][/code] tags.]
tabr3
Posts: 22
Joined: 25 Feb 2024, 04:06

Re: #IfWinActive Microsoft Photos full screen

04 Apr 2024, 02:03

Code: Select all


#IfWinActive ahk_exe ApplicationFrameHost.exe, Photos

XButton2::
WinGet, wstate, MinMax, ahk_exe ApplicationFrameHost.exe
if (wstate) {
Send, {Right Down}
KeyWait, XButton2
Send, {Right Up}
}
Return

XButton1::
WinGet, wstate, MinMax, ahk_exe ApplicationFrameHost.exe
if (wstate) {
Send, {Left Down}
KeyWait, XButton1
Send, {Left Up}
}
Return
Untested, hope it will work XD
Mutinous
Posts: 30
Joined: 02 Jun 2022, 06:56

Re: #IfWinActive Microsoft Photos full screen

04 Apr 2024, 03:06

N, its not working on full screen mode
tabr3
Posts: 22
Joined: 25 Feb 2024, 04:06

Re: #IfWinActive Microsoft Photos full screen

04 Apr 2024, 03:35

Code: Select all

Settitlematchmode, 2


; to 

#IfWinActive ahk_exe ApplicationFrameHost.exe Photos

; or

#if winactive("Photos ahk_exe ApplicationFrameHost.exe")

; or incase

#if winactive("Photo ahk_exe ApplicationFrameHost.exe")

; or incase2

#IfWinActive ahk_exe ApplicationFrameHost.exe

After rechecking, I believe the main problem arises from the comma in your original #if statement. Removing it only and leave the rest should resolve the issue.
User avatar
boiler
Posts: 17242
Joined: 21 Dec 2014, 02:44

Re: #IfWinActive Microsoft Photos full screen

04 Apr 2024, 05:18

It’s best to list the title’s text first, per the WinTitle documentation.

Code: Select all

#IfWinActive Photos ahk_exe ApplicationFrameHost.exe

WinTitle - Multiple Criteria wrote:When using this method, the text of the title (if any is desired) should be listed first, followed by one or more additional criteria.
Mutinous
Posts: 30
Joined: 02 Jun 2022, 06:56

Re: #IfWinActive Microsoft Photos full screen

04 Apr 2024, 07:29

tabr3 wrote:
04 Apr 2024, 03:35

Code: Select all

Settitlematchmode, 2


; to 

#IfWinActive ahk_exe ApplicationFrameHost.exe Photos

; or

#if winactive("Photos ahk_exe ApplicationFrameHost.exe")

; or incase

#if winactive("Photo ahk_exe ApplicationFrameHost.exe")

; or incase2

#IfWinActive ahk_exe ApplicationFrameHost.exe

After rechecking, I believe the main problem arises from the comma in your original #if statement. Removing it only and leave the rest should resolve the issue.

"#IfWinActive ahk_exe ApplicationFrameHost.exe" this line makes the sccript work with all microsoft apps not just the photos cuz they all come with same class and process, i did try #if with space like how u suggested and didnt work
Mutinous
Posts: 30
Joined: 02 Jun 2022, 06:56

Re: #IfWinActive Microsoft Photos full screen

04 Apr 2024, 07:34

boiler wrote:
04 Apr 2024, 05:18
It’s best to list the title’s text first, per the WinTitle documentation.

Code: Select all

#IfWinActive Photos ahk_exe ApplicationFrameHost.exe

WinTitle - Multiple Criteria wrote:When using this method, the text of the title (if any is desired) should be listed first, followed by one or more additional criteria.
i did try the title first, but it didnt work at all even in windowed mode
Mutinous
Posts: 30
Joined: 02 Jun 2022, 06:56

Re: #IfWinActive Microsoft Photos full screen

04 Apr 2024, 08:26

The windows spy shows that title text dispersed in full screen mode

https://prnt.sc/6KpHmJFvxspB
[Mod edit: Removed img tags because they only work when the URL is to an image, not to a webpage showing an image (even though the link isn't really needed since the image was also provided as an attachment).]
Attachments
Untitled.png
Untitled.png (47.28 KiB) Viewed 152 times
User avatar
boiler
Posts: 17242
Joined: 21 Dec 2014, 02:44

Re: #IfWinActive Microsoft Photos full screen  Topic is solved

04 Apr 2024, 10:22

Note that it's very important to to make sure your script has SetTitleMatchMode, 2 since the title doesn't start with the word "Photos".
Mutinous
Posts: 30
Joined: 02 Jun 2022, 06:56

Re: #IfWinActive Microsoft Photos full screen

04 Apr 2024, 10:40

boiler wrote:
04 Apr 2024, 10:22
Note that it's very important to to make sure your script has SetTitleMatchMode, 2 since the title doesn't start with the word "Photos".
aha, my bad, i have long script with many #IfWinActive sections, so i put SetTitleMatchMode, 2 before photos app part and this is why it didnt work, wasnt know it must be at the start of the script

Many thanks for your help
User avatar
boiler
Posts: 17242
Joined: 21 Dec 2014, 02:44

Re: #IfWinActive Microsoft Photos full screen

04 Apr 2024, 11:24

It needs to be executed, of course, and it won't be if it appears after a hotkey (unless the code flow is routed to it, such as in a labeled procedure, and even that isn't the correct approach when it's needed for #If directives). That's why it needs to be at the top. See Structure of a Script.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: pgeugene and 75 guests