Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

278
Views
Transformar código VBScript a Javascript (Electron)

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 Next

El 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!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!