Probleme de suppression de raccourcis

Résolu
cs_Stubbornman Messages postés 80 Date d'inscription lundi 18 février 2002 Statut Membre Dernière intervention 12 janvier 2007 - 25 août 2005 à 13:07
cs_Stubbornman Messages postés 80 Date d'inscription lundi 18 février 2002 Statut Membre Dernière intervention 12 janvier 2007 - 25 août 2005 à 14:30
Salut a tous,

J'ai cree un logiciel en java, pour lequel j'ai cree un installer. Dans cet installer, j'ai fait en sorte que des raccourcis soient crees dans le menu Demarrer et sur le bureau, a l'aide d'un fichier .js

Je suis actuellement en train de creer l'uninstaller et je souhaiterais supprimer les raccourcis prealabalement crees. ca fonctionne pour les raccourcis du menu Demarrer, mais pas pour le raccourci du bureau...

Voici le code pour la creation des raccourcis:

WScript.Echo("Creating shortcuts...");
Shell = new ActiveXObject("WScript.Shell");
ProgramsPath = Shell.SpecialFolders("Programs");
fso = new ActiveXObject("Scripting.FileSystemObject");
if (!fso.folderExists(ProgramsPath + "\\\" + folder + ""))
fso.CreateFolder(ProgramsPath + "\\\" + folder + "");
link = Shell.CreateShortcut(ProgramsPath + "\\\" + folder + "\\\" + name + ".lnk");
link.Arguments = "";
link.Description = "" + name + "";
link.HotKey = "";
link.IconLocation = "" + escaped(installDir.getAbsolutePath()) + "\\\" + "RecipeManager.ico,0";
link.TargetPath = "" + escaped(installDir.getAbsolutePath()) + "\\\" + runnable + "";
link.WindowStyle = 1;
link.WorkingDirectory = "" + escaped(installDir.getAbsolutePath()) + "";
link.Save();
DesktopPath = Shell.SpecialFolders("Desktop");
link = Shell.CreateShortcut(DesktopPath + "\\\" + name + ".lnk");
link.Arguments = "";
link.Description = "" + name + "";
link.HotKey = "";
link.IconLocation = "" + escaped(installDir.getAbsolutePath()) + "\\\" + "RecipeManager.ico,0";
link.TargetPath = "" + escaped(installDir.getAbsolutePath()) + "\\\" + runnable + "";
link.WindowStyle = 1;
link.WorkingDirectory = "" + escaped(installDir.getAbsolutePath()) + "";
link.Save();
WScript.Echo("Shortcuts created.");


Et pour la suppressions des raccourcis:
WScript.Echo("Creating shortcuts...");
Shell = new ActiveXObject("WScript.Shell");
ProgramsPath = Shell.SpecialFolders("Programs");
fso = new ActiveXObject("Scripting.FileSystemObject");
if (fso.folderExists(ProgramsPath + "\\\" + folder + ""))
fso.RemoveFolder(ProgramsPath + "\\\" + folder + "");
DesktopPath = Shell.SpecialFolders("Desktop");
link = Shell.RemoveShortcut(DesktopPath + "\\\" + name + ".lnk");
WScript.Echo("Shortcuts created.");


Savez-vous pourquoi ca ne fonctionne pas ????
Merci d'avance.

1 réponse

cs_Stubbornman Messages postés 80 Date d'inscription lundi 18 février 2002 Statut Membre Dernière intervention 12 janvier 2007
25 août 2005 à 14:30
Le problème a été résolu...
En fait c'était une erreur bête:

WScript.Echo("Creating shortcuts...");
Shell = new ActiveXObject("WScript.Shell");
ProgramsPath = Shell.SpecialFolders("Programs");
fso = new ActiveXObject("Scripting.FileSystemObject");
if (fso.folderExists(ProgramsPath + "\\\" + folder + ""))
fso.RemoveFolder(ProgramsPath + "\\\" + folder + "");
DesktopPath = Shell.SpecialFolders("Desktop");
if (fso.fileExists(DesktopPath + "\\\" + name + ".lnk"))
fso.RemoveFile(DesktopPath + "\\\" + name + ".lnk");
WScript.Echo("Shortcuts created.");


Voila. C'était tout simple.
3
Rejoignez-nous