LonkeroAdministrator
(KiX Master Guru)
2002-11-19 11:20 PM
help with creating shortcuts with shellLinkObject

I've made a quite progress now, but am unable to create a file with shell's scriptable objects.
I know how to create a new folder.
and I can create a new shortcut if I have one previously done which I can point to...
I'll continue searching, but this is all I have this far:
code:
$Shell=createobject("Shell.application")
$NameSpace=$Shell.namespace("C:\Documents and Settings\niemjo\KiXforms\test.kix.lnk")
$Link=$NameSpace.self.getlink
$Link.description="testi linkki"
$Link.Path="C:\Documents and Settings\niemjo\KiXforms\test.kix"
$Link.workingdirectory="c:\"
$Link.save()

anyone any success on this?


LonkeroAdministrator
(KiX Master Guru)
2002-11-20 12:40 AM
Re: help with creating shortcuts with shellLinkObject

heh, this is fun.
I got pretty far with deletion and modification of shortcuts.
as example, to show the type of file, just do:
code:
$path="%windir%"
$explorer=createobject("shell.application")
$folder=$explorer.namespace($path)
$items=$explorer.namespace($path).items
for each $item in $items
? $folder.getdetailsof($item,2)
next

still no luck with the creation.
the parsename-method promised to create but it was no go.


ShawnAdministrator
(KiX Supporter)
2002-11-20 01:14 AM
Re: help with creating shortcuts with shellLinkObject

Thought this one was kinda neat:

$Shell = CreateObject("Shell.application")
$Shell.BrowseForFolder(0,"Title",0)


LonkeroAdministrator
(KiX Master Guru)
2002-11-20 01:17 AM
Re: help with creating shortcuts with shellLinkObject

[Cool]
dude, me should sleeping be.
started rewriting unlink.udf and shortcut.udf and and added new start with folder details. eh?

can't finish these today, that's for sure.


ShawnAdministrator
(KiX Supporter)
2002-11-20 01:21 AM
Re: help with creating shortcuts with shellLinkObject

Sorry about that - was just surfn MSDN on some of these ShellLink methods your working on and happened to see that there - couldn't resist. Somebodys probably already turned this into a UDF anyways ...

LonkeroAdministrator
(KiX Master Guru)
2002-11-20 01:25 AM
Re: help with creating shortcuts with shellLinkObject

turned what to udf?
all these things I saw in udf's were made with scripting host.


Chris S.
(MM club member)
2002-11-22 01:34 AM
Re: help with creating shortcuts with shellLinkObject

Hmm. This has been a tricky one. I was able to create a shortcut. It creates the shortcut in the same directory as the shortcut target, so it'll have to be renamed/moved/... afterwards.

code:
$objShell = CreateObject("Shell.Application")
$objFolderItem = $objShell.NameSpace("C:\Documents and Settings\Chris\Desktop\kixforms.zip").Self
$objFolderItem.InvokeVerb("Create &Shortcut")



LonkeroAdministrator
(KiX Master Guru)
2002-11-22 01:37 AM
Re: help with creating shortcuts with shellLinkObject

hey thanks!
I cracked the object for 20 hours this week and could not get it!
invokeverbs, tricky! but, will work with that then. it's better than nothing.


LonkeroAdministrator
(KiX Master Guru)
2002-11-22 01:53 AM
Re: help with creating shortcuts with shellLinkObject

got over that now [Wink]
some problems still to gather...


LonkeroAdministrator
(KiX Master Guru)
2002-11-22 02:04 AM
Re: help with creating shortcuts with shellLinkObject

yep...
can actually invoke the create shortcut wizard:
shell "rundll32.exe appwiz.cpl,NewLinkHere $LinkDest"

but, can't create the shortcut...
the invokeverbs is bad as I would need to somehow know the name for create shortcut.
could not find anything even close in the reg.

as mine is "luo pikakuvake", would need to find a way for this...


Chris S.
(MM club member)
2002-11-22 02:13 AM
Re: help with creating shortcuts with shellLinkObject

I was thinking that you could parse through the folder and find all .lnk's then look at the create date.

LonkeroAdministrator
(KiX Master Guru)
2002-11-22 02:25 AM
Re: help with creating shortcuts with shellLinkObject

yep, but not that far yet.
found a solution for the invokeverb thingie...
to retrieve the correct verb, I did:
code:
for each $verb in $Folderitem
if instr(join(split($verb,"&"),""),readvalue("HKEY_CLASSES_ROOT\lnkfile",""))
$verb
endif
next



Chris S.
(MM club member)
2002-11-22 02:29 AM
Re: help with creating shortcuts with shellLinkObject

Oh, well there is this method as well...

code:
$objShell = CreateObject("Shell.Application")
$objFolderItem = $objShell.NameSpace("C:\Documents and Settings\Chris\Desktop\kixforms.zip").Self
;$objFolderItem.InvokeVerb("Create &Shortcut")

$Verbs = $objFolderItem.Verbs
For Each $Verb in $Verbs
$Verb ?
Next



LonkeroAdministrator
(KiX Master Guru)
2002-11-22 02:30 AM
Re: help with creating shortcuts with shellLinkObject

chris, do you read my post before you reply to it?

take a good look.

{edit}
oh, my verbs collection is named as folderitem.
got tired of changing the varNames [Wink]

[ 22. November 2002, 02:33: Message edited by: Lonkero ]


Chris S.
(MM club member)
2002-11-22 02:37 AM
Re: help with creating shortcuts with shellLinkObject

I scimmed it [Wink] , but didn't see you creating the collection. So, I assumed you was pulling the verb from somewhere else. I figured it out, but you had already called me out. [Roll Eyes]

LonkeroAdministrator
(KiX Master Guru)
2002-11-22 02:50 AM
Re: help with creating shortcuts with shellLinkObject

there is something still screwed up as it does not invoke the correct one, but the default.
code:
for each $verb in $LinkDest.verbs
if instr(join(split($verb,"&"),""),readvalue("HKEY_CLASSES_ROOT\lnkfile",""))
$LinkDest.invokeverb($verb)
; $LinkDest.doit()
endif

the default being "Avaa" or in english open...

[ 22. November 2002, 02:51: Message edited by: Lonkero ]


LonkeroAdministrator
(KiX Master Guru)
2002-11-22 08:13 PM
Re: help with creating shortcuts with shellLinkObject

chris,
have you got it to working with enumerated verb?
I made it this far and it looks ok, can you try it out as can't get it to invoke anything else than default:
code:
for each $verb in $LinkDest.verbs
?
if instr(join(split($verb,"&"),""),readvalue("HKEY_CLASSES_ROOT\lnkfile",""))
"here is the correct verb:>" $verb "<"
$LinkDest.invokeverb($verb)
else
"not correct:>" $verb "<"
endif
next



Chris S.
(MM club member)
2002-11-22 08:42 PM
Re: help with creating shortcuts with shellLinkObject

Sorry, been mucho busy with actual work work today. I guess since they pay my bills, I should pay them a little attention once in a while. [Wink]

Can you show me all of your code?


LonkeroAdministrator
(KiX Master Guru)
2002-11-22 08:51 PM
Re: help with creating shortcuts with shellLinkObject

sure, if you think there is much to it [Wink]
I see it as irrelevant but here is my whole script file:
code:
$shell=createobject("shell.application")
$LinkDest=$shell.namespace("C:\Documents and Settings\Lurenko\desktop\tester.kix").self

for each $verb in $LinkDest.verbs
?
if instr(join(split($verb,"&"),""),readvalue("HKEY_CLASSES_ROOT\lnkfile",""))
"here is the correct verb:>" $verb "<"
$LinkDest.invokeverb($verb)
else
"not correct:>" $verb "<"
endif
next

get $



[ 22. November 2002, 21:04: Message edited by: Lonkero ]


Chris S.
(MM club member)
2002-11-22 09:23 PM
Re: help with creating shortcuts with shellLinkObject

Got it! The $verb is a vartype=9, so the invokeverb command doesn't know what to do with an object. Therefore, try...

code:
$objShell = CreateObject("Shell.Application")
$objFolderItem = $objShell.NameSpace("C:\Documents and Settings\ShiltCK\Desktop\carbgramcounter.pdf").Self
$Verbs = $objFolderItem.Verbs
For Each $Verb in $Verbs
if instr($verb,readvalue("HKEY_CLASSES_ROOT\lnkfile",""))
$objFolderItem.invokeverb($verb.name)
endif
Next

get $x



LonkeroAdministrator
(KiX Master Guru)
2002-11-22 10:24 PM
Re: help with creating shortcuts with shellLinkObject

will try.
just wonder, as kix didn't error out, the default data in verb is the name, why didn't that pass also to the invokeverb...

testing.
yep, changing line:
$LinkDest.invokeverb($verb)
to:
$LinkDest.invokeverb(""+$verb)

does the job as well.
stupid me didn't test it, just greafed...

thanks.


LonkeroAdministrator
(KiX Master Guru)
2002-11-22 11:22 PM
Re: help with creating shortcuts with shellLinkObject

btw, you don't need to move the link anywhere.
the only reason I could not make links before was that I did not have base for it.

now as I have it, once created and getlinked, it can be deleted as links can be saved where ever wanted.


NTDOCAdministrator
(KiX Master)
2002-11-22 11:45 PM
Re: help with creating shortcuts with shellLinkObject

Chris... what does your/Lonks code actually do?

Delete, association, renew, create, ????

What is different about it then other UDF stuff?


LonkeroAdministrator
(KiX Master Guru)
2002-11-22 11:47 PM
Re: help with creating shortcuts with shellLinkObject

the difference is that is uses shell32.dll directly http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/objects/shelllinkobject/shelllinkobject.asp

this way, there is no dependency of wsh nor shortcut.exe nor the bugs of softlink()

once I get this done, I think I'll replace the softlink with this.


NTDOCAdministrator
(KiX Master)
2002-11-22 11:51 PM
Re: help with creating shortcuts with shellLinkObject

Hmmmm.. Sounds good, but does this mean Windows 95 and 98 are excluded?

From MSDN

Minimum operating systems Windows 2000, Windows Millennium Edition


LonkeroAdministrator
(KiX Master Guru)
2002-11-22 11:55 PM
Re: help with creating shortcuts with shellLinkObject

minimum req shell32.dll version 5.00
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_programming/objectmap.asp

eh, how it was, 4.71 was avail for nt and win9x with IE4...
yep, seems so, not avail in old systems [Frown]


LonkeroAdministrator
(KiX Master Guru)
2002-11-23 12:06 AM
Re: help with creating shortcuts with shellLinkObject

2nd post today.
here is the current code with which I could catch the correct shortcut even though there were 20 named the same and pointing to same location.
does not matter even which type link it is...

{edit}
forgot to post the code [Eek!]

here:
code:
link("C:\Documents and Settings\Lurenko\Työpöytä\KiXforms\bbchecker\wkix32.exe")
function Link($LinkDest)
$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
endif
endif
next
if not vartype($Shortcut) exit 4 endif
? $Shortcut.path
endfunction



[ 23. November 2002, 00:11: Message edited by: Lonkero ]


DonKing
(Fresh Scripter)
2002-11-27 02:04 PM
Re: help with creating shortcuts with shellLinkObject

Is it also possible to create a 'folder shortcut' through KIX instead of a 'normal' shortcut?

Folder shortcuts can be created through My Networkplaces | Add networkplace. This creates a shortcut that differs greatly from a normal shortcut. You can't set security properties for example. In a command prompt the link is represented as a . Copying the link doesn't work also.

Any brilliant suggestions?

LonkeroAdministrator
(KiX Master Guru)
2002-11-27 02:42 PM
Re: help with creating shortcuts with shellLinkObject

donking, this link I've been playing is folder/network/file shortcut.

shell32.dll takes care of the adjusting.
I didn't check how the URL shortcuts are done as they can be done with normal kix-func.


Kdyer
(KiX Supporter)
2002-11-27 02:46 PM
Re: help with creating shortcuts with shellLinkObject

DonKing,

Is this what your are looking for?

Creating a Shortcut to the System Folders

HTH,

Kent

[ 27. November 2002, 14:46: Message edited by: kdyer ]


LonkeroAdministrator
(KiX Master Guru)
2002-11-27 02:49 PM
Re: help with creating shortcuts with shellLinkObject

could you also try with our wshshortcut() ... http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=12;t=000034

DonKing
(Fresh Scripter)
2002-11-27 03:03 PM
Re: help with creating shortcuts with shellLinkObject

Kent,

You're getting warm, but it's not quite what I mean. I want to create a folder shortcut that points to a network share. Not to a systemfolder.

The WshShortCut function creates a normal shortcut (.lnk). A folder shortcut has no extension or workpath, icon properties.

But thanks for your quick reply.

Don


LonkeroAdministrator
(KiX Master Guru)
2002-11-27 03:18 PM
Re: help with creating shortcuts with shellLinkObject

donky, I checked my words and with that above code only minor changes are required.
Like I said, network link is just the same as lnk.
it just does not have that ending.

I tried with:
code:
link("C:\Lonkero\KiXforms\mine")
function Link($LinkDest)
$Shell=createobject("Shell.application")
$LinkDest=$Shell.namespace($LinkDest).self

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

didn't try much more.
removed also the checks I had and modification code.
while did it was in kixforms folder

[ 27. November 2002, 15:19: Message edited by: Lonkero ]


DonKing
(Fresh Scripter)
2002-11-27 03:41 PM
Re: help with creating shortcuts with shellLinkObject

Lonkero,

It would be great if it works, but I ran the code and it seems to loop.

Don't kick me to the starters section, but can you give me a little more comment on the workings of this piece of code? It doesn't look like plain vanilla kix, more like vbscript.

Don


Sealeopard
(KiX Master)
2002-11-27 03:45 PM
Re: help with creating shortcuts with shellLinkObject

It actually is plain vanilla KiXtart, however, it utilizes COM functionality and COM objects.

DonKing
(Fresh Scripter)
2002-11-27 03:50 PM
Re: help with creating shortcuts with shellLinkObject

Indeed, I guess I'm still using an old version of KIX.

However I user KIXgui also, and the syntax looks the same.


LonkeroAdministrator
(KiX Master Guru)
2002-11-27 03:51 PM
Re: help with creating shortcuts with shellLinkObject

all you need to utilize is to change the folder.

DonKing
(Fresh Scripter)
2002-11-27 04:02 PM
Re: help with creating shortcuts with shellLinkObject

Where can I supply the name of the shortcut then?
Can I also supply the destination of the link somewhere?

I changed the destination of the link, but all I get is the prompt. Nothing seems ta have happened.

Thanks,
Don


LonkeroAdministrator
(KiX Master Guru)
2002-11-27 04:19 PM
Re: help with creating shortcuts with shellLinkObject

the lindest is the destination of the link.
the link gets created in the folder you run the script.

anyway, first I have to ask from you, do you have w2k or xp?
it does not work without shell32.dll version 5.00


DonKing
(Fresh Scripter)
2002-11-27 04:26 PM
Re: help with creating shortcuts with shellLinkObject

Yes, I'm running W2K SP3.

What I meant to ask was if it is possible to place the shortcut in another path then where the script is executed? Moving a folder shortcut is difficult as far is I can see.

What name should the shortcut have?

Don


LonkeroAdministrator
(KiX Master Guru)
2002-11-27 04:28 PM
Re: help with creating shortcuts with shellLinkObject

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.


DonKing
(Fresh Scripter)
2002-11-27 04:40 PM
Re: help with creating shortcuts with shellLinkObject

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.


LonkeroAdministrator
(KiX Master Guru)
2002-11-27 04:45 PM
Re: help with creating shortcuts with shellLinkObject

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?


DonKing
(Fresh Scripter)
2002-11-27 04:59 PM
Re: help with creating shortcuts with shellLinkObject

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


LonkeroAdministrator
(KiX Master Guru)
2002-11-27 05:57 PM
Re: help with creating shortcuts with shellLinkObject

sorry, don't think it will hide anything.

LonkeroAdministrator
(KiX Master Guru)
2002-11-28 02:03 AM
Re: help with creating shortcuts with shellLinkObject

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...


LonkeroAdministrator
(KiX Master Guru)
2002-11-28 02:12 AM
Re: help with creating shortcuts with shellLinkObject

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.


Les
(KiX Master)
2002-11-28 02:19 AM
Re: help with creating shortcuts with shellLinkObject

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.


LonkeroAdministrator
(KiX Master Guru)
2002-11-28 02:23 AM
Re: help with creating shortcuts with shellLinkObject

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]


Les
(KiX Master)
2002-11-28 02:28 AM
Re: help with creating shortcuts with shellLinkObject

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


LonkeroAdministrator
(KiX Master Guru)
2002-11-28 02:55 AM
Re: help with creating shortcuts with shellLinkObject

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.


Les
(KiX Master)
2002-11-28 02:57 AM
Re: help with creating shortcuts with shellLinkObject

The first thread was misleading, hence the second.

What do you want for a sign... a burning bush?


LonkeroAdministrator
(KiX Master Guru)
2002-11-28 02:58 AM
Re: help with creating shortcuts with shellLinkObject

that should do.

Les
(KiX Master)
2002-11-28 03:00 AM
Re: help with creating shortcuts with shellLinkObject

Maybe after you drink a bottle of vodka. [Big Grin]

LonkeroAdministrator
(KiX Master Guru)
2002-11-28 03:01 AM
Re: help with creating shortcuts with shellLinkObject

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]


Les
(KiX Master)
2002-11-28 03:03 AM
Re: help with creating shortcuts with shellLinkObject

Then I can't deliver on that burning bush. [Frown]

LonkeroAdministrator
(KiX Master Guru)
2002-11-28 03:16 AM
Re: help with creating shortcuts with shellLinkObject

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]


DonKing
(Fresh Scripter)
2002-11-28 09:18 AM
Re: help with creating shortcuts with shellLinkObject

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


DonKing
(Fresh Scripter)
2002-11-28 09:54 AM
Re: help with creating shortcuts with shellLinkObject

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")


LonkeroAdministrator
(KiX Master Guru)
2002-11-28 10:20 AM
Re: help with creating shortcuts with shellLinkObject

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.


LonkeroAdministrator
(KiX Master Guru)
2002-11-28 10:26 AM
Re: help with creating shortcuts with shellLinkObject

I read your explanation and I need to ask something:
could it be possible for you to have the shortcuts created before hand?
the hardest part is the creation, moving and changing of the property is easy.


DonKing
(Fresh Scripter)
2002-11-28 10:47 AM
Re: help with creating shortcuts with shellLinkObject

Yes, the shortcuts can be created before hand. Whichever solution is easiest. Copying didn't work for me neither yet. What you said about the link being a folder with a target.lnk and desktop.ini file I discovered also when copying the shortcut through a commandprompt.

Can you tell me how to copy the shortcuts then?


LonkeroAdministrator
(KiX Master Guru)
2002-11-28 10:53 AM
Re: help with creating shortcuts with shellLinkObject

I'll go for cigarette and get back in five

LonkeroAdministrator
(KiX Master Guru)
2002-11-28 11:10 AM
Re: help with creating shortcuts with shellLinkObject

need an update again.
do we talk about folder shortcuts or network shortcuts?

if you click somewhere to create a shortcut and make it point to a share, it's a normal folder shortcut, which can be created with that code of mine with little mod.

but if you are asking for network shortcut without ability to click to above folder...
then it's totally different story.


DonKing
(Fresh Scripter)
2002-11-28 11:19 AM
Re: help with creating shortcuts with shellLinkObject

It's a shortcut that points to a network share, but not that kind you can create by right clicking on your desktop and choose new | shortcut.

Create one through Add network place and compare the shortcuts. A folder shortcut has NO properties like a normal shortcut has. It doesn't have a white arrow in the bottom left corner and it shows no size in the explorer window.


LonkeroAdministrator
(KiX Master Guru)
2002-11-28 11:34 AM
Re: help with creating shortcuts with shellLinkObject

nope, folder shortcut is all shortcuts pointing to folder.
actually folderitem.

the "folder shortcut" you specified, the one avail in nethood is not clean, or can you create it elsewhere?


DonKing
(Fresh Scripter)
2002-11-28 11:41 AM
Re: help with creating shortcuts with shellLinkObject

What do you mean exactly by not clean?

DonKing
(Fresh Scripter)
2002-11-29 12:46 AM
Re: help with creating shortcuts with shellLinkObject

YES!

Copying works when I use XCOPY and a whole string of parameters:

Xcopy /H /K /E /I /O /X

I'll try to work this out first.


LonkeroAdministrator
(KiX Master Guru)
2002-11-29 12:55 AM
Re: help with creating shortcuts with shellLinkObject

what I mean is that shorcut is shortcut.
the "shortcut" you see in nethood is not a shortcut but mini filesystem.

folder shortcut is created just the same and looks the same as file shortcuts.


DonKing
(Fresh Scripter)
2002-11-28 01:06 PM
Re: help with creating shortcuts with shellLinkObject

A folder shortcut consists of:
1) A folder
2) A desktop.ini
3) A target.lnk
Indeed a mini filesystem.

You need to copy all three items including their original file attributes. Hence all the switches with xcopy.


LonkeroAdministrator
(KiX Master Guru)
2002-11-28 02:20 PM
Re: help with creating shortcuts with shellLinkObject

that should not be enough.
adding one new link in nethood should add also a namespace in:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\NetworkNeighborhood


DonKing
(Fresh Scripter)
2002-11-28 04:44 PM
Re: help with creating shortcuts with shellLinkObject

It is!

I don't want the shortcuts in My network Places, I want them in the folder of their department share.

I've got a working situation now where the shortcuts are copied based on users group membership. And it's working great!


DonKing
(Fresh Scripter)
2002-11-28 05:15 PM
Re: help with creating shortcuts with shellLinkObject

Well... it works great in explorer and my computer. When you click back in Word of Excel you still end up browsing the network.

Thank you MS for being so consistent...NOT.

I'll go ly down now in the fetal position and cry for a few hours.


LonkeroAdministrator
(KiX Master Guru)
2002-11-28 05:26 PM
Re: help with creating shortcuts with shellLinkObject

king, didn't I say?

anyway, I've heard the words that it can't be done. don't think so. it's just little harder than one would imagine.


Les
(KiX Master)
2002-11-28 05:47 PM
Re: help with creating shortcuts with shellLinkObject

What about dynamically populating 'My Network Places' instead of a share.

LonkeroAdministrator
(KiX Master Guru)
2002-11-28 05:52 PM
Re: help with creating shortcuts with shellLinkObject

may I ask what you mean with that dynamical population?

Les
(KiX Master)
2002-11-28 08:04 PM
Re: help with creating shortcuts with shellLinkObject

What I mean is to have a script add or remove links when they logon.

LonkeroAdministrator
(KiX Master Guru)
2002-11-29 07:24 AM
Re: help with creating shortcuts with shellLinkObject

yes, but how it differs from the stuff we have been trying to do?

DonKing
(Fresh Scripter)
2002-11-29 08:28 AM
Re: help with creating shortcuts with shellLinkObject

Last night I read this comment of a guy named Registrylord about desktop.ini files:

; -- Desktop.ini + Drivers --
;
; Folder Pointers works like a windows 2000 or xp junction.
; it is a browsable shortcut.
; it has been crippled to only work in the start menu.
; with some hacking it could be force to work else ware.
; Desktop.ini
; [.ShellClassInfo]
; CLSID={FA6C62A0-9FE5-11D2-9E61-444553540000}
; Folder.lnk
; Shortcut to the real folder.
; http:/www.zdnet.com

I've mailed him explaining the problem to ask if this hack could work for my problem. Unfortunately no reply yet.

About dynamically populating My Network Places. We could do that, but the problem stays the same when using Word or Excel to browse.


LonkeroAdministrator
(KiX Master Guru)
2002-11-29 10:20 AM
Re: help with creating shortcuts with shellLinkObject

your desktop.ini looks ok but the clsid is weird...
I've seen it with "clsid2=" only...


DonKing
(Fresh Scripter)
2002-11-29 11:23 AM
Re: help with creating shortcuts with shellLinkObject

Indeed, this one doesn't work because the CLSID in unknown on a W2K system.

LonkeroAdministrator
(KiX Master Guru)
2002-11-30 12:04 AM
Re: help with creating shortcuts with shellLinkObject

check that network neighborhood folder there are for every link one desktop.ini

DonKing
(Fresh Scripter)
2002-11-30 12:52 AM
Re: help with creating shortcuts with shellLinkObject

Yes, but they're all the same.

DonKing
(Fresh Scripter)
2002-12-02 08:24 AM
Re: help with creating shortcuts with shellLinkObject

Lonkero,

Thanks alot for your time and effort. I've given up and placed a supprotcall with HP. We have a support contract with them, and they have connections with MS. Let them sort it out.

If something usefull turns out after all, I'll let you know.