Comment créer un raccourci

fbrt Messages postés 39 Date d'inscription lundi 25 février 2002 Statut Membre Dernière intervention 16 avril 2005 - 26 avril 2002 à 11:01
rclsilver02 Messages postés 130 Date d'inscription mercredi 19 mars 2003 Statut Membre Dernière intervention 10 février 2012 - 24 juin 2003 à 12:56
Bonjour a tous

Je sais qu'il y a existe deja bcp de sources et de messages concernant les raccourcis mais je n'ai pas obtenu satisfaction : les fonctions ne marchaient pas (en tout cas chez moi).
Si qq'un sait comment créer le raccourci du programme "fichier" a l'adresse "adresse1", ca serait sympa qu'il m'éclaire.
Merci beaucoup

Fbrt

9 réponses

cs_oliver68 Messages postés 117 Date d'inscription lundi 17 décembre 2001 Statut Membre Dernière intervention 10 mars 2003
26 avril 2002 à 13:45
salut,

j'ai trouvé ça dans mon windows :

' Script d'exemple pour l'environnement d'exécution de scripts Windows
'
' ------------------------------------------------------------------------
' Copyright (C) 1996 Microsoft Corporation
'
' ------------------------------------------------------------------------
'
' Cet exemple montre comment utiliser un objet WshShell
' pour créer un raccourci sur le bureau.

L_Welcome_MsgBox_Message_Text = "Cet exemple va créer un raccourci vers le Bloc-notes sur votre Bureau."
L_Welcome_MsgBox_Title_Text = "Environnement d'exécution de scripts Windows"
Call Welcome()

' ********************************************************************************
' *
' * Méthodes relatives au raccourci.
' *

Dim WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")

Dim MyShortcut, MyDesktop, DesktopPath

' Lecture du chemin du Bureau en utilisant l'objet WshSpecialFolders
DesktopPath = WSHShell.SpecialFolders("Desktop")

' Création d'un objet raccourci sur le Bureau
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\Raccourci vers le Bloc-notes.lnk")

' Paramétrage des propriétés de l'objet raccourci et sauvegarde
MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings("%windir%\notepad.exe")
MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings("%windir%")
MyShortcut.WindowStyle = 4
MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("%windir%\notepad.exe, 0")
MyShortcut.Save

WScript.Echo "Un raccourci vers le Bloc-notes est maintenant présent sur votre Bureau."

' ********************************************************************************
' *
' * Bienvenue
' *
Sub Welcome()
Dim intDoIt

intDoIt = MsgBox(L_Welcome_MsgBox_Message_Text, _
vbOKCancel + vbInformation, _
L_Welcome_MsgBox_Title_Text )
If intDoIt = vbCancel Then
WScript.Quit
End If
End Sub
0
fbrt Messages postés 39 Date d'inscription lundi 25 février 2002 Statut Membre Dernière intervention 16 avril 2005
26 avril 2002 à 13:52
merci mceric beaucoup

Fbrt
0
fbrt Messages postés 39 Date d'inscription lundi 25 février 2002 Statut Membre Dernière intervention 16 avril 2005
26 avril 2002 à 14:01
Excuse moi c'est encore moi, il me dit :
Variable non définie : WScript
0
fbrt Messages postés 39 Date d'inscription lundi 25 février 2002 Statut Membre Dernière intervention 16 avril 2005
26 avril 2002 à 14:57
Je m'excuse pour la file des messages que j'ai mis. j'ai fini par trouvé une petite solution : il suffit d'effacer les "WScript".
En plus, la fonction "SpecialFolders" va bcp me servir. Ici elle sert pour le bureau, mais je me suis renseigné et voici toutes les valeurs a mettre dans la fonction :

AllUsersDesktop
AllUsersStartMenu
AllUsersPrograms
AllUsersStartup
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Récent
SendTo
StartMenu
Startup
Templates

Voila. Merci Oliver68, tu m'as trouvé mon bonheur :-)

A+
Encore merci

Fbrt
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_oliver68 Messages postés 117 Date d'inscription lundi 17 décembre 2001 Statut Membre Dernière intervention 10 mars 2003
28 avril 2002 à 14:20
de rien, j'ai rien fait d'autre que copier/coller un ex de script VBS du PC du boulot...
Poste ton code dans les sources, ça pourra servir, on sait jamais...

ciao.
0
rclsilver02 Messages postés 130 Date d'inscription mercredi 19 mars 2003 Statut Membre Dernière intervention 10 février 2012
5 juin 2003 à 23:42
j ai colle ceci dans un ComandBouton :
Dim WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")
Dim MyShortcut, MyDesktop, DesktopPath
' Lecture du chemin du Bureau en utilisant l'objet WshSpecialFolders
DesktopPath = WSHShell.SpecialFolders("Desktop")
' Création d'un objet raccourci sur le Bureau
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\Raccourci vers le Bloc-notes.lnk")
' Paramétrage des propriétés de l'objet raccourci et sauvegarde
MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings("%windir%\notepad.exe")
MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings("%windir%")
MyShortcut.WindowStyle = 4
MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("%windir%\notepad.exe, 0")
MyShortcut.Save


et il me di Objet requis au niveau de

Set WSHShell = WScript.CreateObject("WScript.Shell")


Comment résoudre ce pb ?
0
gerald24ans Messages postés 23 Date d'inscription vendredi 4 octobre 2002 Statut Membre Dernière intervention 10 juillet 2003 2
24 juin 2003 à 12:16
MEME PROBLEME D ERREUR, AS TU TROUVE LA SOLUTION ?
SI OUI, MERCI DE ME DIRE COMMENT.

Gerald .... hé hé ....
0
rclsilver02 Messages postés 130 Date d'inscription mercredi 19 mars 2003 Statut Membre Dernière intervention 10 février 2012
24 juin 2003 à 12:36
non, toujours pas trouvé ...
0
rclsilver02 Messages postés 130 Date d'inscription mercredi 19 mars 2003 Statut Membre Dernière intervention 10 février 2012
24 juin 2003 à 12:56
si, je viens de trouver ... il faut remplacer la ligne ki foire c est adire celle ci : Set WSHShell = WScript.CreateObject("WScript.Shell") par celle ci : Set WSHShell = CreateObject("Wscript.Shell")
bonne prog a tous
0
Rejoignez-nous