- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2
Other Functions
If you've landed on this page, you're probably looking for something more specific. This page is to collect any remaining functions that haven't been detailed in any other page. The functions on this page are generally found in their own ahk file in ..\lib\Functions\
- alwaysOnTop()
- change_msgButton()
- checkImg()
- checkInternet()
- checkStuck()
- delaySI()
- detect()
- resetOrigDetect()
- drawBorder()
- fastWheel()
- floorDecimal()
- generateAdobeShortcut()
- getHotkeys()
- getHotkeysArr()
- getHTML()
- getHTMLTitle()
- getLocalVer()
- getScriptRelease()
- isDoubleClick()
- isURL()
- isReload()
- jumpChar()
- monitorWarp()
- mousedrag()
- nItemsInDir()
- pauseYT()
- refreshWin()
- selectFileInOpenWindow()
- syncDirectories()
- timeline()
- unzip()
- useNVENC()
- youMouse()
This function will toggle the desired window (the active window by default) and attempt to draw an orange border around it (win11 only).
alwaysOnTop( [{winTitle := "A"}] )Changes the button names of a generated msgbox. This function is best called via a settimer.
change_msgButton( [title, buttons*] )Type: String
This variable is the title of the message box you wish to wait for.
Type: Varadic/String
This variable is to define the new text you wish the buttons to show.
Example #1
title := "Change Buttons"
SetTimer(change_msgButton.Bind(title, "OK", "Open Dir"), 16)
;// will wait for a msgbox with a title "Change Buttons" and swap the first two buttons to "OK" & "Open Dir"This function is designed to return the names of the first & second hotkeys pressed when two are required to activate a macro.
If the hotkey used with this function is only 2 characters long, it will assign each of those to &first & &second respectively. If one of those characters is a special key (ie. ! or ^) it will return the virtual key so KeyWait will still work as expected.
getHotkeys( [{&first?, &second?}] )Type: VarRef
This parameter is the variable that will be filled with the first activation hotkey.
Type: VarRef
This parameter is the variable that will be filled with the second activation hotkey.
Type: Object/false
This function will attempt to return an object containing the two hotkeys. This function may instead return
falsein the event that two individual hotkeys cannot be determined.
Example #1
RAlt & p::
{
    hotkeys := getHotkeys()
    MsgBox(hotkeys.first)  ; returns "RAlt"
    MsgBox(hotkeys.second) ; returns "p"
}
!p::
{
    getHotkeys(&first, &second)
    MsgBox(first)  ; returns "vk12"
    MsgBox(second) ; returns "p"
}A function to determine the input hotkeys and return them as an array.
Warning
I don't know regex. As a result this is some of the only "vibe coded" functions in this repo (soz, I hate it too but editing is a busy job and learning regex is a lot) and as such I have no idea the potential limitations of this function. If you run into any issues please do let me know.
getHotkeysArr( [{hk := A_ThisHotkey}] )Type: String
The hotkey string you wish to break up.
Type: Array
returns an array of
vkvalues for all detected hotkeys
Example #1
RAlt & p::
{
   hotkeys := getHotkeysArr()
   hotkeys[1] ; returns "vkA5" ("RAlt")
   hotkeys[2] ; returns "vk50" ("p")
}Floor() is a built in math function of ahk to round down to the nearest integer, but when you want a decimal place to round down, you don't really have that many options. This function will allow us to round down after a certain amount of decimal places.
Original code found here.
floorDecimal( [num, dec] )Type: Integer
This parameter is the number you want this function to evaluate.
Type: Integer
This parameter is the amount of decimal places you wish the function to evaluate to.
A function to cut repeat code and set DetectHiddenWindows & SetTitleMatchMode.
detect( [{windows := true, title := 2}])Type: Boolean
This parameter determines whether you wish to enable or disable DetectHiddenWindows. It defaults to
trueand can be omitted.
This parameter determines what
SetTitleMatchModeyou wish to set. It defaults to2and can be omitted.
Type: Object
This function returns an object containing the original
A_DetectHiddenWindows&A_TitleMatchModestates
Example #1
dct := detect()
dct.Windows      ;// returns the original `A_DetectHiddenWindows` value
dct.Title        ;// returns the original `A_TitleMatchMode` value
Resets A_DetectHiddenWindows & A_TitleMatchMode to a state before using detect()
resetOrigDetect( [obj] )Type: Object
An object containing
Windows&Title(ideally from usingdetect())
Example #1
dct := detect()
...
...
resetOrigDetect(dct)
A function to return the most recent version of my scripts on github. This does NOT use the API and instead downloads a .atom of the release page and searches for a certain string to get either the latest full release, or the latest prerelease.
getScriptRelease( [{beta := false, &changeVer := "", user := "Tomshiii", repo := "ahk"}] )Type: Boolean
A
true/falseto determine if you want this function to check for a full release, or a prerelease. Can be omitted.
Type: VarRef
Determines which changelog to show in
updateChecker()GUI. Either returns "main" or "beta".
Type: String
Determines which github user to check for.
Type: String
Determines which github repo to check for.
Type: String
This function returns a string containing the latest version number.
This function  allows the user to press a button (best set to a mouse button, eg. Xbutton1/2), this script then changes to the desired tool and clicks so the user can drag. Then once the user releases, the function will swap back to a desired tool.
mousedrag( [tool, toolorig] )Type: String/Variable - Hotkey
This parameter is the hotkey you want the program to swap TO (ie, hand tool, zoom tool, etc).
(consider using values in KSA)
Type: String/Variable - Hotkey
This parameter is the button you want the script to press to bring you back to your tool of choice.
(consider using values in KSA)
This function retrieves the local version (or the string after a specified tag) and then returns it.
*note: This script will trim whitespace, tabs, newlines & carriage returns
getLocalVer( [{varRead?, script := "My Scripts.ahk", searchTag := "@version", endField := "*", returnObj := false}] )Type: String/Variable
If this variable is populated, it will read from the passed string instead of filereading (potentially again).
Type: String
This parameter is the name of the script you wish to read (if in the root dir, otherwise the remaining filepath to it)
Type: String
This parameter is what you want the function to search for (your desired return value should come directly after this search tag).
Type: String
This parameter is what you want "InStr" to search for to be the end of your string. (this should come directly after your desired return value)
Type: Boolean
This parameter determines whether to return just the version as a string or an object containing both the version number and the FileRead of the script
Type: String|Object
Returns eitehr a string of whatever is between the searchTag and endField or an object containing both the version number and the FileRead of the script.
*note: This script will trim whitespace, tabs, newlines & carriage returns
Example #1
ver := getLocalVer() ;// 2.14.6
Example #2
ver := getLocalVer(script,,,, true)
ver.version ;// 2.14.6
ver.script ;// the entire contents of the script
This function will check if the user has an internet connection.
checkInternet()Type: Boolean
Returns a true/false value to represent if the user has an internet connection.
This function creates a ComObject - WinHttpRequest and returns the given url as a string
getHTML( [url] )Type: String
The url you wish to pass into the function that will be returned.
Type: String
Returns a string of the contents of the url parameter.
This function creates a ComObject - WinHttpRequest and returns the title of the given url
getHTMLTitle( [url {, sanitise := true, replace := "_", params*}] )Type: String
The url you wish to pass into the function that will be be parsed.
Type: Boolean
Whether you want the returned title to be stripped of illegal filename chars.
Type: String
The default character to replace illegal characters with. This parameter defaults to
_
Type: String
If you wish to manually replace individual illegal characters from left to right, list them out separated by
,. Any illegal characters that aren't given aparamsstring to be replaced with will default back toreplace.If this parameter is passed
replaceacts as the first found illegal character and the firstparamscounts as the secound found character and so on.
Type: String/Boolean
Returns boolean
falseon failure or a string of the title found from the url parameter.
This function is used to skip forward/backwards in youtube.
The purpose of this script was to manipulate a youtube video, not only just with a mouse, but also even if youtube is the current active window.
youMouse( [tenS, fiveS] )Type: String/Variable - Hotkey
The hotkey for 10s skip in your direction of choice (
j/l)
Type: String/Variable - Hotkey
The hotkey for 5s skip in your direction of choice (
Left/Right)
Warp anywhere on your desktop
monitorWarp( [x, y] )Type: Integer
The x value
Type: Integer
The y value
This function is to allow the user to simply jump 10 characters in either direction. Useful when ^Left/^Right isn't getting you to where you want the cursor to be.
jumpChar( [{amount}] )Type: Integer
This parameter is the amount of characters you want this function to jump, by default it is set to 10 and isn't required if you do not wish to override this value.
This function facilitates accelerated scrolling. If the window under the cursor isn't the active window when this function is called, it will activate it.
A function to close a window, then reopen it in an attempt to refresh its information (for example, a txt file).
If the user passes "A" into both of the variables to indicate they want to focus on the active window and said active window is either Notepad* or Windows Explorer, there is added code in this function to retrieve the filepath of said window and reopen it automatically.
*If there are multiple notepad windows open, this function will refresh all of them.
refreshWin( [window, runTarget {, RunAs := false}] )Type: String/Variable
This parameter is the window you wish to target and close.
Type: String - Filepath
This parameter is the path of the file you wish to open.
Type: Boolean
This parameter is to define whether you wish the program to be run elevated or not.
A function to check if a file exists and perform an ImageSearch at the same time. This can be useful when you need to test for a variety of images due to slight aliasing breaking things.
checkImg( [checkfilepath, {&returnX, &returnY, x1 := 0, y1 := 0, x2 := A_ScreenWidth, y2 := A_ScreenHeight, tooltips := false}] )Type: String
This parameter is the filepath of the image you wish to check
Type: VarRef
The
x variablethe imagesearch will return
Type: VarRef
The
Y variablethe imagesearch will return
Type: Integer
These parameters are the coordinates you want the imagesearch to check.
They will default to: 0, 0, A_ScreenWidth, A_ScreenHeight
Type: Boolean/Object
This parameter is whether you want
errorLog()to produce tooltips if it runs into an error. This parameter can be a simple true/false or an object that errorLog is capable of understanding
A function to send a string of sendinput commands that are staggered out with set sleep value.
delaySI( [delay, inputs*] )Type: Integer
This parameter is the amount of sleep you wish to take place between each input
This sleep happens AFTER each input is sent.
Type: String - Varadic
This parameter is the inputs (in order) you wish for the function to use. They will be sent with
SendInput.This parameter can accept any amount of inputs
Example #1
delaySI(500, "^a", "^c", "^v")
;// will send `Ctrl+a` & sleep 500ms
;// then `Ctrl+c` & sleep 500ms
;// then finally `Ctrl+v` & sleep 500msThis function checks to see if the current script was run via a reload.
Example #1
if isReload()
    return
;// if the script was reloaded, beyond this point will not fireThis function creates a comObject to unzip a folder.
Original function from @MiM in ahk discord: https://discord.com/channels/115993023636176902/1068688397947900084/1068710942327722045 (link may die)
unzip( [zipPath, unzippedPath] )Type: String
This parameter is the path location of a zip folder you wish to unzip.
Type: String
This parameter is the path location you wish the contents of the zip folder to get extracted. If this directory does not already exist, it will be created.
Type: Boolean
On success this function will return
true.
A function to select a file in an open file explorer window.
selectFileInOpenWindow( [fullPath {, checkAgain := false}] )Type: String
The full path of the file you wish to select.
Type: Boolean
Determines whether to check again after 1.5s to ensure the file is selected. If the file is still being operated on by something like
ffmpegit may become deselected. This parameter isn't necessary if the file isn't being operated on when this function is called. Defaults tofalse.
Type: Boolean
Returns
falseon failure/file not existing, returnstrueon success.
This function uses the built in windows command Robocopy "{}" "{}" *.* /MIR /R:1 to mirrow two directories.
syncDirectories( [dirsMap?] )Type: Map
A map containing all the required information. Must be in the following style;
Map("path", {label: "", serial: , dirPath: ""}, "dest", {label: "", serial: , dirPath: ""})where;
`"path"` acts as the source directory, `"dest"` acts as the destination directory
{String} [label] The name of the drive
{Integer} [serial] The serial number of the drive
{String} [dirPath] The directory you wish to sync from/too
This function is a weaker version of the right click premiere script. Set this to a button (mouse button ideally, or something obscure like ctrl + capslock).
timeline( [timeline, x1, x2, y1] )Type: Integer
This parameter is the
ypixel value of the top bar in your video editor that allows you to click it to drag along the timeline. Your mouse will be warped to thisyvalue to click it.
Type: Integer
These paramaters are the furthest left/right pixel value & the top most pixel value of your timeline window. Attempting to activate your hotkey outside these bounds will have no effect.
Returns the number of files & subdirectories in the given directory.
nItemsInDir( [dir {, recurse := false}] )
// @link https://www.autohotkey.com/boards/viewtopic.php?p=494290#p494290Type: String
The directory you wish to check
Type: Boolean
Determines whether you wish to recurse further into the chosen directory or not. Defaults to
false
Type: Object/Boolean
Returns boolean
falseif the dir does not exist, otherwise returns an object;{files: Integer, subdirs: Integer}
This function will search for the yt logo on your tab bar, then select it and input a Space to play/pause.
A function to determine whether the current press of the key is due to a double click.
isDoubleClick( [{delay := 250, priorKeyOrHotkey := "hotkey"}] )Type: Integer
This parameter is how many ms between presses you want the function to allow.
Type: Integer
This parameter determines whether you wish for the function to check A_PriorHotkey or A_PriorKey.
Type: Boolean
Returns
true/false
This function is to help stop the Ctrl/Shift modifier from getting stuck which can sometimes happen while using some scripts.
This function may be necessary when a scripts makes use of some of the hotkeys that use the Ctrl(^)/Shift(+) modifiers - if the script is interupted, these modifier can get placed in a "stuck" state where it will remain "pressed"
checkStuck( [{arr := ["XButton1", "XButton2", "Ctrl", "Shift"]}])Type: Array
An array of buttons you wish for the function to check using
keys.check(). If nothing is passed it will default to checkingXButton1,XButton2,Ctrl&Shift
This function attempts to draw a border around the desired window.
This function requires a windows version higher than
10.0.22000(win11).
This function may not toggle well in rapid succession.
drawBorder( [hwnd {, colour := 0xFFFFFFFF, enable := false}])Type: Integer
The hwnd of the window you desire to adjust
Type: Hexadecimal
The hex colour you wish the border to be. Formated like:
0x1195F5
Type: Boolean
Whether you wish to enable or disable the border
This function will attempt to generate a shortcut of either Adobe Premiere Pro, Adobe After Effects or Adobe Photoshop to the users ..\Support Files\shortcuts\ folder.
generateAdobeShortcut( [userSettingsObj, adobeName, adobeYear])Type: Object
This parameter is the object containing the user's instance of
UserPrefs(). Often seen asUserSettings := UserPrefs()
Type: String
This parameter is the full name of the desired program. Either
Adobe Premiere ProorAdobe After Effects
Type: Integer
This parameter is the year value you wish to determine the logic for.
Type: Boolean
Returns
falseif the desired file directory does not exist elsetrue
A function to (rather rudimentarily) determine whether or not to use nvenc.
useNVENC()Warning
This function requires ffmpeg to be installed
Type: Boolean
Returns true/false
Checks if the passed string follows a URL pattern
isURL( [url] )Type: String
The string you wish to check
Type: Boolean
Returns boolean true/false
Keeping Track
Keyboard Shortcut Adjustments
libs & Classes
Editors
Apps
Other lib files
Hotkeys
Timer Scripts
- adobe fullscreen check.ahk
- Alt_menu_acceleration_DISABLER.ahk
- autodismiss error.ahk
- autosave.ahk
- gameCheck.ahk
- Multi-Instance Close
Other Scripts
- Hotkey Replacer.ahk
- checklist.ahk
- Streamdeck AHK
- CreateSymLink.ahk
- adobeKSA.ahk
- ExplorerDialogPathSelector.ahk
Other Guides