Search code examples
powershellmql4

Compiling MQL files produces no output


I'm trying to implement a GitHub action that compiles .mq4 files. Currently, I've got a Powershell script that does that, according to the format described here:

$url = "http://www.rosasurfer.com/.mt4/{0}/metaeditor.exe" -f $Version
$exePath = "metaeditor.exe"
if ($verbose) {
    Write-Host "Attempting download from $($url)..."
}

try {
    Invoke-WebRequest -Uri $url -OutFile $exePath
} catch {
    Write-Error "Failed to download MetaEditor from $($url), error: $($_.Exception.Message)"
}

Out-File -FilePath $LogFile

$args = New-Object System.Collections.Generic.List[string]
$args.Add("/portable")
$args.Add('/compile:"{0}"' -f (Resolve-Path $Files))
$args.Add('/inc:"{0}"' -f (Resolve-Path $Includes))
$args.Add('/log:"{0}"' -f (Resolve-Path $LogFile))
if ([System.Convert]::ToBoolean($SyntaxOnly)) {
    $args.Add("/s")
}

$exePath = Resolve-Path $exePath
try {
    Start-Process $exePath -ArgumentList $args
} catch {
    Write-Error "Compilation failed, error: $($_.Excaption.Message)"
}

gc $LogFile

The issue I'm having is that this script doesn't fail, but doesn't produce an .ex4 files either. The log file is also empty. I tried using fully-qualified paths to the instance of metaeditor, the input files, include directory and log file as was suggested here, but I'm still not getting anything.


Solution

  • So, it turns out this was an artifact of the version of MetaEditor I was using. I'm not sure why, but version 4.1370.0 wasn't producing any output. Changing the version to the most recent one, fixed the issue and I can now compile my .mq4 and .mqh files.