Package with just a link

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
benoitpatin
Messages: 37
Registration: February 21, 2018 - 5:05 PM

March 6, 2019 - 09:33

Good morning,

I want to create a package that simply creates a link on the user's desktop.
It seemed quite trivial to me, with examples all over the documentation or on the internet, and yet I can't manage it.

Here is my Python code:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *


uninstallkey = []
def install():
    print('installing EDITML')
def session_setup():
  create_user_desktop_shortcut(r'Editer une liste de distribution',target='%systemroot%\system32\rundll32.exe dsquery.dll,OpenQueryWindow')
And with each attempt to execute it, I get:

Code: Select all

Ligne de Commande : session-setup "c:\waptdev\ADV-EDITML-wapt\WAPT\.."
Configuring c:\waptdev\ADV-EDITML-wapt ...
2019-03-06 09:27:59,496 CRITICAL Fatal error in session_setup function: -2147024809 : Paramètre incorrect.:
Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\waptpackage.py", line 1843, in call_setup_hook
    hookdata = hook_func()
  File "c:\waptdev\ADV-EDITML-wapt\setup.py", line 9, in session_setup
    create_user_desktop_shortcut(r'Editer une liste de distribution',target='%systemroot%\system32\rundll32.exe dsquery.dll,OpenQueryWindow')
  File "C:\Program Files (x86)\wapt\setuphelpers.py", line 472, in create_user_desktop_shortcut
    create_shortcut(sc_path,target,arguments,wDir,icon)
  File "C:\Program Files (x86)\wapt\setuphelpers.py", line 410, in create_shortcut
    winshell.CreateShortcut(path,target,arguments,wDir,(icon,0),'')
  File "C:\Program Files (x86)\wapt\lib\site-packages\winshell.py", line 887, in CreateShortcut
    lnk = shortcut (Target)
  File "C:\Program Files (x86)\wapt\lib\site-packages\winshell.py", line 507, in shortcut
    return Shortcut.from_target (source)
  File "C:\Program Files (x86)\wapt\lib\site-packages\winshell.py", line 417, in from_target
    **kwargs
  File "C:\Program Files (x86)\wapt\lib\site-packages\winshell.py", line 391, in __init__
    setattr (self, k, v)
  File "C:\Program Files (x86)\wapt\lib\site-packages\winshell.py", line 456, in _set_path
    self._shell_link.SetPath (path)
com_error: (-2147024809, 'Param\xe8tre incorrect.', None, None)

Done
>>> 
Could someone tell me what's wrong?

THANKS
User avatar
htouvet
WAPT Expert
Messages: 436
Registration: March 16, 2015 - 10:48
Contact :

March 6, 2019 - 09:42

Code: Select all

def session_setup():
    with disable_file_system_redirection():
        create_user_desktop_shortcut(r'Editer une liste de distribution',target=makepath(system32(),'rundll32.exe'),arguments='dsquery.dll,OpenQueryWindow')
Tranquil IT
benoitpatin
Messages: 37
Registration: February 21, 2018 - 5:05 PM

March 6, 2019 - 09:46

Thanks Hubert, I kind of forgot that my command had an executable and an argument... :oops:
Locked