Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hey, I finally got to modify your script and can now give feedback. Firstly, here's the new code:
- F6::runOrActivate("Messenger", "https://www.messenger.com/", "Profile 2")
- F7::runOrActivate("Messenger", "https://www.messenger.com/", "Profile 4")
- runOrActivate(title, url, profile) { path := "4.1.1.1.1.1.1" ; Tab group
- SetTitleMatchMode 2
- WinGet windows, List, - Google Chrome
- loop % windows
- {
- hWnd := WinExist("ahk_id" windows%A_Index%)
- winAcc := Acc_ObjectFromWindow(hWnd, 0)
- winTitle := Acc_Get("Name", 4,, winAcc)
- winProfile := StrSplit(winTitle, " - ").Pop()
- if (winProfile != profile)
- continue
- loop % Acc_Get("ChildCount", path,, winAcc)
- {
- if A_Index > 9
- continue
- tabTitle := Acc_Get("Name", path "." A_Index,, winAcc)
- if InStr(tabTitle, title)
- {
- WinActivate
- WinWaitActive
- Send % "^" A_Index
- return
- }
- }
- }
- Run % "chrome.exe --profile-directory=""" profile """ " url
- }
- I got Acc.ahk properly integrated to my system and my installation of AHK so it ran successfully, but not as expected. It still opens new tabs of the same websites that I added at the top of this code block, in the arguments given to runOrActivate(). The window title of the website's window I'm trying to target here is Messenger - Google Chrome which I got with this method:
- ^q::
- WinGetTitle, title, A MsgBox, %title% return
- Thus, it doesn't really function differently from my original code. (This one.)
- !Numpad1::
- Run, chrome.exe --profile-directory="Profile 2" https://www.messenger.com return
- P.S.: I just made two new posts in r/AskProgramming and in this subreddit about this but with a new inquiry about Visual Basic. I'll mention you there too if you don't mind.
Advertisement
Add Comment
Please, Sign In to add comment