Simply put I can't get WinActivate to activate Microsoft Teams.
Here is WindowSpy after manually activating Teams window...
...then I activate another Window (Firefox)...
...finally I try to use WinActivate Microsoft Teams ...
I've also tried the full window information in the WinActivate:
WinActivate Microsoft Teams ahk_class Chrome_WidgetWin_1 ahk_exe Teams.exe
The window never activates and the WindowSpy shows same contents each time.
Can't get WinActivate to activate Microsoft Teams
Can't get WinActivate to activate Microsoft Teams
Last edited by geekyadam on 23 Apr 2019, 11:23, edited 1 time in total.
- AlleyArtwork
- Posts: 44
- Joined: 09 Jun 2015, 21:08
Re: Can't get WinActivate to activate Microsoft Teams
i'm able to use the below successfully.
WinAvtivate, ahk_exe Teams.exe
this worked regardless of which team i was currently viewing. (wintitle seems to change based on the currently viewed team).
WinAvtivate, ahk_exe Teams.exe
this worked regardless of which team i was currently viewing. (wintitle seems to change based on the currently viewed team).
- SuperFoobar
- Posts: 83
- Joined: 23 Nov 2018, 15:14
Re: Can't get WinActivate to activate Microsoft Teams
Code: Select all
WinActivate("ahk_exe Teams.exe")
Re: Can't get WinActivate to activate Microsoft Teams
I just tried that and the window still won't activate. Also the WindowSpy still shows same contents (empty). Does this likely mean somethings up on my end? Not sure what that could be...AlleyArtwork wrote: ↑23 Apr 2019, 09:54i'm able to use the below successfully.
WinAvtivate, ahk_exe Teams.exe
this worked regardless of which team i was currently viewing. (wintitle seems to change based on the currently viewed team).
Re: Can't get WinActivate to activate Microsoft Teams
I get a "Call to nonexistent function." when trying to use that. Is there a new version of AHK I'm not aware of that has built-in WinActivate() function?
- SuperFoobar
- Posts: 83
- Joined: 23 Nov 2018, 15:14
Re: Can't get WinActivate to activate Microsoft Teams
Yes please update by running this script
Code: Select all
UrlDownloadToFile, https://www.autohotkey.com/download/, page
FileRead, page, page
FileDelete, page
RegExMatch(page, "\d+\.\d+\.\d+\.\d+", curVersion)
If (A_AhkVersion <> curVersion)
{
MsgBox, 4161, AHK Updater, AHK is out of date`n`nCurrent: %A_AhkVersion%`nLatest: %curVersion%`n`nPress OK to download latest
IfMsgBox Ok
{
FileDelete, installer.exe
UrlDownloadToFile, https://www.autohotkey.com/download/ahk-install.exe, installer.exe
Run, installer.exe
}
} else {
MsgBox, 4160, AHK Updater, AHK is up to date (%curVersion%)
}
Re: Can't get WinActivate to activate Microsoft Teams
Afaik, there is no such function called WinActivate() in the latest version of AHK 1.1, which would be 1.1.30.03 (not even in v2, it seems), there is only the command WinActivate.
Perhaps you added one function of this name in your personal user library...
Re: Can't get WinActivate to activate Microsoft Teams
AHK v1 and v2 have WinActive(), which checks if a window is active.
Only AHK v2 has WinActivate(). Although you can backport it to AHK v1. E.g.:
commands as functions (AHK v2 functions for AHK v1) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=37&t=29689
Only AHK v2 has WinActivate(). Although you can backport it to AHK v1. E.g.:
commands as functions (AHK v2 functions for AHK v1) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=37&t=29689
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Can't get WinActivate to activate Microsoft Teams
Yeah that's what I'm guessing as well...nonetheless, WinActivate ahk_exe Teams.exe does not work for me.gregster wrote: ↑23 Apr 2019, 10:35Afaik, there is no such function called WinActivate() in the latest version of AHK 1.1, which would be 1.1.30.03 (not even in v2, it seems), there is only the command WinActivate.
Perhaps you added one function of this name in your personal user library...
Any other ideas here?
Re: Can't get WinActivate to activate Microsoft Teams
Searching the v2 docs I don't see any mention of WinActivate() function: https://lexikos.github.io/v2/docs/commands/WinActivate.htmjeeswg wrote: ↑23 Apr 2019, 10:56AHK v1 and v2 have WinActive(), which checks if a window is active.
Only AHK v2 has WinActivate(). Although you can backport it to AHK v1. E.g.:
commands as functions (AHK v2 functions for AHK v1) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=37&t=29689
Re: Can't get WinActivate to activate Microsoft Teams
In AHK v2, commands and functions are equivalent. The only difference is whether you omit the parentheses or not. However, if you want to store the return value, you need the parentheses.
Code: Select all
Cmd Arg1, Arg2
Func(Arg1, Arg2)
RetValue := Func(Arg1, Arg2)
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Can't get WinActivate to activate Microsoft Teams
Also, I see that "commands as functions" is just a function that calls the command, and since I've already confirmed using the command does not work for me, then using a function to call the same command likely won't change that result.jeeswg wrote: ↑23 Apr 2019, 10:56AHK v1 and v2 have WinActive(), which checks if a window is active.
Only AHK v2 has WinActivate(). Although you can backport it to AHK v1. E.g.:
commands as functions (AHK v2 functions for AHK v1) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=37&t=29689
Re: Can't get WinActivate to activate Microsoft Teams
Did you try running as admin?
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Can't get WinActivate to activate Microsoft Teams
You could try WinGet Count. If the count is 0, you have a problem, if it is greater than 1, you might have to use WinGet List, to get the right window.
Also, you may want to turn DetectHiddenWindows on/off.
Code: Select all
WinGet, vCount, Count, ahk_class Notepad
MsgBox, % vCount
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Can't get WinActivate to activate Microsoft Teams
DetectHiddenWindows has always been on.jeeswg wrote: ↑23 Apr 2019, 11:27You could try WinGet Count. If the count is 0, you have a problem, if it is greater than 1, you might have to use WinGet List, to get the right window.Also, you may want to turn DetectHiddenWindows on/off.Code: Select all
WinGet, vCount, Count, ahk_class Notepad MsgBox, % vCount
Okay you may have helped me find my issue...
Code: Select all
WinGet wincount, count, ahk_exe Teams.exe
msgbox count: %wincount%
Soooo.....there are 28 Teams.exe windows? I only see the one that exists and the systray icon...
Re: Can't get WinActivate to activate Microsoft Teams
I just looped through all the IDs and tried activating them. None of them activated the actual Teams window.
Code: Select all
WinGet winlist, list, ahk_exe Teams.exe
Loop %winlist%
{
thisID := winlist%A_Index%
fullwinlist := fullwinlist . thisID . "`r`n"
WinActivate ahk_id thisID
msgbox activated ID %thisID%
}
Re: Can't get WinActivate to activate Microsoft Teams
Wait, scratch that, I forgot the % characters around thisID in the winactivate line...
Re: Can't get WinActivate to activate Microsoft Teams
Okay so two of the ~15 IDs activate the Teams window: 0xb0c02 and 0x205ac
Not sure which I should use...I might actually just use the Loop for the winactivate to be sure it gets activated...
Not sure which I should use...I might actually just use the Loop for the winactivate to be sure it gets activated...
Re: Can't get WinActivate to activate Microsoft Teams
You can try getting info, to identify the correct window, especially window styles/ex. styles.
Code: Select all
q:: ;get window info
WinGet, vWinList, List, ahk_class Notepad
Loop, % vWinList
{
hWnd := vWinList%A_Index%
WinGetTitle, vWinTitle, % "ahk_id " hWnd
WinGetClass, vWinClass, % "ahk_id " hWnd
WinGet, vPName, ProcessName, % "ahk_id " hWnd
;WinGet, vPID, PID, % "ahk_id " hWnd
WinGet, vWinStyle, Style, % "ahk_id " hWnd
WinGet, vWinExStyle, ExStyle, % "ahk_id " hWnd
WinGet, vCtlList, ControlList, % "ahk_id " hWnd
MsgBox, % vPName "`r`n" vWinTitle "`r`n" vWinClass "`r`n" Format("0x{:08X}`r`n0x{:08X}", vWinStyle, vWinExStyle) "`r`n`r`n" vCtlList
}
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Who is online
Users browsing this forum: AlFlo, Bing [Bot], Google [Bot] and 140 guests