Page 1 of 1

Package with just a link

Published: March 6, 2019 - 09:33
by benoitpatin
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

Re: Package with just a link

Published: March 6, 2019 - 09:42
by htouvet

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

Re: Package with just a link

Published: March 6, 2019 - 09:46
by benoitpatin
Thanks Hubert, I kind of forgot that my command had an executable and an argument... :oops: