Page 1 of 2 12>
Topic Options
#53670 - 2001-02-07 05:51 PM desk top icon for mapped drives
Anonymous
Unregistered


can anyone tell me how to (using kixtart) create a icon on the users desk top for each of the mapped drives, can kixtart do this.

Top
#53671 - 2001-02-08 04:27 AM Re: desk top icon for mapped drives
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Do you want a shortcut or a desktop icon (like IE or Outlook)???

Shortcuts are easier...

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#53672 - 2001-02-09 12:36 AM Re: desk top icon for mapped drives
Anonymous
Unregistered


I am looking for a shortcut
Top
#53673 - 2001-02-08 02:12 PM Re: desk top icon for mapped drives
Anonymous
Unregistered


Hya Jim..,

Try this for size.. It will create for every mapped networkdrive a shortcut on your desktop.

code:
CLS
BREAK ON
$DriveLetterCHAR=67
WHILE $DriveLetterCHAR=>65 AND $DriveLetterCHAR=<90
$DriveLetter=CHR($DriveLetterCHAR)+":"
IF EXIST($DriveLetter)
SHELL'%ComSpec% /C NET USE $DriveLetter>c:\temp\NetUSe_$DriveLetterCHAR.dat'
CLS
ENDIF
$NULL=OPEN(1,"c:\temp\NetUSe_$DriveLetterCHAR.dat")
$LINE1=READLINE(1)
$NULL=CLOSE(1)
IF INSTR($LINE1,"Local name")<>0
AT(02,02)"Drive : "$DriveLetter AT(04,02)
$CLSID="{AAAAAAAA-0000-0000-0000-0000000000"+$DriveLetterCHAR+"}"
$LinkName=$DriveLetter+" [Network]"
$Command="%SystemRoot%\Explorer.exe "+$DriveLetter
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\DefaultIcon")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\InProcServer32")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\Shell")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\Shell\Connect")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\Shell\Connect\Command")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\ShellEx")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\ShellEx\PropertySheetHandlers")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\ShellEx\PropertySheetHandlers\$CLSID")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\ShellEx\ShellFolder")
$NULL=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID","",$LinkName,"REG_SZ")
$NULL=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID\DefaultIcon","","%SystemRoot%\System32\Shell32.dll,9","REG_SZ")
$NULL=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID\InProcServer32","","shell32.dll","REG_SZ")
$NULL=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID\InProcServer32","ThreadingModel","Apartment","REG_SZ")
$NULL=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID\Shell\Connect\Command","",$Command,"REG_SZ")
$NULL=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID\ShellFolder","Attributes","0","REG_DWORD")
$NULL=addkey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\$CLSID")
ENDIF
$DriveLetterCHAR=$DriveLetterCHAR+1
LOOP
DEL"c:\temp\NetUSe_*.dat"

Warring this is a very brute way to create shortcuts..!!

------------------
To Be Of Service..,
Fabian.
-----------------Paranoia is reality on a finer scale-----------------

[This message has been edited by Fabian (edited 08 February 2001).]

Top
#53674 - 2001-02-08 02:16 PM Re: desk top icon for mapped drives
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Fabian:

WOW - correct me if I'm wrong - but did you just write a kix script that creates custom namespaces on the desktop ? Baby...

Shawn.

Top
#53675 - 2001-02-08 02:18 PM Re: desk top icon for mapped drives
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
OR

Just store a shortcut on the server (*.lnk), and copy it to the users desktop?

_________________________
The tart is out there

Top
#53676 - 2001-02-08 03:01 PM Re: desk top icon for mapped drives
Anonymous
Unregistered


Forgot to tell you that I am trying to create a shortcut for mapped drives with windows 98 workstations
Top
#53677 - 2001-02-08 03:07 PM Re: desk top icon for mapped drives
Anonymous
Unregistered


Hya Shawn..,

Thx.. if you Replace "..\Explorer\Desktop\NameSpace" with "..\Explorer\MyComputer\NameSpace" you get the same thing in "MyComputer".. funny isn't it..!?

Top
#53678 - 2001-02-08 03:44 PM Re: desk top icon for mapped drives
Anonymous
Unregistered


Fabian that did not work
I am using 98 workstations

Top
#53679 - 2001-02-08 04:30 PM Re: desk top icon for mapped drives
Wizard Offline
Hey THIS is FUN
*****

Registered: 2000-12-05
Posts: 264
Loc: Bristol, England
Wow.
This works like a charm on NT4.

God-Like.

_________________________
Wizard
There's no place like 127.0.0.1

vb | kix | batch | html | cfm | js | english

Top
#53680 - 2001-02-08 04:58 PM Re: desk top icon for mapped drives
Anonymous
Unregistered


Hya Folks..,

Yes.. you could create 'normale' shortcuts (.lnk) in an central place and copy them to every user desktop.., BUT!! beware of the use of UNC paths in shortcuts who uses files (.ico, .exe, etc) from locations like %SystemRoot% and so.. (check this with a HexViewer) If you copy such a shortcut to other users.. their systems will allways check the network accessablility of the Original shortcut locations and associations..!! Beware..!!

PS.. I forgot.. I have updated the script above to function on Win9x as well..!? Cya..!!
------------------
To Be Of Service..,
Fabian.
-----------------Paranoia is reality on a finer scale-----------------

[This message has been edited by Fabian (edited 08 February 2001).]

Top
#53681 - 2001-02-09 05:19 AM Re: desk top icon for mapped drives
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Here is a slight modification to Fabian's script. It places Icons for all drives (local and network) and removes the ones that are no longer present (disconnected)

never let a good script go unmodified...

code:

CLS
BREAK ON
$DriveLetterCHAR=67
WHILE $DriveLetterCHAR=>65 AND $DriveLetterCHAR=<90
$DriveLetter=CHR($DriveLetterCHAR)+":"
$CLSID="{AAAAAAAA-0000-0000-0000-0000000000"+$DriveLetterCHAR+"}"
IF EXIST($DriveLetter)
SHELL'%ComSpec% /C NET USE $DriveLetter>d:\temp\NetUSe_$DriveLetterCHAR.dat 2>nul'
$LinkName=$DriveLetter+" [Local]"
$driveicon="8"
if getfilesize("d:\temp\NetUSe_$DriveLetterCHAR.dat")>0
$LinkName=$DriveLetter+" [Network]"
$driveicon="9"
endif
$Command="%SystemRoot%\Explorer.exe "+$DriveLetter
$=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID")
$=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\DefaultIcon")
$=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\InProcServer32")
$=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\Shell")
$=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\Shell\Connect")
$=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\Shell\Connect\Command")
$=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\ShellEx")
$=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\ShellEx\PropertySheetHandlers")
$=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\ShellEx\PropertySheetHandlers\$CLSID")
$=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\ShellEx\ShellFolder")
$=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID","",$LinkName,"REG_SZ")
$=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID\DefaultIcon","","%SystemRoot%\System32\Shell32.dll,$driveicon","REG_SZ")
$=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID\InProcServer32","","shell32.dll","REG_SZ")
$=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID\InProcServer32","ThreadingModel","Apartment","REG_SZ")
$=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID\Shell\Connect\Command","",$Command,"REG_SZ")
$=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID\ShellFolder","Attributes","0","REG_DWORD")
$=addkey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\$CLSID")
else
$=deltree("HKEY_CLASSES_ROOT\CLSID\$CLSID")
$=deltree("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\$CLSID")
endif
$DriveLetterCHAR=$DriveLetterCHAR+1
LOOP
DEL"d:\temp\NetUSe_*.dat"

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#53682 - 2001-02-09 08:26 AM Re: desk top icon for mapped drives
Anonymous
Unregistered


Hi all,

Can anyone tell me what a "Name Space" is all about and maybe point me in a direction I could do some reading on them...

A couple other comments which I think would enhance the results a little would be:

1. Can you detect whether a drive is local or network so icon could be changed appropriatley?

2. Can you retrieve the server name and share the drive is connected to so the Icon(?) can be named appropriately?

Otherwise an excellent script.

Thanks,

Terry.

[This message has been edited by binghamt (edited 09 February 2001).]

[This message has been edited by binghamt (edited 09 February 2001).]

Top
#53683 - 2001-02-09 02:18 PM Re: desk top icon for mapped drives
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Terry:

Namespace... ermmm... ummm...

A namespace is a COM object that can plug directly into (and communicate with) the Windows Explorer Shell (Desktop) ...

Ummm... the best way to describe it would be to tell you what it's not - it's not a shortcut... when you right-click on a desktop shortcut - you get the standard stuff like open,scan sendto, etc...

When you right click on a desktop namespace - explorer calls a special function in the namespace object to display it's own right-click menu items ...

When you double-click on a shortcut - it runs whatever is defined in the target. When you double-click on a namespace object - explorer communicates with the object (through another special function) and helps it to display (in explorer fashion) whatever it is the namespace wants displayed...

Hope this helps ?

Shawn.

Top
#53684 - 2001-02-09 06:43 PM Re: desk top icon for mapped drives
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
The modified script I posted includes the function to 'desktop iconify' all local and network drives, with local/network text labels.

It shouldn't be too dificult to include the server\sharename as it's label...

Anyone figure out how to refresh the desktop??

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#53685 - 2002-09-12 02:17 AM Re: desk top icon for mapped drives
El Guappo Offline
Fresh Scripter

Registered: 2002-05-14
Posts: 10
Loc: Vancouver, BC
Hey,

I've been trying to figure out why I get a network connection not found error when running this script. It happens when the Shell line is executed. All path statements are correct and the comspec variable has been set (Enviroment Variables). With this failure, it still can see the mapped drive, but any registry edits fail...

any ideas?

ElGuappo

Top
#53686 - 2002-09-12 07:36 AM Re: desk top icon for mapped drives
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
elguappo,

I have not tried this code myself. This is an old post so I assume it was written for KiXtart v3.6x (however I don't see anything odd in the code that strikes me as not working for v4.x either)

Please post what version of KiXtart you're using and what OS you're trying to run this on. There are other ways to copy shortcuts if that is what you're after.

Also please post your complete script here so that we can review it. Maybe something was accidentally removed or modified that is causing an issue. Please post the code between the CODE tags.

Top
#53687 - 2002-09-12 03:24 PM Re: desk top icon for mapped drives
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
lots of UDFs...

code:
for each $drive in split(DriveEnum(3))
$share=DriveProp($Drive)
$sharepath=$share[2]
$name=split($sharepath,"\")[3]
$server=split($sharepath,"\")[2]
$=WshShortCut("$desktop\$name on $server.lnk","$sharepath")
next

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#53688 - 2002-09-12 06:15 PM Re: desk top icon for mapped drives
El Guappo Offline
Fresh Scripter

Registered: 2002-05-14
Posts: 10
Loc: Vancouver, BC
I have not changed the code too much since it does exactly what I want. This is the code

code:
CLS
BREAK ON
md temp
$DriveLetterCHAR=67
WHILE $DriveLetterCHAR=>65 AND $DriveLetterCHAR=<90
$DriveLetter=CHR($DriveLetterCHAR)+":"
IF EXIST($DriveLetter)
SHELL '%COMSPEC% /c NET USE $DriveLetter>c:\temp\NetUSe_$DriveLetterCHAR.dat'
CLS
ENDIF
$NULL=OPEN(1,"c:\temp\NetUSe_$DriveLetterCHAR.dat")
$LINE1=READLINE(1)
$NULL=CLOSE(1)
IF INSTR($LINE1,"Local name")<>0
AT(02,02)"Drive : "$DriveLetter AT(04,02)
$CLSID="{AAAAAAAA-0000-0000-0000-0000000000"+$DriveLetterCHAR+"}"
$LinkName=$DriveLetter+"@Userid Home Drive"
$Command="%SystemRoot%\Explorer.exe "+$DriveLetter
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\DefaultIcon")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\InProcServer32")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\Shell")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\Shell\Connect")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\Shell\Connect\Command")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\ShellEx")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\ShellEx\PropertySheetHandlers")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\ShellEx\PropertySheetHandlers\$CLSID")
$NULL=addkey("HKEY_CLASSES_ROOT\CLSID\$CLSID\ShellEx\ShellFolder")
$NULL=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID","",$LinkName,"REG_SZ")
$NULL=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID\DefaultIcon","","%SystemRoot%\System32\Shell32.dll,9","REG_SZ")
$NULL=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID\InProcServer32","","shell32.dll","REG_SZ")
$NULL=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID\InProcServer32","ThreadingModel","Apartment","REG_SZ")
$NULL=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID\Shell\Connect\Command","",$Command,"REG_SZ")
$NULL=writevalue("HKEY_CLASSES_ROOT\CLSID\$CLSID\ShellFolder","Attributes","0","REG_DWORD")
$NULL=addkey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\$CLSID")
ENDIF
$DriveLetterCHAR=$DriveLetterCHAR+1
LOOP
DEL"c:\temp\NetUSe_*.dat"

It does everything I need...searches for mapped drives then edits the registry. PERFECT. But, running this on my W2K server, with W2K Prof w/s. Kixtart version 4.02 it fails to see the COMSPEC

EG

Top
#53689 - 2002-09-12 06:23 PM Re: desk top icon for mapped drives
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Doesn't this SHELL '%COMSPEC% /c NET USE $DriveLetter>c:\temp\NetUSe_$DriveLetterCHAR.dat' need additional spaces around the '>'?
code:
SHELL '%COMSPEC% /c NET USE '+$DriveLetter+' > c:\temp\NetUSe_'+$DriveLetterCHAR+'.dat'

You should also properly format strings with quotes and indent your code in order to make it more readable.

[ 12. September 2002, 18:25: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 2 12>


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

Who's Online
1 registered (Allen) and 675 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.072 seconds in which 0.028 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