- Tray Icon - change script tray icon (which also changes the default icon in a script's error windows, msgboxes and GUI title icon).
- HasVal Function - Check if value is already in an array and retrieve it's Index if present.
Updates will be posted here on GitHub.
Code: Select all
#Requires AutoHotkey v2.0
; Auto-execute
; Add to the top of your script
; = Tray Icon
I_Icon := A_ScriptDir "\icons\1-512.ico"
; Icon source: https://www.iconsdb.com/caribbean-blue-icons/1-icon.html ; CC License
; I like to number scripts 1, 2, 3... and link the scripts to numpad shortcuts for easy editing
If FileExist(I_Icon)
TraySetIcon I_Icon
Return ; ends autoexecute
; = HasVal Function
; Modifed from https://www.autohotkey.com/boards/viewtopic.php?p=109173#p109173
; not for associative arrays
HasVal(haystack, needle) {
; if !(IsObject(haystack)) || (haystack.Length() = 0)
; return -1
; optimise above code to your needs after reading lexikos' comment here - https://www.autohotkey.com/boards/viewtopic.php?p=110388#p110388
for index, value in haystack
if (value == needle) ; case-sensitive
return index
return 0
}