parameter problem in the create_programs_menu_shortcut() function

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
brice73
Messages: 42
Registration: February 13, 2023 - 8:05 AM

May 10, 2023 - 11:59

Good morning,
I am currently creating a package for installing DaVinci Resolve software. This package includes a shortcut targeting the string "C:\Program Files\Blackmagic Design\DaVinci Resolve\Resolve.exe" -pg

The shortcut is created using a shortcut dictionary in the setup.py file as follows:

Defining the shortcut parameters:

Code: Select all

mat_rac = {r'Multimedia':[{'shortcutname':'DaVinci Blackmagic Proxy Generator Lite','cible':r'"C:\Program Files\Blackmagic Design\DaVinci Resolve\Resolve.exe" -pg','wdir':r'C:\Program Files\Blackmagic Design\DaVinci Resolve'},]}
then create the shortcut:

Code: Select all

for matiere in mat_rac:
        for shortcut in mat_rac[matiere]:
            if not isfile(r'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\\'+matiere+'\\'+shortcut['shortcutname']):
                create_programs_menu_shortcut(shortcut['shortcutname'],target=shortcut['cible'],folder=matiere,wDir=shortcut['wdir'])


During installation, a parameter error occurs with the following messages:

Traceback (most recent call last):
File "C:\Program Files (x86)\wapt\common.py", line 4074, in install_wapt
exitstatus = setup.install()
File "C:\waptdev\col73-davinci-resolve_18.1.4.9_Windows_DEV\setup.py", line 49, in install
create_programs_menu_shortcut(shortcut['shortcutname'],target=shortcut['cible'],folder=matiere,wDir=shortcut['wdir'])
File "C:\Program Files (x86)\wapt\setuphelpers_windows.py", line 3941, in create_programs_menu_shortcut
create_shortcut(sc, target, arguments, wDir, icon)
File "C:\Program Files (x86)\wapt\setuphelpers_windows.py", line 3840, in create_shortcut
winshell.CreateShortcut(path, target, arguments, wDir, (icon, 0), '')
File "C:\Program Files (x86)\wapt\Scripts\lib\site-packages\winshell.py", line 887, in CreateShortcut
lnk = shortcut (Target)
File "C:\Program Files (x86)\wapt\Scripts\lib\site-packages\winshell.py", line 507, in shortcut
return Shortcut.from_target (source)
File "C:\Program Files (x86)\wapt\Scripts\lib\site-packages\winshell.py", line 414, in from_target
return cls (
File "C:\Program Files (x86)\wapt\Scripts\lib\site-packages\winshell.py", line 391, in __init__
setattr (self, k, v)
File "C:\Program Files (x86)\wapt\Scripts\lib\site-packages\winshell.py", line 456, in _set_path
self._shell_link.SetPath (path)
pywintypes.com_error: (-2147024809, 'Incorrect parameter.', None, None)

FATAL ERROR: 0x80070057: Incorrect parameter.
Exit code: 3.


This error does not occur when double quotes "" are removed from inside the single quote delimited string ' ' in the shortcut target, but the shortcut is then no longer operational.

Is there a way to solve this problem?
WAPT Enterprise 2.6.1.17765
WAPT server under Debian 13
Administration/package creation under Windows 11/10
brice73
Messages: 42
Registration: February 13, 2023 - 8:05 AM

May 15, 2023 - 4:39 PM

Edit:
The problem is solved! :-) The argument '-pg' should actually be passed to the 'arguments' in the create_programs_menu_shortcut() function and not to the 'target'. (The same applies in PowerShell as well).
WAPT Enterprise 2.6.1.17765
WAPT server under Debian 13
Administration/package creation under Windows 11/10
Locked