How to program an interface that updates the files and version of my system?

0

I have a complete sales system made in power builder, which still has certain faults, I have installed it in different companies, all with internet connection, I want to run an instruction once a day, which, before to open the system, to close it or in a button that says "Update version", allow me to verify on a server if there is any new update of my system, changes, and that all the files on my system are downloaded and updated. If it can be done in Power Builder it would be ideal, and if not, then it can also be in another language such as c, or java.

    
asked by jeanpitx 09.02.2018 в 18:58
source

1 answer

1

Could you give more information about where you plan to put the files of the new version? You can do the following:

You create a script that will be executed instead of the real program (we will call it updater), this prgorama would check if there is a new version and if it is, it would update the files and finally open the updated real application.

To make the whole process transparent to clients, you would create a direct access to the updater instead of the real program and you would put the same icon (shortcuts allow you to put any icon regardless of the destination). Users think that they are opening the real program but they are actually running the updater that at the end of the process opens the actual program already updated.

If all the clients are in the same network and you can create a network route that all the clients can see, like in my case, you can use this script:

Set fso = CreateObject("Scripting.FileSystemObject")
Set shl = CreateObject("Wscript.Shell")

exe_file = "app_verdadera.exe"
fldr_org = "\ruta_de_red\ActualizarSistema\"
fldr_dst = Left( Wscript.ScriptFullName , InStrRev( Wscript.ScriptFullName   , "\" ))

'Si el programa esta abierto no actualice
Set Process = GetObject ("WinMgmts:Root\Cimv2").ExecQuery ("Select * From Win32_Process Where Name = '" & exe_file & "'")
IF Process.count = 0 THEN 
    FOR EACH file IN fso.GetFolder(fldr_org).Files
        file_org = fldr_org & file.Name
        file_dst = fldr_dst & file.Name

        IF NOT fso.FileExists(file_dst) THEN
            'Si el archivo no existe, lo copio
            fso.CopyFile file_org, file_dst, true
        ELSE
            'Si existe, compara las fechas 
            date_org = fso.GetFile(file_org).DateLastModified
            date_dst = fso.GetFile(file_dst).DateLastModified
            'Si las fechas de modificacion son diferentes, actualizo
            IF DateDiff("s", date_org, date_dst) < 0 THEN
                fso.CopyFile file_org, file_dst, true
            END IF
        END IF
    NEXT
END IF  

'Ejecuto el verdadero programa
IF fso.FileExists(fldr_dst & exe_file) THEN
    shl.Run """" & fldr_dst & exe_file & """"
END IF
    
answered by 13.08.2018 / 16:36
source