functions/Invoke-AutoHotkeyCompiler.ps1

function Invoke-AutoHotkeyCompiler
{
    <#
.SYNOPSIS
Invoke-AutoHotkeyCompiler -SourceFile <file.ahk>
 
.Description
Compile a autohotkey file to exe
 
.Parameter [String]$SourceFile
Path to a AHK Source file
 
.EXAMPLE
Invoke-AutoHotkeyCompiler -SourceFile 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]$SourceFile
    )
    BEGIN {
    }
    PROCESS {
        $ArgumentList = $("/in `"$SourceFile`"")

        $process = Start-Process -FilePath "$PSScriptRoot\..\private\bin\Ahk2Exe.exe" -ArgumentList "$ArgumentList" `
             -NoNewWindow -PassThru -Wait -WorkingDirectory "$($(Get-Location).Path)"
        Write-Verbose -Message "Open with Id: $($process.Id); Handle: $($process.Handles)"
    }
    END {
    }
}