Page 3 of 5 <12345>
Topic Options
#89645 - 2002-11-27 04:28 PM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
no, moving the shortcut is really easy.
the only reason for this part of the script is that creating them programmatically with kix is not possible.
moving and modifying them is easy as making some bubu.
_________________________
!

download KiXnet

Top
#89646 - 2002-11-27 04:40 PM Re: help with creating shortcuts with shellLinkObject
DonKing Offline
Fresh Scripter

Registered: 2002-11-27
Posts: 22
Well call me a nono, but so far I'm unsuccesful in copying these shortcuts.

When I use xcopy to copy a shortcut it creates a folder with a target.lnk file in it. The shortcut then doesn't function anymore.

The goal of this all is to supply users with the shortcuts to network resources they need to have access to. So some users need to get more shortcuts then others depending on their profile. Either the shortcuts are created per user at logon, or centrally stored shortcuts are distributed to users folders whichever is the most efficient/feasable.

Using folder shortcuts solves the problem of users being able to see folders they don't have access to. This is a big disadvantage of Windows. Novell offers the Filescan permission that MS lacks.

Top
#89647 - 2002-11-27 04:45 PM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
please do not mention novell.
rather speak of unix clone which it is (like nt too)

anyway, just let me time to make this together.
after doc said that it works only on w2k and newer I stopped writing this.
now I have reason to write it all.

I'll check later on today when I get home to this and maybe even tomorrow morning have you fully functioning UDF, ok?
_________________________
!

download KiXnet

Top
#89648 - 2002-11-27 04:59 PM Re: help with creating shortcuts with shellLinkObject
DonKing Offline
Fresh Scripter

Registered: 2002-11-27
Posts: 22
That would be great!

I'm sure a lot more people will be very grateful when there is a solution to this problem.

I've seen many posts in forums asking how folders can be made invisible to users. If this works they can!

I'll check again tomorrow.

Don

Top
#89649 - 2002-11-27 05:57 PM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
sorry, don't think it will hide anything.
_________________________
!

download KiXnet

Top
#89650 - 2002-11-28 02:03 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
more explanation on the hiding, even though it's direct link to somewhere, there is the way the filesystem journaling is structured.
if your link target is normal windows drive, it will need access to all it's parents on the path to count the correct item.

as there is no execute only method in windows rights, the hiding can't take place...
_________________________
!

download KiXnet

Top
#89651 - 2002-11-28 02:12 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
and, the code.
I don't know do I have enough will to post this in UDF library but here it is:
code:
function Link($LinkDest, optional $workdir, optional $description, optional $saveas)
dim $Shell,$LinkDestFolderItems,$item,$verb,$new,$Shortcut
$Shell=createobject("Shell.application")
$LinkDest=$Shell.namespace($LinkDest).self

for each $item in $LinkDest.parent.items
if $item.islink $LinkDestFolderItems=$LinkDestFolderItems+$item.modifydate+chr(10) endif
next

for each $verb in $LinkDest.verbs
if instr(join(split($verb,"&"),""),readvalue("HKEY_CLASSES_ROOT\lnkfile",""))
$LinkDest.invokeverb(""+$verb)
endif
next

for each $item in $LinkDest.parent.items
if $item.islink
$new=1
for each $itemBefore in split(left($LinkDestFolderItems,len($LinkDestFolderItems)-1),chr(10))
if $itemBefore=$item.modifydate $new=0 endif
next
if $new
$Shortcut=$item.getlink
del $item.path
endif
endif
next
if not vartype($Shortcut) exit 4 endif
$Shortcut.description=""+$description
$Shortcut.workingdirectory=""+$workdir
$Shortcut.save(""+$saveas)
endfunction

you call it like:
link("c:\targetOFtheShortcut","Workindirectorysetting for the shortcut","description, what ever","fully qualified name of the shortcut to saveas")

so, I had these:
link("C:\Documents and Settings\lonkero\desktop\KiXforms\mine","x:\","testing...","c:\dude.lnk")

and it worked fine.
_________________________
!

download KiXnet

Top
#89652 - 2002-11-28 02:19 AM Re: help with creating shortcuts with shellLinkObject
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Jooel,
How does all this relate to 'Add Network Place' as can be done from 'My Network' in Win2K?

Seems to me, that was the request when DonKing hijaaked this thread. Ordinary shortcuts are not the same.

I recall someone asking for this exact same thing a few months back but we couldn't come up with anything then.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#89653 - 2002-11-28 02:23 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
les, well...
this was my thread, so it was my duty to make it good.

anyway, what I read from his hijaack post, it looked like he was saying that "the link in the my network places is no valid, could it be done differently?"

if he is only wanting to add a shortcut in there, I'm totally [Confused]
and that can be done too, but... dunno anymore what he wants [Frown]
_________________________
!

download KiXnet

Top
#89654 - 2002-11-28 02:28 AM Re: help with creating shortcuts with shellLinkObject
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I believe that what he wants is exactly what you get if you use the 'Add Network Place' wizard. Like I said, this was asked before but not answered to satisfaction.

Here is the thread where it started.
http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=1;t=005851#000000

Then another sprung up.
http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=1;t=005865
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#89655 - 2002-11-28 02:55 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
well, how it looked like the first thread was satisfying?

anyway, I can create network shortcuts (just the same as in network neighborhood) but placing them in there gives me the sign of not possible.
_________________________
!

download KiXnet

Top
#89656 - 2002-11-28 02:57 AM Re: help with creating shortcuts with shellLinkObject
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
The first thread was misleading, hence the second.

What do you want for a sign... a burning bush?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#89657 - 2002-11-28 02:58 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
that should do.
_________________________
!

download KiXnet

Top
#89658 - 2002-11-28 03:00 AM Re: help with creating shortcuts with shellLinkObject
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Maybe after you drink a bottle of vodka. [Big Grin]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#89659 - 2002-11-28 03:01 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
I made a bet with a woman that will not drink anything in 4 weeks [Mad] [Eek!] [Mad]

anyway, 10 days has passed already [Big Grin]
_________________________
!

download KiXnet

Top
#89660 - 2002-11-28 03:03 AM Re: help with creating shortcuts with shellLinkObject
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Then I can't deliver on that burning bush. [Frown]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#89661 - 2002-11-28 03:16 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
it been like over a year since I last used my SReg()

has taken almost 5mins processor time and still running...
only HKU [Eek!]

fantastic [Wink]
_________________________
!

download KiXnet

Top
#89662 - 2002-11-28 09:18 AM Re: help with creating shortcuts with shellLinkObject
DonKing Offline
Fresh Scripter

Registered: 2002-11-27
Posts: 22
First, it wasn't my intention to hijaak this thread. Sorry for that....

Let me clarify myself by explaining the whole story:

We supply our users with a driveletter connection to their department data. But requests have come in to give users access to multiple department folders. One option is to connect multiple driveletters, but we have only 26 and we have little driveletters left. The second option is to map the drive one share up, but then the user can see ALL subfolders (departments) including the ones the users doesn't have access to. It is impossible to hide these folders by changing NTFS permissions our other tricks.

Then I came up with another solution. What if we map a driveletter to an empty folder in the users roaming profile and copy the appropriate folder shortcuts (to different shares on the network) to that mapping during logon. Then the user only sees the folders he needs to see, and is still using only one driveletter. This would be a very flexible solution as there is no limit to the amount of shortcuts. The problem with folder shortcuts however is that distribution or creation through a logonscript is a bit of a problem. Ordinary shortcuts won't do as browsing back and forth through the folderstructure goes bad as soon as you go back up the structure. Then the user will see the entire network instead of the path he came from.

So using folder shortcuts is a workaround for the problem of not being able to hide folders in a Windows network.

The not hiding part is a problem that comes up frequently on network admins forums. If we can create a workaround as described many would be happy I think. At least I would!

So indeed I mean the shortcuts as one can create under My Network places, but I want to create them through a script OR be able to copy the shortcuts I make myself during logon. Both solutions are a problem for me.

I hope this clarifies the goal of my questions.

Don

Top
#89663 - 2002-11-28 09:54 AM Re: help with creating shortcuts with shellLinkObject
DonKing Offline
Fresh Scripter

Registered: 2002-11-27
Posts: 22
Lonkero,

I've tried the code and it stops at:
if not vartype($Shortcut) exit 4

When debugging (/D) the script loops a few times at: if $item.islink ... next and then jumps to the line above (if not vartype($Shortcut) exit 4).

I called the function as follows:
Link("\\s300-100\software$","g:\","TESTLINK...","e:\ff\testlink")

Top
#89664 - 2002-11-28 10:20 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
well, like I said, it needs access to parent item which it doesn't have.
and, if it would work, you would still need to call it with proper ending (.lnk)
Link("\\s300-100\software$","g:\","TESTLINK...","e:\ff\testlink.lnk")

anyway, I checked on that folder link thing.
it is nothing more than a link file inside a folder...

I might explain a little.
the link user sees actually is a folder and in that folder there is two files.
target.lnk and the faker. with faker I mean the normal "hide" util of windows world, desktop.ini

I got tired coding it but everything else has worked fine but I've been unable to do shortcuts to shares... well proper shortcuts.

share shortcuts are easy to do with .url:
[InternetShortcut]
URL=file://gws_pikval/e
IconIndex=9
IconFile=C:\WINNT\system32\SHELL32.DLL

anyway, will have to see more on that once I get my eyes open.
_________________________
!

download KiXnet

Top
Page 3 of 5 <12345>


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

Who's Online
1 registered (Allen) and 289 anonymous users online.
Newest Members
Praveer, Ollero, rayyo, Foxlicht, DonChild
17742 Registered Users

Generated in 0.043 seconds in which 0.012 seconds were spent on a total of 12 queries. Zlib compression enabled.

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