Page 2 of 5 <12345>
Topic Options
#89625 - 2002-11-22 10:24 PM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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.
_________________________
!

download KiXnet

Top
#89626 - 2002-11-22 11:22 PM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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.
_________________________
!

download KiXnet

Top
#89627 - 2002-11-22 11:45 PM Re: help with creating shortcuts with shellLinkObject
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Chris... what does your/Lonks code actually do?

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

What is different about it then other UDF stuff?

Top
#89628 - 2002-11-22 11:47 PM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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.
_________________________
!

download KiXnet

Top
#89629 - 2002-11-22 11:51 PM Re: help with creating shortcuts with shellLinkObject
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Hmmmm.. Sounds good, but does this mean Windows 95 and 98 are excluded?

From MSDN

Minimum operating systems Windows 2000, Windows Millennium Edition

Top
#89630 - 2002-11-22 11:55 PM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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]
_________________________
!

download KiXnet

Top
#89631 - 2002-11-23 12:06 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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 ]
_________________________
!

download KiXnet

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

Registered: 2002-11-27
Posts: 22
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?
Top
#89633 - 2002-11-27 02:42 PM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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.
_________________________
!

download KiXnet

Top
#89634 - 2002-11-27 02:46 PM Re: help with creating shortcuts with shellLinkObject
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
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 ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#89635 - 2002-11-27 02:49 PM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
could you also try with our wshshortcut() ... http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=12;t=000034
_________________________
!

download KiXnet

Top
#89636 - 2002-11-27 03:03 PM Re: help with creating shortcuts with shellLinkObject
DonKing Offline
Fresh Scripter

Registered: 2002-11-27
Posts: 22
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

Top
#89637 - 2002-11-27 03:18 PM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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 ]
_________________________
!

download KiXnet

Top
#89638 - 2002-11-27 03:41 PM Re: help with creating shortcuts with shellLinkObject
DonKing Offline
Fresh Scripter

Registered: 2002-11-27
Posts: 22
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

Top
#89639 - 2002-11-27 03:45 PM Re: help with creating shortcuts with shellLinkObject
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
It actually is plain vanilla KiXtart, however, it utilizes COM functionality and COM objects.
_________________________
There are two types of vessels, submarines and targets.

Top
#89640 - 2002-11-27 03:50 PM Re: help with creating shortcuts with shellLinkObject
DonKing Offline
Fresh Scripter

Registered: 2002-11-27
Posts: 22
Indeed, I guess I'm still using an old version of KIX.

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

Top
#89641 - 2002-11-27 03:51 PM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
all you need to utilize is to change the folder.
_________________________
!

download KiXnet

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

Registered: 2002-11-27
Posts: 22
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

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

Registered: 2001-06-05
Posts: 22346
Loc: OK
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
_________________________
!

download KiXnet

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

Registered: 2002-11-27
Posts: 22
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

Top
Page 2 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 382 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.076 seconds in which 0.025 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