-
Notifications
You must be signed in to change notification settings - Fork 2
Other Classes
Within the ..\lib\Classes\
directory is a whole bunch of individual class files that give the user access to useful functions of various nature. All (or in case I ever change it, most) classes are called like: class.func()
- tool
- coord
- block
- WinGet
- Dark
- Pause
- Move
- Startup
- timer
- obj
- clip
- clipStorage
- cmd
- keys
- Mip
- WM
- ytdlp
- ffmpeg
- reset
- Log
- errorLog
This class contains two tooltip functions that help with tooltip creation and management.
This function allows the creation of a tooltip with any message, for a custom duration. This tooltip will then (under most conditions) follow the cursor and only redraw itself if the user has moved the cursor.
If the user passes either an
x
ORy
value to this function (but not both), it will offset the tooltips position by that value from the cursor.
If the user passes both an
x AND y
value to this function, the tooltip will no longer follow the cursor and instead be planted at those coordinates (the function uses theScreen
coordinate position).If you wish to replicate typical
ToolTip()
placement behaviour, follow Example #2 below.
If a second tooltip of the same WhichToolTip
param is called, the first will be replaced with it.
tool.Cust( [message, {timeout := 1.0, find := false, x?, y?, WhichToolTip?}] )
Type: String
This parameter is whatever you wish the tooltip to display.
Type: Integer/Float
This parameter is how many
ms
you want the tooltip to last. This value can be omitted and it will default to1000
.
- If you wish to type in seconds, use a floating point number, ie;
1.0
,2.5
, etc.
If 0 is passed, the tooltip that was called with the same
WhichToolTip
parameter will be stopped.
Type: Integer
The coordinates you want the tooltip to be placed.
If you pass either an
x
ory
coordinate, the tooltip will constantly offset its position by that value from the cursor. If you pass both anx and y
coordinate, the tooltip will no longer follow the cursor.
Type: Integer
This parameter allows you to indicate which tooltip you want this call of the function to be. Must be a number between 1 & 20. If unspecified, the number is 1.
Type: Boolean
This parameter determines whether to set the tooltip as darkmode or lightmode. will default to the user's system theme.
Example #1
tool.Cust("hello",, MouseGetPos(&x, &y) x + 15, y) ; Produces a tooltip that says "hello" next to the cursor when called and will stay at those coordinates for 1 second
Example #2
tool.Cust("offset", 3000, -30) ; Produces a tooltip that says "offset" 30 pixels to the left of the cursors position and will follow the cursor for 3 seconds
This function will check to see if any tooltips are active and will wait for them to disappear before continuing.
tool.Wait( [{timeout}] )
Type: Integer
This parameter allows you to pass in a time value (in seconds) that you want
WinWaitClose
to wait before timing out. This value can be omitted and does not need to be set.
This function will check to see if any tooltips are active and will wait for them to disappear before continuing.
tool.Tray( [TrayParams := {text: "", title: "", options: ""}, timeout := 5000] )
Type: Object
This parameter is an object containing the paramaters you wish to pass to
TrayTip
. This includes{text: "", title: "", options: ""}
.
Type: Object
This parameter is the time in
ms
you wish to wait before the traytip times out. Pass0
to disable this function attempting a timeout. > note: This timeout may not work as intended due to windows/if your script is persistent
This class contains 4 different coordinate mode definitions that, by default set coordmodes to some defaults that I use all throughout my scripts.
These functions can then have parameters passed to them to make them behave more similarly to the base function incase you need it.
coord.s() ; sets coordmode("pixel", "screen")
coord.w() ; sets coordmode("pixel", "window")
coord.client() ; sets coordmode("pixel", "client")
coord.c() ; sets coordmode("caret", "window")
A function to store all current coordmode settings into an object.
Resets the values of passed in coordmodes.
coord.reset( [coordObj] )
Type: Object
This parameter is an object containing any coord modes you wish to reset. Only accepts params of;
caret
,menu
,tooltip
,mouse
,pixel
.
Example #1
coordObjs := coord.store()
...
...
This class contains 2 different block input mode definitions to make setting blockinputs a bit easier during coding.
While the main purpose of these functions is to quickly and easily achieve what I normally want as default, they also support passing parameters to achieve all normal BlockInput
functionality.
block.On() ; Blocks all user inputs. By default does `BlockInput("SendAndMouse") & BlockInput("MouseMove")`
block.Off() ; Enables all user inputs. By default does `BlockInput("Default") & BlockInput("MouseMoveOff")`
This class contains a bunch of useful get
style functions thats sole purpose is to retrieve and/or set information.
This function will grab the monitor that the active window is currently within and return it as well as coordinate information in the form of a function object.
If a window is overlapping multiple monitors, this function may attempt to fullscreen the window first to get the correct monitor.
winget.WinMonitor( {title?} )
Type: String
This parameter allows the user to pass a custom winTitle into the function instead of using the currently active window
Type: Object
Returns a function object containing; the monitor number, the left most pixel value, the right most pixel value, the top most pixel value and the bottom most pixel value.
Example #1
window := winget.WinMonitor()
window.monitor ;// returns monitor the window is within
window.left ;// returns left x position
window.right ;// returns right x position
window.top ;// returns top y position
window.bottom ;// returns bottom y position
This function will grab the monitor that the mouse is currently within and return it as well as coordinate information in the form of a function object.
winget.MouseMonitor( [{x?, y?}] )
Type: Integer
These parameters allow the user to pass custom coordinates into the function to retrieve the monitor information relating to those coordinates.
Both
x
&y
need to be passed to this function or it will default to the current mouse coordinates
Type: Object
Returns a function object containing; the monitor number, the left most pixel value, the right most pixel value, the top most pixel value and the bottom most pixel value.
Example #1
;mouse is within monitor 1 (2560x1440)
monitor := winget.MouseMonitor()
monitor.monitor ;// returns 1
monitor.left ;// returns 0
monitor.right ;// returns 2560
monitor.top ;// returns 0
monitor.bottom ;// returns 1440
This function gets and returns the title for the current active window.
*This function will ignore AutoHotkey GUIs.
winget.Title( [{&title, exitOut := true}] )
Type: VarRef
Produces a variable
title
that gets populated with the active window.
Type: Boolean
Determines whether the user wishes for the active thread to
Exit
if it cannot determine the active window. Defaults totrue
.
Type: String
Returns the title as a string.
This function is designed to check what state the active window is in.
winget.isFullscreen( [{&title, window}] )
Type: VarRef
Produces a variable
title
that gets populated with the active window. Can be omitted.
Type: String/Variable - WinTitle
Pass a window title into this variable if you wish to provide the function with the window instead of relying it to try and find it based off the active window. This paramater can be omitted.
Type: Boolean
Returns a boolean determining whether the window is fullscreen or not. A return value of 1 means it is maximised.
This function will grab the title of Premiere if it exists and check to see if a save is necessary.
winget.PremName( [{&premCheck, &titleCheck, &saveCheck, ttips := true}] )
Type: VarRef
This parameter is the complete title of premiere.
Type: VarRef
This parameter is checking to see if the premiere window is available to save based off what's found in the current title. Will return unset if premiere cannot be found or a boolean false if unavailable to save. Otherwise it will contain a number greater than 0
Type: VarRef
This parameter is checking for a * in the title to see if a save is necessary. Will return unset if premiere cannot be found or a boolean false if save is not required. Otherwise it will return boolean true
Type: Boolean
This parameter determines whether tooltips will display in the event that the title cannot be determined
Type: Object/Boolean
Returns an object containing similar information to the VarRefs above.
;// if Premiere isn't open `winget.Premiere()` will return 0/false
prem := winget.PremName()
prem.winTitle ;// is the current title of the open premiere window
prem.titleCheck ;// a boolean value of if the window is available to save
prem.saveCheck ;// a boolean value of if a save is currently necessary
This function will grab the title of After Effects if it exists and check to see if a save is necessary
winget.AEName( [{&aeCheck, &titleCheck, &saveCheck}] )
Type: VarRef
This parameter is the complete title of after effects.
Type: VarRef
This parameter is checking to see if the after effects window is available to save based off what's found in the current title. Will return unset if after effects cannot be found or a boolean false if unavailable to save. Otherwise it will contain a number greater than 0
This parameter is checking for a * in the title to see if a save is necessary. Will return unset if after effects cannot be found or a boolean false if save is not required. Otherwise it will return boolean true
Type: Boolean
This parameter determines whether tooltips will display in the event that the title cannot be determined
Type: Object/Boolean
Returns an object containing similar information to the VarRefs above.
;// if AE isn't open `winget.AE()` will return 0/false
ae := winget.AEName()
ae.winTitle ;// is the current title of the open after effects window
ae.titleCheck ;// a boolean value of if the window is available to save
ae.saveCheck ;// a boolean value of if a save is currently necessary
This function is designed to retrieve the name of the client using some string manipulation of the dir path within Premiere's/After Effect's title. It uses ptf.comms
as the "root" dir and expects the next folder in the path to be the client name.
winget.ProjClient()
Type: String
Returns a string of the clients name.
Example #1
;// ptf.comms = "E:\comms"
;// Current project open: `E:\comms\d0yle\polar bowler\polar bowler.prproj`
client := winget.ProjClient() ;// returns "d0yle"
A function to grab the ID of the active window.
winget.ID( [&id] )
Type: VarRef
This parameter is the processname of the active window, we want to pass this value back to the script.
Type: Boolean
Returns true/false on completion depending on if successful.
A function to extract the directory path of an open explorer window.
winget.ExplorerPath( [{hwnd}] )
Type: Integer
This parameter is the hwnd number of the window you wish to focus. If no hwnd number is provided, the function will determine the hwnd of the active window instead.
A function to return the size of a path in bytes
by default.
winget.ExplorerPath( [path {, option}] )
Type: String
This parameter is the folder path you wish to find the size of.
Type: Integer
This parameter is to optionally have the value returned in
MB
,GB
orTB
.
Type: Integer
The size of a folder path in
bytes
by default or in the selected format.
A function to recover the path within the title of either Premiere Pro
or After Effects
.
winget.ProjPath()
Type: Object
;// "E:\comms\tomshi\video\project.prproj"
projPath := winget.projPath()
projPath.Path ; E:\comms\tomshi\video\project.prproj
projPath.Name ; project.prproj
projPath.Dir ; E:\comms\tomshi\video
projPath.Ext ; proj
projPath.NameNoExt ; project
projPath.Drive ; E:
This function checks the desired window to see if it is ahk_exe explorer.exe
&& has a class name that correlates with a known classname specified in a map contained within WinGet
(explorerIgnoreMap
).
winget.isProc( [{hwnd := "A"}] )
Type: Integer/String
The hwnd (or window parameter) of the window you wish to check. This value gets passed into
WinGetProcessName()
&WinGetClass()
Defaults to the active window.
Type: Boolean
returns
true
if the window is one contained within the Map, else returnsfalse
Returns a fully qualified path.
Code originally from SKAN
winget.pathU( [path] )
Type: String
returns the final path
Example #1
MsgBox(WinGet.pathU("E:\Github\ahk\..")) ;// E:\Github
MsgBox(WinGet.pathU("E:\Github\ahk\..\")) ;// E:\Github\
This class contains a few functions that makes turning GUI elements to/from dark mode
easier.
This function will convert GUI buttons to a dark/light theme.
dark.button( [ctrl_hwnd {, DarkorLight := "Dark"}] )
Type: Integer
This parameter is the hwnd value of the control you wish to alter.
Type: String
This parameter is a toggle that allows you to switch between light/dark modes.
This parameter can be omitted and defaults to
"Dark"
. If you wish to change the control to lightmode, pass"Light"
This function will convert all buttons defined in the GUI to a dark/light theme.
dark.allButtons( [guiObj {, DarkorLight := "Dark", changeBG := false}] )
Type: Object
This parameter is the gui object you're working on (ie. MyGui, settingsGUI, etc).
Type: String
This parameter is a toggle that allows you to switch between light/dark modes.
This parameter can be omitted and defaults to
"Dark"
. If you wish to change the control to lightmode, pass"Light"
Type: Boolean/Object
This parameter gives the ability to modify button bg colours & gui bg colours. Defaults to false and will not adjust either. See Example #1 for more info
Example #1
allButtons(guiObj, "DarkorLight", {default: true, LightColour/DarkCoulour: "xxxxxx", LightBG/DarkBG: "xxxxxx"/false})
default: true ;// sets 0xF0F0F0 for light mode && 0xd4d4d4 for darkmode. No other parameters are necessary if this is passed
LightColour/DarkColour: "xxxxxx" ;// This value is a hex code (WITHOUT 0x) - sets the bg colour for all buttons for the given colour mode
LightBG/DarkBG: "xxxxxx" ;// This value is a hex code (WITHOUT 0x) - sets the gui bg colour when in the desired colour mode. If this value is not set, it will default to `LightColour/DarkColour`.
DarkBG/LightBG: false ;// can be set if you do not wish to adjust the BG colour of a certain colour mode
This function will convert GUI menus to dark/light mode.
note: due to limitations with ahk, this function will only alter the drop down menus, not the menu bar colour itself
dark.menu( [{DarkorLight := 1}] )
Type: Boolean
This parameter is to set whether you want the function to change the menu to dark/light mode. This parameter defaults to 1 (for
true
ordark
), if you wish to change the menu to light mode, pass0
his function will convert a GUI windows title bar to a dark/light theme if possible.
dark.titleBar( [hwnd {, dark := true}] )
Type: Integer
This parameter is the hwnd value of the window you wish to alter.
Type: Boolean
This parameter determines whether you want the function to turn the desired windows titlebar to light or darkmode.
This parameter defaults to
true
fordark
, if you wish to change the titlebar to light mode, passfalse
or0
This class contains a few functions that minipulate other ahk scripts, either by pausing them or suspending them.
A function that toggles the pause state on any .ahk
script.
This function will suspend/unsuspend other scripts.
Original code for this function found here.
ScriptSuspend( [ScriptName, SuspendOn] )
Type: String
The name of the script you wish to suspend. eg.
My Scripts.ahk
.
Type: Boolean
A true/false value determining whether to suspend or unsuspend the requested script.
This script is a collection of functions to move various aspects of windows in one way or another. These functions are all contained within the class Move {
and are called like; move.func()
A function that will check to see if you're holding the left mouse button, then move any window around however you like.
If the activation hotkey is Rbutton
, this function will minimise the current window.
move.Window( [key] )
Type: String
This parameter is what key(s) you want the function to press to move a window around (etc. #Left/#Right)
This function allows you to move tabs within certain monitors in windows. I currently have this function set up to cycle between monitors 2 & 4.
By pressing RButton
and then either Xbutton1/2
will move the tab either way. This function will check for 2s if you have released the RButton, if you have, it will drop the tab and finish, if you haven't it will be up to the user to press the LButton when you're done moving the tab. This function has hardcoded checks for XButton1
& XButton2
and is activated by having the activation hotkey as just one of those two, but then right clicking on a tab and pressing one of those two.
As of firefox version 106, for this function to work it either requires you to follow these instructions to disable the tab search arrow, or it'll require you to make adjustments to the pixel values in this script.
The way my monitors are layed out in windows;
-------------
| 2 |
| |
----- -------------
| | ------------- -------------
| 3 | | 1 | | 4 |
| | | | | |
| | ------------- -------------
-----
If you use a different monitor layout, this function may require heavy adjustment to work correctly.
A quick and dirty way to limit the axis your mouse can move.
This function has specific code for XButton1/2
and must be activated with 2 hotkeys.
This function allows the minorly adjust the width/height & x/y values of the active window.
This function requires the second activation hotkey to be:
- -/=
- for
x axis
- Left/Right
- for
y axis
- Up/Down
move.Adjust( [{xORy := "x", window := "A"}] )
Type: String
This parameter is determining which axis you wish to adjust.
Type: String
This parameter is the title of the window you wish to adjust. By default it will use the active window.
This function will on first activation, center the active window in the middle of the active monitor. If activated again it will move the window to the center of the main monitor instead.
This function has specific code for vlc & youtube windows
The math for this function can act a bit funky with vertical monitors. Especially with programs like discord that have a minimum width
move.winCenter( [{adjustHeight := 1, adjustWidth := 1}] )
Type: Number
This parameter is a number value to allow the user to modify the general height of a centred window. This value is used as a multiplication step to increase the height. Eg.
1.25
increases the height by 25%. Depending on the resolution of your monitor a perfectly centred window may look a little strange (ultrawides in particular)
Type: Number
This parameter is a number value to allow the user to modify the general width of a centred window. This value is used as a multiplication step to increase the width. Eg.
1.25
increases the width by 25%. Depending on the resolution of your monitor a perfectly centred window may look a little strange (ultrawides in particular)
This function is a poor mans version of winCenter()
mainly designed to center a window "fullscreen" on your main monitor (but with ultrawides in mind).
move.winCenterWide( [{modifier := 0.75}] )
Type: Number
This parameter is a number value that the user wishes for their windows width to conform to (in comparason to the total width of their display). Best to pick a number between 0 & 1
This class is a collection of functions mostly used in My Scripts.ahk
to perform a variety of actions on script startup.
Information on these functions can be found here.
This class allows a timer to be easily generated and expanded on through the use of extending classes.
This class is a collection of wrapper functions designed to take normal AutoHotkey functions and return their VarRefs as object parameters instead.
Information on these functions can be found here.
This class encapsulates often used functions to manipulate the clipboard.
Ths function stores the current clipboard and then clears it.
clip.clear( [{&storedClip}] )
Type: VarRef
This parameter is the variable you wish to store the clipboard in.
Type: Object
Returns an object containing the stored clipboard.
Example #1
clipb := clip.clear(&stored) ;// clear the clipboard
A_Clipboard := clip.storedClip ;// return the stored clipboard
A_Clipboard := stored ;// return the stored clipboard
This function attempts to copy any highlighted text then waits for the clipboard to contain data.
If the function times out, it will return a boolean false.
clip.copyWait( [{storedClip, waitSec := 0.1, ttip := true}] )
Type: Variable
This parameter is the variable you're storing the clipboard in. If the clipwait times out, this function will attempt to return the clipboard to this variable if it has been set.
Type: Integer
This parameter is the time in
seconds
you want the clipwait to wait. This parameter defaults to0.1s
Type: Boolean
This parameter determines whether the function will produce tooltips on failure. This can be useful as doing so can add about
100ms
to the total round trip time. Defaults totrue
.
Type: Object
Returns a boolean
True/False
depending on if the clipboard recieved any data.
This function will wait for the clipboard to contain data.
If this function times out, it will attempt to return the clipboard to the passed variable.
clip.wait( [{storedClip, waitSec := 0.1, ttip := true}] )
Type: Variable
This parameter is the variable you're storing the clipboard in. If the clipwait times out, this function will attempt to return the clipboard to this variable if it has been set.
Type: Integer
This parameter is the time in
seconds
you want the clipwait to wait. This parameter defaults to0.1s
Type: Boolean
This parameter determines whether the function will produce tooltips on failure. This can be useful as doing so can add about
100ms
to the total round trip time. Defaults totrue
.
Type: Object
Returns a boolean
True/False
depending on if the clipboard recieved any data.
This function returns the clipboard to the passed variable on a delay.
clip.delayReturn( [returnClip {, delay := 1000}] )
Type: Variable
This parameter is the variable you're storing the clipboard in.
Type: Integer
This parameter is the delay in
ms
you want the function to wait before returning the clipboard to the passed variable.
This function returns the clipboard to the passed variable or object.
clip.returnClip( [returnClip] )
Type: Variable/Object
This parameter is the variable/Object you're storing the clipboard in.
If this parameter is an object it MUST have a parameter
clipObj.storedClip
This function runs a search of highlighted text.
clip.search( [{url := "https://www.google.com/search?d&q=", browser := ""}] )
Type: String
This parameter is the url (search engine) you wish to use. Provide everything before the part of the url that is your search quiry.
Type: String
This parameter gives the user the ability to define which browser you wish to run. You must use the string used to define the browser within cmd, ie;
firefox.exe
orchrome.exe
. Leave unset to use the default browser set within windows.
This function will attempt to determine whether to capitilise or completely lowercase the highlighted text depending on which is more frequent.
This class contains some useful functions designed to store and send strings. These strings are store in ..\Support Files\Clipboard Storage\clipStorage.ini
.
This function stores the current Clipboard to the desired number.
Note
If the number
parameter of this function remains unset, it will require the activation hotkey to be either one of the number keys, or one of the numpad keys. Otherwise the user may pass in a custom "key" string.
clipStorage.store( [{number := unset, recreateNumbers := []}] )
Type: String
A custom "key" used when the user does not wish to use a number key as the activation hotkey. This "key" can be anything as long as it is a string
Type: Array
An array of any values the user wishes to add to the list of defaults. This value does not need to be a number, but does need to be a string
This function sends the value stored in the current storage slot.
clipStorage.send( [{number := unset, recreateNumbers := []}] )
Wipes the old clipStorage.ini file and generates a new one
clipStorage.clearAll( [{recreateNumbers := []}] )
Opens the current clipStorage.ini file.
clipStorage.open()
This class encapsulates often used cmd functions.
Ths function stores the current clipboard and then clears it.
cmd.run( [{admin := false, wait := true, keepWindow := false, runParams*}] )
Type: Boolean
This parameter determine whether you want the commandline to be run elevated or not. This value defaults to false.
Type: Boolean
This parameter determine whether you want the function to use
Run
orRunWait
. This function will default toRunWait
.
Type: Boolean
This parameter is whether you wish for the cmd window to remain once it has finished excecuting your command. Defaults to
false
Type: Variadic - String
This parameter allows the user to pass the remaining
Run
parameters.In order they are; the command you wish to pass to the command line, the working directory you wish for the command line to start from and finally, any options you wish for
Run
to use.
Type: Integer/Object
If
wait
is passed as true, this function will return an object containing the exit code & the window PID. Otherwise just the PID will be returned as an integer.
This function attempts to send commands to the command results and return the results.
Parts of this function originate from the documentation & other parts originate from DepthTrawler from the ahk discord.
cmd.result( [command {, hide := true, returnObj := false, workingDir := ""}] )
Type: String
This parameter is the command you wish to send to the command line.
Type: Boolean
This parameter whether the user wishes for the cmd window to launch hidden or not.
Type: Boolean
This parameter determines whether you wish for the function to return a string containing the response or an object containing
StdOut
,StdErr
&ExitCode
. Defaults tofalse
Type: String
This parameter is the working dir that will be passed to
pipeCommand()
ifhide
is set totrue
Type: String/Object
The function will either a string containing the response from the commandline or an object containing
StdOut
,StdErr
&ExitCode
. The type it returns is determined by thereturnObj
parameter and will return a string by default.
This function will unmap the desired mapped drive location, then remap your desired drive letter to the desired ip address.
cmd.mapDrive( [driveLocation, networkLocation {, persistent := true}] )
Type: String
This paramater is the drive letter you wish to remap. Do not include
:
Type: String
This paramater is the ip location of your network drive.
Type: Boolean
This paramater determines whether the user wishes for the desired mapping to remain after system events such as
shutdown
/restart
.
This function will delete the mapping of the passed in drive letter.
cmd.deleteMappedDrive( [driveLocation] )
Type: String
This paramater is the drive letter you wish to remove the mapping of. Do not include
:
This function determines any in use drive letters that are taken up by mapped network locations.
cmd.inUseDrives()
Type: Map
Returns a map containing which drive letters are already mapped & what their mapped locations are.
This class encapsulates often used functions relating to keys.
This function loops through as many possible SC and vk keys and sends the {Up} keystroke for each respective one in an attempt to unstick as many keys as possible.
This function is designed to remove the hassle that can sometimes occur by using KeyWait
. If a function is launched via something like a streamdeck A_ThisHotkey
will be blank, if you design a function to only be activated with one button but then another user tries to launch it from two an error will be thrown.
This function will automatically determine what's required and stop errors occuring.
keys.allWait( [which := "both"] )
Type: String
This parameter determines which hotkey should be waited for in the event that the user tries to activate with two hotkeys.
Type: Object
If the user activates the hotkey/function with two hotkeys, this function will return the two hotkeys as an object the same way that
getHotkeys()
would.
This function will check to see if the passed key is virtually stuck down.
keys.check(key)
Type: String
This parameter is the key you wish to check.
This function loops through as many possible SC and vk keys and checks whether they are stuck down. If they are, an {UP} keystroke will be sent.
This function is a variation of allUp()
keys.allCheck( [sendUp] )
Type: Boolean
If this variable is set to true it will send an UP keystroke to all keys. If it is set to false the function will instead return an array containing the KeyName of all keys that are potentially stuck down.
Type: Array
If sendUp is set to
false
the function will instead return an array containing the names of all keys that are potentially stuck down.
This class creates a map with CaseSense automatically set to false.
This is a collection of WM scripts found scattered through the web/ahk docs.
This is a function designed to allow tooltips to appear while hovering over certain GUI elements.
Original code can be found on the ahk website : https://lexikos.github.io/v2/docs/objects/Gui.htm#ExToolTip
WM.On_WM_MOUSEMOVE( [{wParam, lParam, msg, Hwnd}] )
Example #1
GuiCtrl.ToolTip := "desired tooltip"
move := WM()
mv := ObjBindMethod(move, "On_WM_MOUSEMOVE")
OnMessage(0x0200, mv)
Example #2
GuiCtrl.ToolTip := "desired tooltip"
;// a one line version
OnMessage(0x0200, ObjBindMethod(WM(), "On_WM_MOUSEMOVE"))
This function sends the specified string to the specified window and returns the reply.
WM.Send_WM_COPYDATA( [str, scriptTitle {, timeout := 4000}] )
Type: String
This parameter is the string you wish to send.
Type: String
This parameter is the title of the script you wish to target.
The passed string must be the entire filename (including the
.ahk
extension), eg.My Scripts.ahk
.
Type: Integer
This parameter is the time in
ms
you want the function to wait before timing out.
Type: Integer
Returns the response from the target window. The reply is 1 if the target window processed the message, or 0 if it ignored it.
This function recieves a custom string sent by WM.Send_WM_COPYDATA()
.
WM.Send_WM_COPYDATA( [{wParam, lParam, msg, hwnd}] )
Example #1
OnMessage(0x004A, test) ; 0x004A is WM_COPYDATA
test(wParam, lParam, msg, hwnd) {
res := WM.Receive_WM_COPYDATA(wParam, lParam, msg, hwnd)
MsgBox("smelly" res)
}
A class to contain any ytdlp
wrapper functions to allow for cleaner, more expandable code that allows the user to access common ytdlp
commands.
This function allows the user to quickly download a video from twitch
/youtube
(including clips from both) & requires yt-dlp to be installed correctly on the users system.
ytdlp().download( [{args, folder := A_ScriptDir}] )
Type: String
This parameter is any arguments you wish to pass to yt-dlp. Arguments can be found here.
Type: String
This parameter is the folder you wish the files to save. By default it's this scripts directory.
Type: String
Returns the url that the function worked on.
Example #1
ytdlp().download("", "download\path")
;// default command with no passed args;
;// yt-dlp -P "link\to\path" "URL"
A function to handle converting a file to h264
. This is useful when using video editing programs such as Premiere Pro
as it doesn't support the filetypes that youtube stores newer videos in (.webm
& vp9
/av1
).
ytdlp().reencode( [filepath {, title?}] )
Type: String
This parameter is the filepath of the file you wish to reencode.
Type: String
This parameter is the desired output filename. This parameter can be omitted but the user may encounter issues if the resulting file is the same name (including file extension) as the input file.
A class to contain often used functions to quickly and easily access common ffmpeg commands.
This function attempts to merge an audio file with a video file.
ffmpeg().merge_audio_video( [videoFilePath, audioFilePath] )
Type: String
This parameter is the filepath of the
video
file you wish to merge.
Type: String
This parameter is the filepath of the
audio
file you wish to merge.
This function attempts to reencode the desired file into a h264 codec.
ffmpeg().reencode_h26x( [videoFilePath {, outputFileName?, codec := "libx264", preset := "veryfast", crf := "17", bitrate := false, useNVENC_Val := false, forceGPU := false}] )
Type: String
The filepath to the desired video file.
Type: String
The desired output name of your file (NO file extension). Leaving this variable blank will leave the name the same (which may fail as ffmpeg may not be able to output a file if that name is already taken).
Type: String
The desired
h26x
codec to use. Options includelibx264
&libx265
. This function will default tolibx264
Type: String
The desired h264 preset to use. Options include;
ultrafast
,superfast
,veryfast
,faster
,fast
,medium
,slow
,slower
,veryslow
,placebo
. This function will default toveryfast
Type: String
The desired crf value to use. Defaults to
17
. If this parameter is set,bitrate
must be set to false
Type: String
The deired bitrate value to use. Defaults to false. If this parameter is set,
crf
must be set to false
Type: Boolean
This parameter determines whether to use GPU encoding. If this parameter is set to
true
a few different conditions must be met;
- The
codec
parameter must also be set toh26x_nvenc
wherex
is either4
or5
preset
must instead be aninteger
between12
->18
. This integer stands for thep1
-p7
presets respectively wherep7
is the highest quality (but slowest) andp1
is the lowest quality (but fastest). This function will default to thep6
(17
) preset if the user doesn't select an integer within the valid range- The
crf
parameter is used in place forcq
for nvenc as they use the same range and essentially achieve the same results
Note
Setting this parameter to true
requires the user to have a NVIDIA
GPU. If they do not the function will simply return false
. It should also be of note that this check isn't incredibly deep and the user may have a NVIDIA GPU that does not have nvenc
which may cause unexpected issues.
Type: Boolean
This parameter determines whether to attempt to use
nvenc
encoding whether or not a rudimentary internal function determines it shouldn't be possible.
Caution
Using this option may cause problems if nvenc
encoding really isn't available.
This function will either return nothing, or
false
if the user setsuseNVENC
to true but does not have a nvidia gpu.
This function attempts to convert all files at the specified filepath, of the input type, to the desired type.
ffmpeg().all_XtoY( [{path := "A", from := "mkv", to := "mp4"}] )
Type: String
The path of the desired files. If no path is provided this parameter defaults to the active windows explorer window.
Type: String
The filetype you wish to convert from.
Type: String
The filetype you wish to convert to.
This function attempts to trim the specified file by the input amount.
ffmpeg().trim( [path {, startval := 0, durationval?, overwrite := false, commands := "", runDir := true}] )
Type: String
The filepath location of the file being worked on.
Type: Integer
The number of seconds into the file the user wishes to start the trim.
Type: Integer
The number of seconds from the start value the user wishes to trim the file.
Type: Boolean
Whether the originalfile should be overwritten.
Type: String
Any further commands that will be appended to the command. The default command is
ffmpeg -ss {startval} -i "{filepath}" -t {durationval} {commands} "{outputfile}"
.
Type: Boolean
This parameter defines whether the chosen path will but run after the function executes.
Extracts all audio streams from a file and saves them as .wav
ffmpeg().extractAudio( [filepath {, samplerate := "48000"}] )
Type: String
This parameter is the filepath of the file you wish to extract the audio from.
Type: String
This parameter is the audio samplerate you wish for the function to fall back on if it cannot be automatically determined.
Attempts to split all videos in half on the horizontal or vertical axis and reencode all .mkv/.mp4
files in the chosen directory to two separate .mp4
files. Files will be named [original filename]_c1.mp4
and [original filename]_c2.mp4
and placed in a folder called crop_loop_output
.
ffmpeg().all_Crop( [path := "A", options?] )
Type: String
This parameter is the desired path to excecute the loop. the active directory is used by default if no path is specified.
Type: Object
An object to contain all necessary encoding options. The defaults are listed below.
{codec: "libx264", preset: "veryfast", crf: false, bitrate: 30000, horizontalVertical: "horizontal"}
A class to contain functions used to reload/reset all active ahk scripts.
A function that will loop through and reload all active ahk scripts.
This function will ignore
checklist.ahk
unless you setincludeChecklist
totrue
.
reset.ext_reload( [{includeChecklist := false}] )
Type: Any
This parameter determines whether the loop will include
checklist.ahk
.
A function that will loop through and hard reset all active ahk scripts.
reset.reset( [{includeChecklist := false}] )
Type: Any
This parameter determines whether the loop will include
checklist.ahk
.
A function that will loop through and force close all active ahk scripts.
reset.ex_exit( [{includeChecklist := false}] )
Type: Any
This parameter determines whether the loop will include
checklist.ahk
.
This class allows for easy logging to help determine what your code is doing at any given time. Logs are tracked in .txt
files in ...\Logs\Other Logs
by default and are separated by day. Errors are also sent via print()
to the debug stream.
If a file for the current day doesn't exist, this function will create it. If a file for the current day does exist, the current log will simply be appended to the end of the file.
log( [{dateTime?, print?, fileLocation?}] )
These paramaters can be adjusted via passing them into the class each time or by binding the class to a variable and then assigning those properties new values. Check the examples for more details
Type: String
This parameter is to determine what you wish to appear before your log message. Defaults to
YYYY_MM_DD -- HH:MM:SS.MS :
Type: Boolean
This parameter determines whether to send the log to the debug stream via
true
Type: String
This parameter is to define the location (including filename/extension) of the file you wish to log to. Defaults to
ptf.Logs "\Other Logs\YYYY_MM_DD.txt"
Example #1
log().Append("This will be logged")
;// will create a log file `..\Logs\Other Logs\YYYY_MM_DD.txt`
;// and print `YYYY_MM_DD -- HH:MM:SS.MS : This will be logged`
Example #2
logger := log()
logger.dateTime := "DD_MM_YY : "
logger.fileLocation := A_ScriptDir "\newLog.txt"
logger.Append("new log in a weird location")
;// will create a log file A_ScriptDir "\newLog.txt"
;// and print `DD_MM_YY : new log in a weird location`
This class is an extension of log {
and allows for easy logging of errors when a script enters a predetermined block of code that would indicate something went wrong. Errors are logged in .txt
files in ..\Logs\Error Logs
by default and are separated by day. Errors are also sent via print()
to the debug stream.
Note
If a file for the current day doesn't exist, this function will create it, and capture a bunch of system information that could be useful when it comes to determining problems. If a file for the current day does exist, the current log will simply be appended to the end of the file.
However; it is recommended you run this function like; errorlog({state:"empty"})
once per day before anything else to generate the initial file - while not mandatory it will avoid instances of the intro block being generated two or more times if errorlog happens to get called back to back
errorLog( [{err, optMessage := "", toolCust := false, doThrow := false}] )
Type: Error Object
This variable is an Error Object. These objects contain a bunch of useful information that
errorLog()
will use to display a useful error message to the user.
Within an error object iserr.What
which states what threw the error - it should be noted this function manually checks for, and strips that string ofPrototype.
to make it less confusing to read in the log. This means that if you have a function with that exact string its name may be stripped.
Type: String
If you wish to pass an extra message alongside the main error message, pass a string to this variable and it will be appended to the next line of the log.
Type: Boolean/Object
This parameter tells the function whether you wish for a tooltip of the error to be displayed as the error occurs.
If this variable is set to
true
it will simply generate atool.Cust()
tooltip of the current error for1.5s
. If the user wishes to generate a more custom tooltip, pass an object instead. See Example #1 for available options.
Type: Boolean
This parameter tells the function whether you wish to automatically
throw
with the passed in Error Object.
Example #1
errorLog(
Error("This is a generic error", -1) ;// The error object
, "This is a second message" ;// The second message
, {x: 30, y: 30, time: 3.0, ttip: 5} ;// Custom tooltip parameter. These set the `x`, `y`, `timeout` & `WhichToolTip` variables in `tool.Cust()`
, 1 ;// Will throw with the passed in Error Object
)
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
Other Guides