Search for WhatsApp tab in Firefox...

Post your working scripts, libraries and tools for AHK v1.1 and older
huzeifa88
Posts: 1
Joined: 17 Jul 2022, 05:12

Search for WhatsApp tab in Firefox...

19 Jul 2022, 06:27

I WAS searching for a way to find whatsapp while working in subtab of firefox browser
i think this code might be useful to others
also if you have better way do share...

Code: Select all


#SingleInstance force
SetTitleMatchMode,2
SetTitleMatchMode, fast
#WinActivateForce

^+W::
IfWinExist, WhatsApp
{
    WinActivate WhatsApp ; use the window found above
    if ErrorLevel
    MsgBox,,,,1
    return
}
else
{
    ifWinExist Firefox
    {

    WinActivate
    Sleep, 5
    Send ^1
    Sleep, 5
    IfWinNotExist, WhatsApp
    {
                Sleep, 5
        WinActivate Firefox
        Sleep, 5
         Send ^2
             IfWinNotExist, WhatsApp
            {
                WinActivate Firefox
                Sleep, 5
                Send ^3
                Sleep, 5
             IfWinNotExist, WhatsApp
            {
                WinActivate Firefox
                Sleep, 5
                Send ^4
                Sleep, 5
            IfWinNotExist, WhatsApp
            {
                WinActivate Firefox
                Sleep, 5
                Send ^5
                Sleep, 5
            IfWinNotExist, WhatsApp
            {
                WinActivate Firefox
                Sleep, 5
                Send ^6
                Sleep, 5
            IfWinNotExist, WhatsApp
            {
                WinActivate Firefox
                Sleep, 5
                Send ^7
                Sleep, 5
            IfWinNotExist, WhatsApp
            {
                WinActivate Firefox
                Sleep, 5
                Send ^8
                Sleep, 5
            IfWinNotExist, WhatsApp
            {
                WinActivate Firefox
                Sleep, 5
                Send ^9
                Sleep, 5
                }
                }
                }
                }
                }
                }
                }
    }
}

}
return
{
Run, C:\Users\A1\AppData\Local\WhatsApp\app-2.2222.12\WhatsApp.exe,
if ErrorLevel = ERROR
    MsgBox,,,,1
}
return

User avatar
tidbit
Posts: 1273
Joined: 29 Sep 2013, 17:15
Location: USA

Re: Search for WhatsApp tab in Firefox...

19 Jul 2022, 15:11

"also if you have better way do share..."

look into Loops and a_username, doubt most people have an "A1" username.
and the ctrl+1/2/3/4... could be reduced to 10x less code. no need the }}}}}}}}}}}}}}}}}}}}}}}}}}

... probably
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
User avatar
Bugz000
Posts: 93
Joined: 30 Sep 2013, 10:01

Re: Search for WhatsApp tab in Firefox...

19 Jul 2022, 15:12

huzeifa88 wrote:
19 Jul 2022, 06:27
I WAS searching for a way to find whatsapp while working in subtab of firefox browser
i think this code might be useful to others
also if you have better way do share...

Code: Select all


#SingleInstance force
SetTitleMatchMode,2
SetTitleMatchMode, fast
#WinActivateForce

^+W::
IfWinExist, WhatsApp
{
    WinActivate WhatsApp ; use the window found above
    if ErrorLevel
    MsgBox,,,,1
    return
}
else
{
    ifWinExist Firefox
    {

    WinActivate
    Sleep, 5
    Send ^1
    Sleep, 5
    IfWinNotExist, WhatsApp
    {
                Sleep, 5
        WinActivate Firefox
        Sleep, 5
         Send ^2
             IfWinNotExist, WhatsApp
            {
                WinActivate Firefox
                Sleep, 5
                Send ^3
                Sleep, 5
             IfWinNotExist, WhatsApp
            {
                WinActivate Firefox
                Sleep, 5
                Send ^4
                Sleep, 5
            IfWinNotExist, WhatsApp
            {
                WinActivate Firefox
                Sleep, 5
                Send ^5
                Sleep, 5
            IfWinNotExist, WhatsApp
            {
                WinActivate Firefox
                Sleep, 5
                Send ^6
                Sleep, 5
            IfWinNotExist, WhatsApp
            {
                WinActivate Firefox
                Sleep, 5
                Send ^7
                Sleep, 5
            IfWinNotExist, WhatsApp
            {
                WinActivate Firefox
                Sleep, 5
                Send ^8
                Sleep, 5
            IfWinNotExist, WhatsApp
            {
                WinActivate Firefox
                Sleep, 5
                Send ^9
                Sleep, 5
                }
                }
                }
                }
                }
                }
                }
    }
}

}
return
{
Run, C:\Users\A1\AppData\Local\WhatsApp\app-2.2222.12\WhatsApp.exe,
if ErrorLevel = ERROR
    MsgBox,,,,1
}
return

for the love of god

Code: Select all

#SingleInstance force
SetTitleMatchMode,2
SetTitleMatchMode, fast
#WinActivateForce

^+W::
IfWinExist, WhatsApp
{
    WinActivate WhatsApp ; use the window found above
    if ErrorLevel
    MsgBox,,,,1
    return
}
else
{
	loop 9
		{
			IfWinNotExist, WhatsApp
				{
					WinActivate Firefox
					Sleep, 5
					Send ^%A_index%
					Sleep, 5
				}
			
		}
}
return
{
Run, C:\Users\A1\AppData\Local\WhatsApp\app-2.2222.12\WhatsApp.exe,
if ErrorLevel = ERROR
    MsgBox,,,,1
}
return
here's one optimisation for you
Image
||-------[-HP-ML350E-G8-]-------||-[-32-core-xeon-]-||--[-48gb-ECC-]--||
||----[-Dell-Poweredge-r610-]---||-[-16-core-xeon-]-||--[-16gb-ECC-]--||
||-[-Lenovo-ThinkPad-x201-tab-]-||---[-4-core-i7-]--||-[-8gb-nonECC-]-||
||---------------------------[-shack--img-]---------------------------||
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

Re: Search for WhatsApp tab in Firefox...

19 Jul 2022, 15:32

we need more scripts like this!

:headwall:
:headwall:
:headwall:
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
Ronib
Posts: 1
Joined: 16 Apr 2023, 23:43

Re: Search for WhatsApp tab in Firefox...

16 Apr 2023, 23:56

Bugz000 wrote:
19 Jul 2022, 15:12
Aero WhatsAppfor the love of god

Code: Select all

#SingleInstance force
SetTitleMatchMode,2
SetTitleMatchMode, fast
#WinActivateForce

^+W::
IfWinExist, WhatsApp
{
    WinActivate WhatsApp ; use the window found above
    if ErrorLevel
    MsgBox,,,,1
    return
}
else
{
	loop 9
		{
			IfWinNotExist, WhatsApp
				{
					WinActivate Firefox
					Sleep, 5
					Send ^%A_index%
					Sleep, 5
				}
			
		}
}
return
{
Run, C:\Users\A1\AppData\Local\WhatsApp\app-2.2222.12\WhatsApp.exe,
if ErrorLevel = ERROR
    MsgBox,,,,1
}
return
here's one optimisation for you
Great...well optimized...reduced the size a lot. Appreciate it.
User avatar
Animan8000
Posts: 58
Joined: 11 May 2022, 05:00
Contact:

Re: Search for WhatsApp tab in Firefox...

19 Apr 2023, 06:02

@tidbit

A_Username doesn't necessarily have same name as the user folder does because unfortunately there are edge cases possible, especially depending on how the OS was installed from my experience. A_AppData and going a path above and then into Local might be a better choice. Alternatively EnvGet for retrieving Local AppData path can be done.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: Chunjee and 90 guests