Autohotkey script to bookmark to a specific folder - autohotkey

I'm using Firefox and I was looking for an autohotkey script which would enable me to skip the whole series of clicks when I bookmark a page in a specific folder and replace it with a single keyboard shortcut.
Although I've read forum threads on Autohotkey forum and here I still don't know how to make a working script that would reduce bookmarking a page to hitting a keyboard shortcut and the initial letter of the folder where I want to store that page. Using KeyWait command I've made it work for a single folder and don't know how to make it work for any letter or a number that I could possibly use as a name for a bookmark folder. Say I have a folder named XXXX, this script does send the webpage to the XXXX folder after hitting the assigned shortcut and the letter x (MouseClick command is needed to focus the window with folder in the Bookmark Dialog pane):
!+^w::
Send,^d
Sleep,400
MouseClick,Left,864,304
Sleep,400
KeyWait, x ,D
Sleep, 400
Send,^{Enter}
return
I don't know how to make this script work for any letter or number, not only for a single one. Also a big problem with this script is that it blocks the keyboard until I hit X key. If I have that page bookmarked already, hitting escape to remove the bookmark pane will block the keyboard and I can unblock it only if I rerun the autohotkey script.
I've also tried using Input command as the contributors the Autohotkey forum pages suggested, but it didn't work either, because I don't understand how the Input command works. I did make it work for a single letter as the above script with KeyWait, but that's the best I could do. This script also blocks the keyboard until the letter is hit:
!+^w::
Send,^d
MouseClick,Left,864,304
Sleep,400
Input, Character, L1
If Character = t
Send, t
Sleep,400
Send,^{Enter}
return
Hope someone can help me with this, it would be convenient simplifying the bookmarking process in Firefox this way.

I have a nice idea. This will open the add bookmark dialog and navigate you into the folder selection part and expand all folders.
All you need to do is enter the folders name (or a part of it) and it will get selected automatically. When you're done, just hit enter.
!+^w:: ;Hotkey: Ctrl+Alt+Shift+w
Send, ^d ;send Ctrl+d to open the add-bookmark dialog
Sleep, 500 ;wait for the dialog to open
Send, {Tab}{Tab}{Enter} ;navigate into the folder selection
Sleep, 300 ;wait to make sure we are there
Send,{Home} ;select the first item in the list
;The following line should expand all the folders so that you can just type the folders name to search for it
Loop, 100 { ;Increase the number if it doesn't expand all folders
SendInput, {Right}{Down} ;expand folders
}
Send, {Home} ;navigate to the first item in the list again
Input, L, V L1 T2 ;wait until you start typing a folder name (if you just wait 2 seconds, the bookmark won't be created)
If (ErrorLevel = "Timeout") {
Send, {Tab 5} ;press tab 5 times to navigate to the cancel button
Send, {Enter} ;cancel the bookmark
Return ;end of the hotkey
}
Loop { ;wait until you haven't typed a new letter for 0.4 seconds
Input, L, V L1 T0.4
If (ErrorLevel = "Timeout")
Break
}
Send, {Tab 4} ;press tab 4 times to navigate to the enter button
Send, {Enter} ;save the bookmark
Return

My variant.
Press f1 to create bookmark in folder test1.
Press f2 to create bookmark in folder test2.
SetBatchLines, -1
Folders := {F1: "test1", F2: "test2"}
#IfWinActive, ahk_class MozillaWindowClass
F1::
F2::
Folder := Folders[A_ThisHotkey]
Send, ^d
AccFirefox := Acc_ObjectFromWindow(WinExist("ahk_class MozillaWindowClass"))
AccElem := SearchElement(AccFirefox, ROLE_SYSTEM_LISTITEM := 0x22, Folder, "")
AccElem.accDoDefaultAction(0)
sleep 100
Send {Enter}
msgbox done
return
#IfWinActive
SearchElement(ParentElement, params*)
{
found := 1
for k, v in params {
(k = 1 && ParentElement.accRole(0) != v && found := "")
(k = 2 && ParentElement.accName(0) != v && found := "")
(k = 3 && ParentElement.accValue(0) != v && found := "")
}
if found
Return ParentElement
for k, v in Acc_Children(ParentElement)
if obj := SearchElement(v, params*)
Return obj
}
Acc_Init()
{
Static h
If Not h
h:=DllCall("LoadLibrary","Str","oleacc","Ptr")
}
Acc_ObjectFromWindow(hWnd, idObject = 0)
{
Acc_Init()
If DllCall("oleacc\AccessibleObjectFromWindow", "Ptr", hWnd, "UInt", idObject&=0xFFFFFFFF, "Ptr", -VarSetCapacity(IID,16)+NumPut(idObject==0xFFFFFFF0?0x46000000000000C0:0x719B3800AA000C81,NumPut(idObject==0xFFFFFFF0?0x0000000000020400:0x11CF3C3D618736E0,IID,"Int64"),"Int64"), "Ptr*", pacc)=0
Return ComObjEnwrap(9,pacc,1)
}
Acc_Query(Acc) { ; thanks Lexikos - www.autohotkey.com/forum/viewtopic.php?t=81731&p=509530#509530
try return ComObj(9, ComObjQuery(Acc,"{618736e0-3c3d-11cf-810c-00aa00389b71}"), 1)
}
Acc_Error(p="") {
static setting:=0
return p=""?setting:setting:=p
}
Acc_Children(Acc) {
if ComObjType(Acc,"Name") != "IAccessible"
ErrorLevel := "Invalid IAccessible Object"
else {
Acc_Init(), cChildren:=Acc.accChildCount, Children:=[]
if DllCall("oleacc\AccessibleChildren", "Ptr",ComObjValue(Acc), "Int",0, "Int",cChildren, "Ptr",VarSetCapacity(varChildren,cChildren*(8+2*A_PtrSize),0)*0+&varChildren, "Int*",cChildren)=0 {
Loop %cChildren%
i:=(A_Index-1)*(A_PtrSize*2+8)+8, child:=NumGet(varChildren,i), Children.Insert(NumGet(varChildren,i-8)=9?Acc_Query(child):child), NumGet(varChildren,i-8)=9?ObjRelease(child):
return Children.MaxIndex()?Children:
} else
ErrorLevel := "AccessibleChildren DllCall Failed"
}
if Acc_Error()
throw Exception(ErrorLevel,-1)
}

Related

Surrounding Clipboard with quotes in URL

Warning: I'm very new to this.
I'd like to make Google searches quicker by assigning a hotkey to search a text selection (in web browser) and surrounding that search with quotes (to get exact matches).
I've tried using bits of code I have found, but so far I can only search the selected text on Google, but don't know how to surround the selected text in quotes in the search.
^!d:: ;
prevClipboard := ClipboardAll
SendInput, ^c
ClipWait, 1
if !(ErrorLevel) {
Clipboard := RegExReplace(RegExReplace(Clipboard, "\r?\n"," "), "(^\s+|\s+$)")
If SubStr(ClipBoard,1,7)="http://"
Run, % Clipboard
else
Run, % "https://www.google.com/search?q=" Clipboard
}
Clipboard := prevClipboard
return
This simply opens a google search with the clipboard.
I cannot find out how to make it so "Clipboard" is searched instead of Clipboard.
Any suggestions? Thanks!
Run is a command and variables in commands have to be enclosed in percent signs.
To include an quote, specify two consecutive quotes twice:
Run, http://www.google.com/search?q=""%Clipboard%""
If you want to do a "Phase google search" from any Selected Text (And From Out Everywhere, on your Computer System.)
Then you can try this AHK Script.
you can [Select any Text] and then you can click the [F1] key from your Keyboard Device.
The Computer Find automatic out where it can do the Query Search (us 100x results) and what Browser it must use.
Example1.ahk
;#notrayicon
#SingleInstance force
GroupAdd, Browser, ahk_class Chrome_WidgetWin_1 ; Chrome or Iron
GroupAdd, Browser, ahk_class IEFrame ; Internet Explorer
GroupAdd, Browser, ahk_class MozillaWindowClass ; FireFox
GroupAdd, Browser, ahk_class ApplicationFrameWindow ; Edge
; here you can change the variable into exact search [
quote1 = "
; here you can change the variable into exact search ]
quote2 = "
; here you can change the variables intitle: - inurl: - inanchor: - allinurl: - allinanchor:
insearch = allintitle:
; + = Shift
; ! = Alt
; ^ = Ctrl
; # = Win (Windows logo key)
esc::exitapp ;You can click the (esc) key to stop the script.
f1::
If WinActive("ahk_group Browser")
{
sendinput ^c ;copy the selected text to clipboard memory
sleep 150
sendinput ^t ;CTRL+t make a new tab + goto address bar - use CTRL+L for the active tab + goto address bar
sleep 150
texta = https://www.google.com/?gfe_rd=cr&gws_rd=cr#q=%insearch%%quote1%
textb = %clipboard%%quote2% ;selected text
textc = &lr=lang_us&hl=us&num=100 ; google parameters
clipboard=%texta%%textb%%textc%
sleep 150
sendinput ^v ; paste the selected text
sleep 250
send {enter}
clipboard=%textb%
} else {
sendinput ^c ;copy the selected text to clipboard memory
sleep 150
texta = https://www.google.com/?gfe_rd=cr&gws_rd=cr#q=%insearch%%quote1%%quote1%
textb = %clipboard%%quote2%%quote2%%quote2% ;selected text
textc = &lr=lang_us&hl=us&num=100 ; google parameters
clipboard=%texta%%textb%%textc%
run %clipboard%
clipboard=%textb%
}
return

How to check if clipboard is equal to a predetermined number, or several numbers in AHK?

; Copy cell
var := clipboard
sleep, 1000
WinActivate, doesntmatter - Internet Explorer
IfEqual 30684047, %var%
{
sleep, 500
Send, inform
}
else
{
msgbox, nope
}
return
My problem is that even though I have the correct number (30684047) in the clipboard, the code still goes straight to the MsgBox and tells me that the clipboard (%var%) isnt equal to the predetermined code.
What am i missing? I am 100% sure that %var% contains my copied code from the clipboard because if i do a MsgBox with %var% after i copy it, it gives me a box containing that correct code.
Look back at the documentation for IfEqual...you switched var and value.
; Copy cell
var := clipboard
sleep, 1000
WinActivate, doesntmatter - Internet Explorer
IfEqual, var, 30684047
{
sleep, 500
Send, inform
}
else
{
msgbox, nope
}
return
There's really no need to save off the value of clipboard to a different variable unless you're wanting to re-use that value after clipboard has later changed. So the above could also be:
WinActivate, doesntmatter - Internet Explorer
If (clipboard = "30684047") {
sleep, 500
SendInput, inform
}
else
msgbox, nope
return

AHK! Can't get "Ctrl+Q then K" Input to work (Shortcut in Q-Dir tool)

Background:
So I use the Explorer tool Q-Dir (link to homepage).
In Q-Dir you can bookmark folder you want to access regularly.
You can shortcut to those bookmarks by pressing Ctrl + Q. This opens a jumplist of your bookmarked folders.
So I want to open my projects folder which is named "Kundenprojekte" (customer projects).
Pressing "K" while said jumplist is open, opens this folder in the current tab.
So my problem occurs here:
This whole process is what I want to map with AHK to let's say WinKey + B.
This is my code so far:
#b::
qdirId := WinExist("Q-Dir 5.98.9") ; I don't know if this works I got some
; inspiration by another AHK script
if (qdirId = 0) {
MsgBox Q-Dir ist nicht geöffnet. ; Q-Dir is not open.
IfWinExist, "Q-Dir 5.98.9"
{
WinActivate, "Q-Dir 5.98.9" ;I know this doesn't work plz help
SetKeyDelay 10,1000
Send, ^{Q}
SetKeyDelay, 10
Send {K}
return
}
}
return
Yes , so far there is no "else" to IfWinExist. And I don't think there will be because I would need to run Q-Dir as administrator (due to UAC preventing writing operation to my C: drive) But that is of no concern (because I usually start Q-Dir as my first programm after booting).
The main issue I have is getting "send Control + Q" then "K" to work.
I got it to send "K" but not once was "Ctrl + Q" recognized.
Any idea what I do wrong?
Thank you in advance :)
SetTitleMatchMode, 2 ; The window's title should contain "Q-Dir 5.98.9"
#b::
qdirId := WinExist("Q-Dir 5.98.9")
if (qdirId = 0)
{
MsgBox Q-Dir ist nicht geöffnet. ; Q-Dir is not open.
return ; stops code from going any further, to the lines below
}
; otherwise:
WinActivate, Q-Dir 5.98.9
WinWaitActive, Q-Dir 5.98.9 ; important
SetKeyDelay 10,1000
Send, ^{Q}
; Try also:
; Send, {CTRLDOWN}q{CTRLUP}
; SendEvent {CTRL DOWN}{q DOWN}{CTRL UP}{q Up}
SetKeyDelay, 10
Send {K}
return
https://autohotkey.com/docs/commands/SetTitleMatchMode.htm

AHK: closing a window whenever it pops up

I wrote an AHK script designed to copy a text from Adobe Acrobat when I press F9. It then changes it according to a regex and shows the copied text in tooltip. Additionally, I added code to automatically close an annoying window that Acrobat sometimes shows when coping a text, an infamous There was an error while copying to Clipboard. An internal error occurred. When this window doesn't show up, the script keeps showing a tooltip, which is designed to close after a specified amount of time. I've been banging my head against the wall but I don't know how to correct this.
;#NoTrayIcon
#Persistent
#SingleInstance
F9::
#If WinActive("ahk_exe Acrobat.exe")
{
Clipboard:=""
send,^c
ClipWait, 1
Clipboard := RegExReplace(Clipboard, "\r\n", " ")
SetTimer,CheckForMsgBox,100
CheckForMsgBox:
IfWinExist, Adobe Acrobat
{
Send {Enter}
SetTimer,CheckForMsgBox,Off
}
;Return
If (StrLen(Clipboard) < 120)
ToolTip % Clipboard
Else
ToolTip Copied
SetTimer, ToolTipOff, -1000
return
}
#If
ToolTipOff:
ToolTip
return
;#NoTrayIcon
; #Persistent ; (1)
#SingleInstance
SetTimer,CheckForMsgBox,100 ; (2)
return
#If WinActive("ahk_exe Acrobat.exe") ; (3)
F9::
clipboard:=""
send,^c
ClipWait, 1
Clipboard := RegExReplace(Clipboard, "\r\n", " ")
If (StrLen(Clipboard) < 120)
ToolTip %Clipboard%
Else
ToolTip Copied
SetTimer, ToolTipOff, -1000
return
#If ; turn off context sensitivity
ToolTipOff:
ToolTip
return
CheckForMsgBox:
; ControlSend, Control, Keys, WinTitle, WinText, ExcludeTitle, ExcludeText
ControlSend, , {Enter}, Adobe Acrobat ; Close this unwanted window whenever it appears
return
(1) Scripts containing hotkeys, hotstrings, or any use of OnMessage() or Gui are automatically persistent.
(2) SetTimer causes a subroutine (Label) to be launched automatically and repeatedly at a specified time interval.
https://autohotkey.com/docs/commands/SetTimer.htm
(3) Like the #IfWin directives, #If is positional: it affects all hotkeys and hotstrings physically beneath it in the script.
https://autohotkey.com/docs/commands/_If.htm

What is the right way to send Alt + Tab in Ahk?

Ok. I know this is a very stupid question.
But I'm stuck already for an hour.
I got very little experience with ahk, however I made work every script until now with no problems. I explored the ahk tutorials but found no solution up to now.
I'm trying to switch to prev. app with a single numpad off key.
I've tried:
!{Tab}
,
{Alt down}{Tab}{Alt up}
I've tried it with Sleep delays, multiline, multiline inside brackets, with and without commas after commands, etc.
I'm quite sure is very simple but something I've not tried yet.
Any suggestion?
$F1:: AltTab()
$F2:: AltTabMenu()
; AltTab-replacement for Windows 8:
AltTab(){
list := ""
WinGet, id, list
Loop, %id%
{
this_ID := id%A_Index%
IfWinActive, ahk_id %this_ID%
continue
WinGetTitle, title, ahk_id %this_ID%
If (title = "")
continue
If (!IsWindow(WinExist("ahk_id" . this_ID)))
continue
WinActivate, ahk_id %this_ID%
WinWaitActive, ahk_id %this_ID%,,2
break
}
}
; AltTabMenu-replacement for Windows 8:
AltTabMenu(){
list := ""
Menu, windows, Add
Menu, windows, deleteAll
WinGet, id, list
Loop, %id%
{
this_ID := id%A_Index%
WinGetTitle, title, ahk_id %this_ID%
If (title = "")
continue
If (!IsWindow(WinExist("ahk_id" . this_ID)))
continue
Menu, windows, Add, %title%, ActivateTitle
WinGet, Path, ProcessPath, ahk_id %this_ID%
Try
Menu, windows, Icon, %title%, %Path%,, 0
Catch
Menu, windows, Icon, %title%, %A_WinDir%\System32\SHELL32.dll, 3, 0
}
CoordMode, Mouse, Screen
MouseMove, (0.4*A_ScreenWidth), (0.35*A_ScreenHeight)
CoordMode, Menu, Screen
Xm := (0.25*A_ScreenWidth)
Ym := (0.25*A_ScreenHeight)
Menu, windows, Show, %Xm%, %Ym%
}
ActivateTitle:
SetTitleMatchMode 3
WinActivate, %A_ThisMenuItem%
return
;-----------------------------------------------------------------
; Check whether the target window is activation target
;-----------------------------------------------------------------
IsWindow(hWnd){
WinGet, dwStyle, Style, ahk_id %hWnd%
if ((dwStyle&0x08000000) || !(dwStyle&0x10000000)) {
return false
}
WinGet, dwExStyle, ExStyle, ahk_id %hWnd%
if (dwExStyle & 0x00000080) {
return false
}
WinGetClass, szClass, ahk_id %hWnd%
if (szClass = "TApplication") {
return false
}
return true
}
EDIT (suggested by the user Ooker):
The script pops up a menu for you to choose.
This is what it looks like:
If you just want to switch back to the previous application, use Send, !{Esc}
You shouldn't manually send alt+tab as it is a special windows command, rather use the AltTab commands that do that for you.
AltTabMenu opens the tab menu and selects the program, whileAltTab, ShiftAltTab navigate through it.
h::AltTabMenu
n::AltTab
m::ShiftAltTab
There are some issues with Windows 8/10 and keys like ctrl-alt-del and alt-tab. Here is one solution:
F1::
{
Send {Alt Down}{Tab} ;Bring up switcher immediately
KeyWait, F1, T.5 ; Go to next window; wait .5s before looping
if (Errorlevel)
{
While ( GetKeyState( "F1","P" ) ) {
Send {Tab}
Sleep, 400 ; wait 400ms before going to next window
}
}
Send {Alt Up} ;Close switcher on hotkey release
}
return
My personal goal was to remap Alt-Tab to Win-Tab (because I'm using a Mac keyboard on a Windows 10) so I took what Stepan wrote above plus some documentation and here is is, working fine for me :
#Tab::
{
Send {LAlt Down}{Tab}
KeyWait, LWin ; Wait to release left Win key
Send {LAlt Up} ; Close switcher on hotkey release
}
return
Worked for me:
F1::
Send, {ALT DOWN}{TAB}{ALT UP}
return
It simulates the Alt + Tab behavior for F1 key.
Well, finally I found the reason and some "solutions" here and here.
It seems that Windows 8 blocks Ahk {Alt Down}{Tab} and AltTabMenu and some other keys.
For now I'm using this to scroll windows forward:
Send !{ESC}
This to display the AltTabMenu:
Run, "C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Window Switcher.lnk"
And this to switch to the previous app as suggested in one of the topics:
LCtrl & z:: ; AltTabMenu
state := GetKeyState("Capslock", "T")
if state = 1
SetCapsLockState, Off ; CapsLock On blocks Task Switching metro window
Send, !{Tab} ; prevents displaying inactive Task Switching metro window
run, Window Switcher.lnk ; must be in script directory otherwise include path
WinWait, Task Switching,, 2
KeyWait, Ctrl
Send, {Enter}
if state = 1
SetCapsLockState, On ; restores CapsLock State
state =
return
#IfWinActive, Task Switching
LCtrl & q::Send, {Right}
LCtrl & a::Send, {Left}
It would be great to get to the previous app with no AltTabMenu splashing.
In case you want to do multiple "tabs", then the below function should help doing that. This was at least own solution on my Windows 8.1 machine.
The approach is:
1) Get a list of all the windows
2) Loop 1:
find the index of the current window
set the index to switch to ("current" + "offset")
3) Loop 2:
loop until you hit the index to switch to, then switch window
AutoHotKey code sample below:
; Test switch of 1 window
F1::AltTabFunction(offset:=1)
; Test switch of 2 windows
F2::AltTabFunction(offset:=2)
AltTabFunction(offset:=1)
{
; ****************************
; Function for switching windows by ALT-TAB (offset = number of windows to "tab")
; ****************************
; Get list of all windows.
WinGet, AllWinsHwnd, List
WinGetTitle, active_title, A ; Get title of active window.
; Find index of the current window.
counter_of_none_hidden_windows := 0 ; Initiate counter for counting only the none-hidden windows.
Loop, % AllWinsHwnd
{
; Find title for window in this loop.
WinGetTitle, CurrentWinTitle, % "ahk_id " AllWinsHwnd%A_Index%
; From [1]: "Retrieves an 8-digit hexadecimal number representing the extended style of a window.".
; [1] : https://autohotkey.com/docs/commands/WinGet.htm
WinGet, exStyle, exStyle, % "ahk_id" AllWinsHwnd%A_Index%
; Skip hidden windows by checking exStyle.
If !(exStyle & 0x100){
Continue
}
; Window is not hidden. Increase counter.
counter_of_none_hidden_windows := counter_of_none_hidden_windows+1
; Set flag.
titles_match := CurrentWinTitle = active_title
If (titles_match) {
window_index_to_switch_to := counter_of_none_hidden_windows+offset
break
}
}
; Find index of the window to switch to and do the actual switch
counter_of_none_hidden_windows := 0 ; Initiate counter for counting only the none-hidden windows.
Loop, % AllWinsHwnd
{
; From [1]: "Retrieves an 8-digit hexadecimal number representing the extended style of a window.".
; [1] : https://autohotkey.com/docs/commands/WinGet.htm
WinGet, exStyle, exStyle, % "ahk_id" AllWinsHwnd%A_Index%
; Skip hidden windows by checking exStyle.
If !(exStyle & 0x100){
Continue
}
; Window is not hidden. Increase counter.
counter_of_none_hidden_windows := counter_of_none_hidden_windows+1
; Set flag.
found_window_to_switch_to := counter_of_none_hidden_windows = window_index_to_switch_to
; Switch window.
If (found_window_to_switch_to) {
; Get title.
WinGetTitle, CurrentWinTitle, % "ahk_id " AllWinsHwnd%A_Index%
; Activate by title.
WinActivate, %CurrentWinTitle%
; Stop loop.
break
}
}
return ; Nothing to return
}
send {Alt down}{tab}
send {Alt up}
!{Tab} works to switch between windows if you add sleep before and after it.
Sleep 100
Send !{Tab}
Sleep 100
Please refer to this link: https://www.autohotkey.com/docs/Hotkeys.htm#alttab
To cancel the Alt-Tab menu without activating the selected window, press or send Esc. In the following example, you would hold the left Ctrl and press CapsLock to display the menu and advance forward in it. Then you would release the left Ctrl to activate the selected window, or press the mouse wheel to cancel. Define the AltTabWindow window group as shown below before running this example.
LCtrl & CapsLock::AltTab
#IfWinExist ahk_group AltTabWindow ; Indicates that the alt-tab menu is present on the screen.
MButton::Send {Blind}{Escape} ; The * prefix allows it to fire whether or not Alt is held down.
#If
I've modified the example from the help page on this found here: https://www.autohotkey.com/docs/Hotkeys.htm#AltTabDetail
This was mainly to remap the Windows+Tab key to the Alt+Tab key in this example.
It opens the task view and waits for the user to click, escape or enter. The example from the help page has the alt key getting stuck for me so I changed it to work a little better.
Please let me know if this works for you all.
; Override the Left Win key and tab to Alt + Tab
; Help found here:
; https://www.autohotkey.com/docs/Hotkeys.htm#AltTabDetail
; #IfWinExist ahk_group AltTabWindow
#NoEnv
#SingleInstance force
SendMode Input
LWin & Tab::Send {Alt down}{tab} ; Asterisk is required in this case.
!LButton::
{
Click
Send {Alt up} ; Release the Alt key, which activates the selected window.
}
!Enter::
{
Send {Alt up} ; Release the Alt key, which activates the selected window.
}
~*Esc::
{
Send {Alt up} ; When the menu is cancelled, release the Alt key automatically.
;*Esc::Send {Esc}{Alt up} ; Without tilde (~), Escape would need to be sent.
}
I got ALT TAB to work with F1
By pressing F1 you can switch to the last window
While F1 is kept pressed you can move around with arrow keys or tab to select the window you need.
Code:
`F1::
Send, {ALT DOWN}{TAB}{TAB UP} ; If F1 is down it invokes the menu for switching windows.
KeyWait, F1 ; Show menu for switching windows by keeping ALT down until user physically releases F1.
Send, {ALT UP} ; If F1 is released release ALT key
return`
Documentation links
KeyWait
KeyList
I think this question was meant to be a simple request of: how to alt tab in Win10 using AHK, since win10 changed things up? -> I found the most simple solution as shown below... the code makes it necessary to keep the alt key down while the Win10 emu is open - then use the arrow keys an additional number of tabs (if you need three alt tabs, then it's "alt tab, then right 2", see?
macro key name::
{
Sleep 100
Send, ^c
Sleep 1000
Send, {alt down}{tab}
Sleep 400
Send, {right 2}{alt up}
Sleep 400
Send, ^v
Sleep 400
}
So just play with this snip in your code and you can jump passed the 'next' window(s) open.
Rossman