Pagina 1 di 1

[RISOLTO] Il mio pacchetto Anagen2+

Pubblicato: 10 ottobre 2019 - 10:21
di olaplanche
Popopopopo \o/ Alla fine sono riuscito a finire questo pacchetto, che probabilmente è stato quello che mi ha dato più problemi...

Condivido il mio codice con voi e vorrei ringraziare in particolar modo gaelds per il suo post (viewtopic.php?t=974) così come la condivisione dei suoi pacchetti che mi hanno permesso di finalizzare la mia versione:

Codice: Seleziona tutto

# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = []
global destdir
destdir = makepath(programfiles32,'Anagene2','Anagene2Plus_maj_2018')
daopath = makepath(programfiles32,'Common Files','microsoft shared','DAO')

def install():
    print('Installation de Anagene 2+ version 2012')
    if not isfile(makepath(daopath,'DAO350.DLL')):
        filecopyto(makepath('%s' % basedir,'Anagene','Common','Microsoft Shared','DAO','DAO350.DLL'),makepath(programfiles32,'Common Files','microsoft shared','DAO'))
    run_powershell(r'Start-Process regsvr32.exe -Wait -ArgumentList "/s `"%s\DAO350.DLL`"" -verb runAs' % daopath)
    run_powershell(r'Start-Process cmd.exe -Wait -ArgumentList "/C %s\Anagene\setup.exe /S /v/qn" -verb runAs' % basedir)
    if iswin64:
        with disable_file_system_redirection():
            filecopyto('COMDLG32.OCX',system32())
            #C:\Windows\SysWOW64\
            register_dll(makepath(system32(),'COMDLG32.OCX'))
    else:
        with disable_file_system_redirection():
            filecopyto('COMDLG32.OCX',system32())
            register_dll(makepath(system32(),'COMDLG32.OCX'))

    print('Installation de Anagene 2+ version 2018 (portable)')
    if not isdir(destdir):
        mkdirs(destdir)
        copytree2('%s\Anagene2Plus_maj_2018' % basedir,destdir)
    create_desktop_shortcut(r'Anagene2+',target=r'%s\Anagene2\Anagene2Plus_maj_2018\anagene2.exe' %programfiles32,wDir=r'%s\Anagene2\Anagene2Plus_maj_2018\\' %programfiles32,icon=r'%s\Anagene2\Anagene2Plus_maj_2018\anagene2.exe' %programfiles32)

def uninstall():
    print('Desinstallation de Anagene 2+')
    if isdir(destdir):
        remove_tree(makepath(programfiles32,'Anagene2'))
        run_powershell(r'Start-Process regsvr32.exe -Wait -ArgumentList "/u /s `"%s\DAO350.DLL`"" -verb runAs' % daopath)
        remove_file(makepath(programfiles32,'Common Files','microsoft shared','DAO','DAO350.DLL'))
        remove_file(makepath(programfiles32,'Common Files','microsoft shared','DAO','DAO2535.TLB'))
        remove_desktop_shortcut('Anagene2+.lnk')

Re: [RISOLTO] Il mio pacchetto Anagen2+

Pubblicato: 12 novembre 2019 - 09:17
di olaplanche
Il pacchetto è stato aggiornato perché il file MSCOMCT2.OCX era ancora mancante e doveva essere salvato per poter aprire le molecole dal software:

Codice: Seleziona tutto

# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = []
global destdir
destdir = makepath(programfiles32,'Anagene2','Anagene2Plus_maj_2018')
daopath = makepath(programfiles32,'Common Files','microsoft shared','DAO')

def install():
    print('Installation de Anagene 2+ version 2012')
    if not isfile(makepath(daopath,'DAO350.DLL')):
        filecopyto(makepath('%s' % basedir,'Anagene','Common','Microsoft Shared','DAO','DAO350.DLL'),makepath(programfiles32,'Common Files','microsoft shared','DAO'))
    run_powershell(r'Start-Process regsvr32.exe -Wait -ArgumentList "/s `"%s\DAO350.DLL`"" -verb runAs' % daopath)
    run_powershell(r'Start-Process cmd.exe -Wait -ArgumentList "/C %s\Anagene\setup.exe /S /v/qn" -verb runAs' % basedir)
    if iswin64:
        with disable_file_system_redirection():
            filecopyto('Anagene\System32\COMDLG32.OCX',system32())
            filecopyto('Anagene\System32\MSCOMCT2.OCX',system32())
            #C:\Windows\SysWOW64\
            register_dll(makepath(system32(),'COMDLG32.OCX'))
            register_dll(makepath(system32(),'MSCOMCT2.OCX'))
    else:
        with disable_file_system_redirection():
            filecopyto('Anagene\System32\COMDLG32.OCX',system32())
            filecopyto('Anagene\System32\MSCOMCT2.OCX',system32())
            register_dll(makepath(system32(),'COMDLG32.OCX'))
            register_dll(makepath(system32(),'MSCOMCT2.OCX'))

    print('Installation de Anagene 2+ version 2018 (portable)')
    if not isdir(destdir):
        mkdirs(destdir)
        copytree2('%s\Anagene2Plus_maj_2018' % basedir,destdir)
    create_desktop_shortcut(r'Anagene2+',target=r'%s\Anagene2\Anagene2Plus_maj_2018\anagene2.exe' %programfiles32,wDir=r'%s\Anagene2\Anagene2Plus_maj_2018\\' %programfiles32,icon=r'%s\Anagene2\Anagene2Plus_maj_2018\anagene2.exe' %programfiles32)

def uninstall():
    print('Desinstallation de Anagene 2+')
    if isdir(destdir):
        remove_tree(makepath(programfiles32,'Anagene2'))
        run_powershell(r'Start-Process regsvr32.exe -Wait -ArgumentList "/u /s `"%s\DAO350.DLL`"" -verb runAs' % daopath)
        remove_file(makepath(programfiles32,'Common Files','microsoft shared','DAO','DAO350.DLL'))
        remove_file(makepath(programfiles32,'Common Files','microsoft shared','DAO','DAO2535.TLB'))
        remove_desktop_shortcut('Anagene2+.lnk')