functions/Invoke-AutoHotkey.ps1

function Invoke-AutoHotkey
{
    <#
.SYNOPSIS
Invoke-AutoHotkey -File <file.ahk>
 
.Description
Runs a ahk file
 
.Parameter [String]$File
Path to a AHK Source file
 
.EXAMPLE
Invoke-AutoHotkey -File file.ahk
 
.NOTES
Name:
Author: Felix Scholz
Version: 1.0
DateCreated: 2022-04-26
 
.LINK
- https://www.autohotkey.com/docs/v2/
 
.COMPONENT
Requires PSEdition Core
Requires Version 7.0 or above
#>

    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [string]$File
    )
    BEGIN {
    }
    PROCESS {
        Write-Verbose -Message "Open AutoHotKey file: $File"
        $process = Start-Process -FilePath "$PSScriptRoot\..\private\bin\AutoHotkey64.exe" -Args "`"$File`"" `
             -NoNewWindow -PassThru -WorkingDirectory "$($(Get-Location).Path)"
        Write-Verbose -Message "Open with Id: $($process.Id); Handle: $($process.Handles)"
    }
    END {
    }
}