Page 1 of 1

[SOLVED] My Anagen2+ package

Published: October 10, 2019 - 10:21
by olaplanche
Popopopopo \o/ I finally managed to finish this package, which was probably the one that gave me the most trouble...

I'm sharing my code with you and I'd like to especially thank gaelds for his post (viewtopic.php?t=974) as well as the sharing of its packages which allowed me to finalize my version:

Code: Select all

# -*- 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: [SOLVED] My Anagen2+ package

Published: November 12, 2019 - 09:17
by olaplanche
The package has been updated because the MSCOMCT2.OCX file was still missing and needed to be saved in order to open the molecules from the software:

Code: Select all

# -*- 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')