[SOLVED] PyScripter shortcut

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
scarf
Messages: 19
Registration: Nov 22, 2023 - 3:27 p.m.

February 27, 2024 - 12:00

WAPT server: 2.4 Debian 11 Bullseye
Console Admin: Windows 10, WAPT 2.4
FlameShot package

Hello, as I don't have much knowledge of PyScripter, I would like to add a line to the FlameShot package configuration that would automatically add the software shortcut to \AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup to launch FlameShot automatically at startup.

Can you help me?
Thank you in advance

.
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

February 28, 2024 - 4:12 PM

Hello Romain,

It's better to put it in the machine's startup menu rather than the user's, unless you want to allow users to delete it.

Code: Select all

create_programs_menu_shortcut('test',target=makepath(programfiles, "Flameshot","bin", "flameshot.exe"),folder='StartUp'
Sincerely,

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
scarf
Messages: 19
Registration: Nov 22, 2023 - 3:27 p.m.

February 29, 2024 - 10:11

Hello, with the help of my superiors and you, I've created a working script that installs the application and adds a shortcut to the Windows taskbar and the Startup folder for all users of the computer. I'm sharing the code here for anyone who might be interested.
Regards

Code: Select all

from setuphelpers import *
import subprocess

r"""
Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()

"""
# Déclaration des variables globales - Avertissements : 1) Le contexte WAPT n'est disponible que dans les fonctions de paquet ; 2) Les variables globales ne sont pas persistantes entre les appels


def install():
    # Déclaration des variables locales

    # Installation du logiciel
    print("Installation : Flameshot-12.1.0-win64.msi")
    install_msi_if_needed('Flameshot-12.1.0-win64.msi')

    # Chemin vers le dossier de démarrage commun pour tous les utilisateurs
    all_users_startup_folder = os.path.join(os.getenv('ProgramData'), 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Startup')

    # Création du raccourci dans le dossier de démarrage commun pour tous les utilisateurs
    create_programs_menu_shortcut("Flameshot", makepath(programfiles, "Flameshot", "bin", "flameshot.exe"), folder=all_users_startup_folder)

    # Lancement de Flameshot
    print("Lancement de Flameshot...")
    subprocess.Popen(makepath(programfiles, "Flameshot", "bin", "flameshot.exe"))


def uninstall():
    # Suppression du raccourci du dossier de démarrage commun pour tous les utilisateurs
    remove()


def remove():
    # Chemin vers le raccourci dans le dossier de démarrage commun pour tous les utilisateurs
    all_users_startup_folder = os.path.join(os.getenv('ProgramData'), 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Startup')
    shortcut_path = os.path.join(all_users_startup_folder, "Flameshot.lnk")

    # Vérifier si le fichier du raccourci existe, puis le supprimer
    if os.path.exists(shortcut_path):
        os.remove(shortcut_path)
        print("Raccourci supprimé avec succès.")
    else:
        print("Le raccourci n'existe pas.")

User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

February 29, 2024 - 11:58

Hi Romain,

thanks for the feedback, :-) I'm marking the topic as RESOLVED.

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Locked