Page 1 of 1

Creating shortcuts on the public desktop

Published: March 1, 2016 - 2:18 PM
by gaelds
Good morning,

I'm stuck on creating a shortcut in a folder on the public desktop. `mkdirs` correctly creates the "Miscellaneous" folder, but then neither of the two `create_shortcut` lines adds a shortcut...

Code: Select all

if not isdir(makepath(common_desktop(),'Logiciels','Divers')):
        mkdirs(makepath(common_desktop(),'Logiciels','Divers'))
        create_shortcut(makepath(common_desktop(),'Logiciels','Divers','Ebeam Home'),target=u'C:\Program Files (x86)\Luidia\eBeam Interactive Suite\eBeamHome\eBeamHome.exe')
        create_shortcut(makepath(common_desktop(),'Logiciels','Divers','Ebeam Home'),target=makepath('C:\\','Program Files (x86)','Luidia','eBeam Interactive Suite','eBeamHome','eBeamHome.exe'))

Re: Creating a desktop shortcut

Published: March 1, 2016 - 3:13 PM
by htouvet
create_desktop_shortcut creates a shortcut on the shared desktop, so you don't need to go through the path.

https://dev.tranquil.it/sphinxdocs/sour ... p_shortcut

Something like this should work:

Code: Select all

def install():
    mkdirs(makepath(common_desktop(),'Logiciels','Divers'))
    create_desktop_shortcut(makepath('Logiciels','Divers','Ebeam Home.lnk'),target=makepath(programfiles32,'Luidia','eBeam Interactive Suite','eBeamHome','eBeamHome.exe'))

Re: Creating a desktop shortcut

Published: March 3, 2016 - 4:12 PM
by gaelds
Yes, it works, thank you very much!

Re: Creating a desktop shortcut

Published: March 4, 2016 - 09:38
by gaelds
Sorry, same problem today using the same code for the Scratch software; the shortcut won't create. I can't see what could be wrong with the code...

Code: Select all

    if not isdir(makepath(common_desktop(),'Logiciels','Informatique Programmation')):
        mkdirs(makepath(common_desktop(),'Logiciels','Informatique Programmation'))
    create_desktop_shortcut(makepath('Logiciels','Informatique Programmation','Scratch.lnk'),target=makepath(programfiles32,'Scratch 2','Scratch 2.exe'))
The executable is indeed located in "C:\Program Files (x86)\Scratch 2\Scratch 2.exe". No errors were reported during installation.

Re: Creating shortcuts on the public desktop

Published: March 4, 2016 - 09:53
by htouvet
That seems about right to me.
At least, it works here...

Re: Creating shortcuts on the public desktop

Published: March 4, 2016 - 11:43
by gaelds
Yes, I don't understand it at all; the same lines of code work in my PhotoFiltre package.

Re: Creating shortcuts on the public desktop

Published: March 7, 2016 - 09:56
by Floflobel
Perhaps the indentation?