What window is active after click toast notification - AHK - autohotkey

i'm browsing google chrome then toast notification appears on bottom right.
i click it and it disappears.
after that i can see google chrome as top window, it looks like a active window but it's not activated.
then sometimes i press ctrl+t to open new tab in google chrome but it doesnt work because its not activated.
its annoying.
i want to make like below one.
#If WinActive("After Click Toast")
^t::
WinActivate ahk_exe chrome.exe
WinWaitActive ahk_exe chrome.exe
Send %A_ThisHotkey%
return
after click toast, windows spy doesnt show anything.
MsgWinTitle(){
WinGet, ExStyle, ExStyle, A
MsgBox % ExStyle
return
}
but with this shows 0x08200000
i dont know how can i use this though.
thanks for read.
thanks for help.

Thanks for Big advise
now i solved it with this
#If WinActive("ahk_class Windows.UI.Core.CoreWindow")
~LButton:: return
~LButton Up::
Send {Alt Down}{Tab}{Alt Up}
return

Related

AutoHotkey script to right click and save an image in Word

I am trying to make a script to allow me to right click on an image and use the context menu to save it as an image at the default location and with the default image name that Word selects. I am trying to reduce a (Right Click -> Button press -> Enter) sequence to just a Ctrl + RClick combo.
Context menu screenshot
Default location and image name
This is what I have right now, which does not work:
^RButton::
MouseClick, right
Sleep, 500
Send, s
Sleep, 500
Send, {Enter}
return
Apologies if I am doing something stupid, I just started using ahk today.
Try
#IfWinActive ahk_exe WINWORD.EXE ; only if MS Word is the active window
^RButton::
KeyWait, Ctrl, L ; wait for the Control key to be released
Click right
WinWait, ahk_class Net UI Tool Window ; Word's context menu
WinActivate, ahk_class Net UI Tool Window
WinWaitActive, ahk_class Net UI Tool Window
Send, s
WinWait, Save As Picture
WinActivate, Save As Picture
WinWaitActive, Save As Picture
Send, {Enter}
return
#IfWinActive
https://www.autohotkey.com/docs/commands/_IfWinActive.htm

AutoHotKey alt stays pressed

I have this script
+#^a::
SetTitleMatchMode 2
IfWinExist InterCounter
{
WinActivate
Send x
Send !{ESC}
}
return
after using it, alt stays pressed and I have to press alt on my keyboard to get to normal state (no key pressed). If I forget to do it and type something, a key shortcut is initiated. If I type SPACE for example, ALT+SPACE is pressed.
I tried various things. {Alt up} and other. They did not work. Where is the problem? Is there a fix for my script?
(would do that in a comment if I could)
try to Send , {ALT down}{ALT up} which should do the trick. If not something else is interfering, like a 3d party program. Try close everything on your system except notepad and the AHK-script and see if that helps.

How to activate a window after it has lost focus?

So i am using this great software called Website-Watcher, which is rss feed reader and web content tracker.
I have configured it to open external links in firefox, which is opening tabs in the background.
BUT the problem is that Website-Watcher looses focus after i hit some link, so is there a way to open a link, regain lost focus and send click to be able to scroll, i have found a script that activates window on mouse scroll BUT the scroll functionality of program is not regained.
Please, give me some ideas!
EDIT UPDATE::: I have finally made it work, the problem was with the Windows 8.1 Admin rights, because i run Website-Watcher elevated, script that i was using stopped working.
The scripts are here:
http://www.autohotkey.com/board/topic/6292-send-mouse-scrolls-to-window-under-mouse/
http://www.autohotkey.com/board/topic/99405-hoverscroll-verticalhorizontal-scroll-without-focus-scrollwheel-acceleration/?p=623967
With those scripts you can perform scroll without activating windows or if you use the former you can even activate windows with mouse scroll.
Use WinActivate
For example, WinActivate Untitled - Notepad would activate (bring focus to) the window "Untitled - Notepad". This title must be exact and is case-sensitive.
It might be easiest to do this in a low-tech way. I'm not familiar with Website-Watcher, so I'll share a script I use that you should be able to adapt.
I use Feedly in Chrome for RSS reading, and hitting "v" in Feedly opens the story in a new tab. I use my Media Play button to hit "v" and bring me back to Feedly:
Media_Play_Pause::
send v
sleep 50
send {Ctrl Down}{Shift Down}{Tab}{Shift Up}{Ctrl Up}
return
So, define your hotkey, have it trigger the link to open in Firefox, and then hit Alt-Tab to jump back:
X::
send y
sleep 50
send {Alt Down}{Tab}{Alt Up}
return
Obviously, replace "X" and "y" above.
I don't care about using my Media Play button for anything else, but if you want your hotkey to be context sensitive, use #IfWinActive.
Use "WinGet, variableName , List, yourWindowName" (without quote)
then call your variableName contate it with 1 in every ControlSend
for example :
WinGet, nexid, List, myHyperTerminal
ControlSend, , {shift down}at=cmgs{shift up}=303{ENTER}, ahk_id %nexid1%
sleep, 1000
ControlSend, , {shift down}sms{shift up}{space}10000, ahk_id %nexid1%
sleep, 1000
if you want to use control key such as shift, ctrl, alt, don't forget to add "SetKeyDelay, intDelay, intPressDuration" (without quote)
for example the script will be list this
#usehook on
SetKeyDelay, 50, 20
WinGet, nexid, List, zz1
$F6::
ControlSend, , {shift down}at=cmgs{shift up}=303{ENTER}, ahk_id %nexid1%
sleep, 1000
ControlSend, , {shift down}sms{shift up}{space}10000, ahk_id %nexid1%
sleep, 1000
return
$F7::pause
it will be sent to active/inactive window "zz1" as :
AT+CMGS=303
SMS 10000

Having Problems running Auto Hot Key in "ahk_class SWT_Window0" windows

I'm not sure if this is common or not but I cannot get my code to run in this type of window. It works in all of my other windows except for the one, ahk_class SWT_Window0, I want it to work in... go figure.
My code is:
RButton::
SendInput {Click 166,350}
return
Pretty simple just move the cursor and click. It works in google chrome wundow spy scite and various other windows but not with the correct window. Any help would be awesome thanks!
Jack,
Have you tried to use the scan codes directly in your application?
Here is an example. It clicks the mouse at the current location and then sends a {Tab}. You need to change this for your needs. You can move your mouse to the right location first with MouseMove,%XPos3%,%YPos3%
F8:: ; Press F8 to start macro
Send, {vk01} ; Click left mouse button
;Send, {scYYY} ;
Send, {vk09sc00F} ; Send the Vk and SC codes for the {Tab} key.
Return
Let me know if this works

Press a button with postmessage

There is a way to make a mouse click with postmessage, a solution without moving the mouse (no click x, y)?
For example:
loop{
hotkey,ctrl,pressb
}
pressb:
msgbox a button
PostMessage, 0x0201, , 9765141, ahk_class #32770
PostMessage, 0x0202, , 9765141, ahk_class #32770
; or ControlClick, x95 y115, ahk_class #32770
return
Functions PostMessage and ControlClick don't work, the button is not pressed.
Each of these should work
ControlClick, Button1, ahk_class #32770
ControlClick, OK, ahk_class #32770
I had the same problem (until just recently). Most of the AutoHotKey interactive commands (such as SendMessage, ControlClick, SendRawMessage and so on) does not work within a 32700 window (a dialog) as well as other windows.
Solution: If you're running Windows 7. You need to run your AHK script as an administrator. To do this, right click on your AutoHotKey Script and click on 'Run as administrator'.