Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

271
Visualizações
Transform VBScript code to Javascript (Electron)

I am trying to transform an HTA to an Electron App, and I am having some issues in getting the version of a program by the installer product name.

So my working VBS portion of code is:

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

The code works, and is fast also because I go directly to the product name. Now in Javascript I don't know exactly how to do this. I do have a version where I search for an exe and msi, but it is slow and also doesn't find the actual product name in the installer.

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))
    }
}

Any help on how to search the windows installer for a product name an return it's version using electron and js would be much appreciated. Thanks!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda