Code: Select all
IfWinActive, ahk_exe firefox.exe
Code: Select all
IfWinActive, ahk_exe firefox.exe
Code: Select all
; keyword list, Case Sensitive
Keyword := "YouTube,Notion,Instagram"
!a::
WinGetTitle, Title, A ;Get Window Title
loop, Parse, Keyword, `, ;Keyword slicing
{
while inStr(Title, A_LoopField) { ;while keyword in title
switch A_LoopField { ;which keyword
case "Notion":
msgbox Notion
case "YouTube":
msgbox YouTube
case "Instagram":
msgbox ins
return
}
return
}
}
return
telanx wrote: ↑17 Jan 2020, 20:13An easy way is to match if a keyword exists in the title and then run the function you need.Code: Select all
; keyword list, Case Sensitive Keyword := "YouTube,Notion,Instagram" !a:: WinGetTitle, Title, A ;Get Window Title loop, Parse, Keyword, `, ;Keyword slicing { while inStr(Title, A_LoopField) { ;while keyword in title switch A_LoopField { ;which keyword case "Notion": msgbox Notion case "YouTube": msgbox YouTube case "Instagram": msgbox ins return } return } } return
I know ^^. I tried it but it just not work after the Keyword..
Thanks for you answer. Mhh I changed it a little bit but I think it was only the case options and the keyword I think. I try to make a automative login for the Protonmail login. ^^boiler wrote: ↑13 Feb 2020, 13:50And you're sure the browser is the active window (and it's open to one of those sites) when you press Alt+A?
If you changed the code at all, even to different keywords, you might want to post your code because slight differences that don't seem important can cause issues when dealing with this stuff.
Code: Select all
; my encrypted login data
temporarybenutzer1 := b64Decode(protonbenutzer)
temporarypasswort1 := b64Decode(protonpasswort)
run https mail.protonmail.com /login Broken Link for safety
; I copied the title from the site but if it´s open it changed to a "Login | ProtonMail" ..
Keyword := "Login - ProtonMail"
!a::
WinGetTitle, Title, A ;Get Window Title
loop, Parse, Keyword, `, ;Keyword slicing
{
while inStr(Title, A_LoopField) { ;while keyword in title
switch A_LoopField { ;which keyword
case "Login - ProtonMail":
msgbox,, Login - ProtonMail
return
}
return
}
}
return
MsgBox,,found
Sleep, 5000
Click
send,{tab}
Sleep, 100
send %temporarybenutzer1%
Sleep, 500
send,{tab}
Sleep, 500
send %temporarypasswort1%
send {Enter}
Sleep, 500
Gosub, home
Return
Code: Select all
Gui, Destroy
temporarybenutzer1 := b64Decode(protonbenutzer)
temporarypasswort1 := b64Decode(protonpasswort)
run https://mail.protonmail.com/login
Keyword := "Login - ProtonMail"
!a::
MsgBox,,begin
WinGetTitle, Title, A ;Get Window Title
loop, Parse, Keyword, `, ;Keyword slicing
{
MsgBox,,while ; This is the last outputed msgbox..
while inStr(Title, A_LoopField)
{ ;while keyword in title
MsgBox,,switch
switch A_LoopField
{ ;which keyword
case "Login - ProtonMail":
{
MsgBox,,found
Sleep, 5000
Click
send,{tab}
Sleep, 100
send %temporarybenutzer1%
Sleep, 500
send,{tab}
Sleep, 500
send %temporarypasswort1%
send {Enter}
Sleep, 500
gosub, home
}
return
}
return
}
return
}
return
Thx for this tipp. I tried it now and as I see The Window showed me that "Login - ProtonMail" isn´t the right one because the window said "Login | ProtonMail - Mozilla Firefox". So the Browser name should be in there too.
Code: Select all
Gui, Destroy
temporarybenutzer1 := b64Decode(protonbenutzer)
temporarypasswort1 := b64Decode(protonpasswort)
run https://mail.protonmail.com/login
Keyword := "Login | ProtonMail - Mozilla Firefox"
!a::
MsgBox,,begin
WinGetTitle, Title, A ;Get Window Title
loop, Parse, Keyword, `, ;Keyword slicing
{
MsgBox,,while
MsgBox % Title "`n" A_LoopField
while inStr(Title, A_LoopField)
MsgBox % Title "`n" A_LoopField
{ ;while keyword in title
MsgBox,,switch
switch A_LoopField
{ ;which keyword
case "Login | ProtonMail - Mozilla Firefox":
{
MsgBox,,found
Sleep, 5000
Click
send,{tab}
Sleep, 100
send %temporarybenutzer1%
Sleep, 500
send,{tab}
Sleep, 500
send %temporarypasswort1%
send {Enter}
Sleep, 500
}
return
}
return
}
return
}
return
}
Code: Select all
SetTitleMatchMode, 1
Gui, Destroy
temporarybenutzer1 := b64Decode(protonbenutzer)
temporarypasswort1 := b64Decode(protonpasswort)
run https://mail.protonmail.com/login
Keyword := "Login | ProtonMail"
!a::
WinGetTitle, Title, A ;Get Window Title
loop, Parse, Keyword, `, ;Keyword slicing
{
while inStr(Title, A_LoopField)
{ ;while keyword in title
switch A_LoopField
{ ;which keyword
case "Login | ProtonMail":
Sleep, 500
Click
send,{tab}
Sleep, 100
send %temporarybenutzer1%
Sleep, 500
send,{tab}
Sleep, 500
send %temporarypasswort1%
send {Enter}
Sleep, 500
return
}
}
}
return
Users browsing this forum: Google [Bot], Rohwedder and 98 guests