Wednesday, February 5, 2025

AutoHotKey programs

volume.ahk

#Requires AutoHotkey v2.0

Volume_Down::SoundSetVolume "-10"

Volume_Up::SoundSetVolume "+10"

Volume_Mute::SoundSetMute "-1"


mouse.ahk


#Requires AutoHotkey v2.0

waitTime := 5 ; Number of minutes to wait


Loop {

    Sleep waitTime * 60 * 1000

    MouseMove 10, 0, 20, "R"

    MouseMove -10, 0, 20, "R"

}

blotter.ahk

#Requires AutoHotkey v2.0  ; Ensure the script runs with AutoHotkey v2

SetTimer RunCommand, 3600000  ; Set a timer to run every 1 hour (3600000 milliseconds)

RunCommand()
{
    currentTime := FormatTime("HH")  ; Corrected FormatTime call
    if ((currentTime >= 7 and currentTime <= 15) or currentTime = 17)  ; Check if it's between 7 AM - 3 PM or exactly 5 PM
    {
        Run("C:/Users/hpatil/AppData/Local/Microsoft/WindowsApps/python.exe c:/Users/hpatil/webdr.py")
    }
}

or

 #Requires AutoHotkey v2.0  ; Ensure the script runs with AutoHotkey v2

SetTimer RunCommand, 60000  ; Run every 60 seconds (1 minute)

RunCommand()

{

    run_times := ["0715", "0815", "1000", "1340", "1500", "1700"]  ; Define allowed times

    currentTime := FormatTime(A_Now, "HHmm")  ; Get current time in HHMM format

    if HasVal(run_times, currentTime)  ; Check if currentTime is in the array

    {

        Run("C:/Users/hpatil/AppData/Local/Microsoft/WindowsApps/python.exe c:/Users/hpatil/webdr.py")

    }

}

HasVal(haystack, needle)

{

    if !IsObject(haystack)  ; Ensure it's an array before looping

        throw Error("Bad haystack!")  ; Use `Error` instead of `Exception`

    for value in haystack

        if (value = needle)

            return true  ; Return true if found

    return false  ; Return false if not found

}



No comments:

Post a Comment