simple change to script query Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
autohotkeycool
Posts: 137
Joined: 24 May 2016, 08:23

simple change to script query

16 May 2021, 11:26

Im currently using this script which if winword is active it will activate a window called "Word.png "

– I want to add a second code to this script, where if the window that's active is "chrome.exe" it will activate a window called "chrome.png"

can you tell me how I should add this to the script ?

Code: Select all

#a:: ; Win + A
    MouseGetPos,,, Hwnd
    WinGet, PN, ProcessName, % "ahk_id " Hwnd
    If (PN = "WINWORD.EXE")                                                        ; Specify the window title here.
    WinActivate, Word.png ;Activate first window with "Exchange" somewhere in the title
Return

GuiClose:
ExitApp
I know I must change text like this

Code: Select all

    If (PN = "Chrome.EXE")                                                        ; Specify the window title here.    WinActivate, Chrome.png ;Activate first window with "Exchange" somewhere in the titleReturn
but I'm not sure how I would add it to the existing script?
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: simple change to script query  Topic is solved

16 May 2021, 11:36

Try something like this

Code: Select all

#a:: ; Win + A
    MouseGetPos,,, Hwnd
    WinGet, PN, ProcessName, % "ahk_id " Hwnd
    If (PN = "WINWORD.EXE")                                                        ; Specify the window title here.
    WinActivate, Word.png ;Activate first window with "Exchange" somewhere in the title
     If (PN = "something else")    
    WinActivate, else.png
Return

GuiClose:
ExitApp

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: haomingchen1998, mikeyww and 243 guests