Page 2 of 2 <12
Topic Options
#26571 - 2002-08-06 06:15 PM Re: Desktop Shortcuts
2hotty Offline
Getting the hang of it

Registered: 2002-04-09
Posts: 76
Loc: London
I checked the help file, but i can't quite grasp the idea of com automation and variables yet.

Below is what i have created for a user called - smithb. Everything is fine except it doesn't seem to delete the desktop shortcut. I am off home now so any ideas overnight are much appreciated.

If @userid = 'smithb'
use t: /delete /persistent
$desktop=readvalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurentVersion\Explorer\User Shell Folders","Desktop")
$file="shortcut to net_share on 'fileserver'(T).lnk"
del $desktop+"\$file"
Endif
_________________________
Any problem encountered is a challenge to overcome.

Top
#26572 - 2002-08-06 06:18 PM Re: Desktop Shortcuts
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
the shortcut can be with another extension.
anyway, if you change the del line to:
del "$desktop\shortcut to net_share on 'fileserver' (T)*"

there is no way it can stay there.
_________________________
!

download KiXnet

Top
#26573 - 2002-08-06 06:35 PM Re: Desktop Shortcuts
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
you may need to do:
$desktop=readvalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Desktop")
$desktop=expandenvironmentvars($desktop)
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#26574 - 2002-08-06 07:24 PM Re: Desktop Shortcuts
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
code:
use T: /delete /persistent
? 'Deleting mapping to drive letter T: '+@ERROR+' - '+@SERROR


$desktop=readvalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Desktop")
? 'Retrieving location of user's DESKTOP folder in his profile: '+@ERROR+' - '+@SERROR


? 'Users DESKTOP folder is located in '+$desktop
$desktop=expandenvironmentvars($desktop)


? Expanding environment variables (if present) and complete path to user's DESKTOP is '+$desktop

del "$desktop\shortcut to net_share on 'fileserver' (T).lnk"
? "Deleting file """+$desktop+"\shortcut to net_share on 'fileserver' (T).lnk"" :"+@ERROR+" - "+@SERROR

I hope this is extensive enough, if you need an even more detailed explanation, then I would suggest you play around with the examples in the KiXtart manual to understand what each command/function/macro is doing.

[ 06. August 2002, 19:26: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#26575 - 2002-08-06 07:52 PM Re: Desktop Shortcuts
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
btw... if you use my code, you only need to do:

deldrive("h")
or
deldrive("t")

as long as you have the 2 functions located somewhere in the script... commonly in the end. refer to the usages of functions.

requires kix 4+

If you need it, I can repost it with the test code still in.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#26576 - 2002-08-07 11:52 AM Re: Desktop Shortcuts
2hotty Offline
Getting the hang of it

Registered: 2002-04-09
Posts: 76
Loc: London
Finally completed this stage, thanks to all you guys, the help is much appreciated. [Smile]
_________________________
Any problem encountered is a challenge to overcome.

Top
Page 2 of 2 <12


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1188 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.147 seconds in which 0.12 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org