Combining these 2 script help Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
autohotkeycool
Posts: 137
Joined: 24 May 2016, 08:23

Combining these 2 script help

Post by autohotkeycool » 13 Jun 2021, 11:44

I want to add this script

Code: Select all

f11:: ; Win + A
    MouseGetPos,,, Hwnd
    WinGet, PN, ProcessName, % "ahk_id " Hwnd
    If (PN = "WINWORD.EXE")                                                        ; Specify the window title here.
    WinActivate, Word.png 
     If (PN = "Chrome.exe")    
    WinActivate, Chrome.png
     If (PN = "Firefox.exe")    
    WinActivate, Firefox.png
     If (PN = "Vivaldi.exe")    
    WinActivate, Vivaldi.png
     If (PN = "shareX.exe")    
    WinActivate, shareX.exe.png
Return

GuiClose:
ExitApp
to this one

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

F1::
Keywait, F1, T1
If Errorlevel != 0
{
MouseGetPos,,, win
PostMessage, 0x112, 0xF020,,, ahk_id %win%
KeyWait,F1
}
Else
Send ^!{Tab}
Return

#If !WinActive("ahk_class CabinetWClass ahk_exe explorer.exe")
F2::  ; press ctrl+o, which toggles Musicbee playback
Send, {alt down}{o}{alt up}
Return

F5::
Keywait, F5, T1
If Errorlevel != 0
{
MouseGetPos,,, win
PostMessage, 0x112, 0xF020,,, ahk_id %win%
KeyWait,F5
}
Else
MouseGetPos,,, win
WinClose, ahk_id %win%
Return

F6::
MouseGetPos,,, win
WinMinimize, ahk_id %win%
Return

F9::Send, #d
Return

F10::Send, ^#c
Return

LControl & RAlt::WinSet, AlwaysOnTop, Toggle,A
Return
any changes you'd recommend making to the 1st script I posted, so that it will merge fine with the 2nd script

User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: Combining these 2 script help  Topic is solved

Post by boiler » 13 Jun 2021, 12:06

Put the F11 block of code before the #If in the second script. There is no need for the GuiClose part because you don’t have a GUI.

Post Reply

Return to “Ask for Help (v1)”