Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Running a shortcut from within Foxpro
Message
De
23/04/2003 14:21:01
Len Wooden
Statistical Resources, Inc
Baton Rouge, Louisiane, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00780657
Message ID:
00780732
Vues:
9
>Len,
>
>First, since you seem to have some familarity with the WSH, you might use the Scripting.FileSystemObject's GetFile() method to get a reference to the link file, then use the ShortPath property as a parameter for the Run method of the Shell.
>
>Second, the CreateShort method will return an object reference to an existing shortcut. The following displays the the target on the VFP main screen.
oShell = CREATEOBJECT('WScript.Shell')
>lcpath = ADDBS(oShell.SpecialFolders('Desktop'))
>lcfile = lcpath + "Microsoft Visual FoxPro 8.0.lnk"
>oLNK = oShell.CreateShortcut(lcfile)
>? oLNK.TargetPath
First, allow me to wipe the egg off of my face.. here's the sample code

WshShell = CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
oShellLink = WshShell.CreateShortcut(strDesktop + "\Acrobat Reader 5.1.lnk")
myCmd=oShellLink.TargetPath
myCmd='"'+myCmd+'"'
? "= "+ myCmd
WshShell.run(myCmd)

Apparently, I didnt realize that SpecialFolders("Desktop") was returning the currently logged on user's Desktop ala Documents and Setting\Len\Desktop and my created shortcut to a folder actually existed there.. the installed shortcuts however, exist in Documents and Settings\All Users\Desktop and that explains why my tests failed.. The real question appears to be.. how do I get a reference to All Users Desktop (is there a parameter like Desktop that I can use or do I have to use brute force)?

-- Len
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform