// Detect It Easy: detection rule file format

init("format", "Compiled AutoHotKey");

function detect(bShowType, bShowVersion, bShowOptions) {
    if (PE.resource[">AUTOHOTKEY SCRIPT<"]) {
        sVersion = PE.getFileVersion();
        bDetected = true;
    } else {
        var sManifest = PE.getManifest();
        var aId = sManifest.match(/(\n?)<assemblyIdentity.*?(\n?).*version(.*?)(\n?)name=\"AutoHotkey\"/);
        if (aId) {
            aVersion = sManifest.match(/version=\"(.*?)\" ?name=\"AutoHotkey/)
            sVersion = aVersion[1];
            bDetected = true;
        }
    }

    return result(bShowType, bShowVersion, bShowOptions);
}