Τρίτη 16 Δεκεμβρίου 2025

Search Inkscape.exe (or any exe file)

Using simple function:

Print @findExe("Inkscape")


function findExe(this$)
declare local cn "ADODB.Connection"
method cn, "open", "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"
local search$={SELECT System.ItemPathDisplay
FROM SystemIndex
WHERE System.FileName = '@@@.exe'
}
method cn, "execute", replace$("@@@", this$, search$) as new rs
with rs, "eof" as new rs.EOF, "fields" as new field()
if not rs.EOF then =field(0)
end function


Using function (can be member of a class too)

function findExe(this$) {
declare cn "ADODB.Connection"
method cn, "open", "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"
search$={SELECT System.ItemPathDisplay
FROM SystemIndex
WHERE System.FileName = '@@@.exe'
}
method cn, "execute", replace$("@@@", this$, search$) as rs
with rs, "eof" as rs.EOF, "fields" as field()
if not rs.EOF then =field(0)
}
Print findExe("Inkscape")


This is the simple version which find inkscape exe and lnk files:

declare cn "ADODB.Connection"
method cn, "open", "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"
search$={SELECT System.ItemNameDisplay, System.ItemPathDisplay
FROM SystemIndex
WHERE System.FileName = 'Inkscape.exe'
OR (System.FileExtension = '.lnk' AND System.ItemNameDisplay LIKE '%Inkscape%')
}
method cn, "execute", search$ as rs
with rs, "eof" as rs.EOF, "fields" as field()
while not rs.EOF
Print field(0);" -> ";field(1)
method rs, "MoveNext"
end while