Estoy tratando de transformar una HTA en una aplicación Electron y tengo algunos problemas para obtener la versión de un programa por el nombre del producto del instalador.
Así que mi porción de código VBS de trabajo es:
varProgram1 = "NotFound" : varProgram2 = "NotFound" : varProgram3 = "NotFound" Set objInstaller = CreateObject("WindowsInstaller.Installer") Set colProducts = objInstaller.Products For Each objProduct In colProducts strProductName = objInstaller.ProductInfo(objProduct, "ProductName") If strProductName = "Program1_Name" Then varProgram1 = objInstaller.ProductInfo(objProduct, "VersionString") End If If strProductName = "Program2_Name" Then varProgram2 = objInstaller.ProductInfo(objProduct, "VersionString") End If If strProductName = "Program3_Name" Then varProgram3 = objInstaller.ProductInfo(objProduct, "VersionString") End If NextEl código funciona y también es rápido porque voy directamente al nombre del producto. Ahora en Javascript no sé exactamente cómo hacer esto. Tengo una versión en la que busco un exe y un msi, pero es lenta y tampoco encuentra el nombre real del producto en el instalador.
window.getFile = (event) => { const fileName = event.target.name const filePath = pathList[parseInt(event.target.getAttribute("path"))] const fullUrl = `file:///${defaultPath}${fileName}` if (fileName.includes(".exe") || fileName.includes(".msi")) { const a = document.createElement('a') a.href = fullUrl console.log(fullUrl) a.download = fileName document.body.appendChild(a) a.click() } else { const options = { name: 'Electron', icns: '/' }; async function Move() { try { await sudo.exec(`copy "${defaultPath}\\${fileName}" "${filePath.replace(fileName, "")}"`, options) return "Done" } catch (error) { alert(error) } return "done" } Move().then(data => window.location.reload(true)) } }Cualquier ayuda sobre cómo buscar en el instalador de Windows el nombre de un producto y devolver su versión usando electron y js sería muy apreciada. ¡Gracias!