Page 1 of 5 12345>
Topic Options
#89605 - 2002-11-19 11:20 PM help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

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

download KiXnet

Top
#89606 - 2002-11-20 12:40 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

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

download KiXnet

Top
#89607 - 2002-11-20 01:14 AM Re: help with creating shortcuts with shellLinkObject
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Thought this one was kinda neat:

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

Top
#89608 - 2002-11-20 01:17 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

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

download KiXnet

Top
#89609 - 2002-11-20 01:21 AM Re: help with creating shortcuts with shellLinkObject
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
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 ...
Top
#89610 - 2002-11-20 01:25 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
turned what to udf?
all these things I saw in udf's were made with scripting host.
_________________________
!

download KiXnet

Top
#89611 - 2002-11-22 01:34 AM Re: help with creating shortcuts with shellLinkObject
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
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")


Top
#89612 - 2002-11-22 01:37 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

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

download KiXnet

Top
#89613 - 2002-11-22 01:53 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
got over that now [Wink]
some problems still to gather...
_________________________
!

download KiXnet

Top
#89614 - 2002-11-22 02:04 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

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

download KiXnet

Top
#89615 - 2002-11-22 02:13 AM Re: help with creating shortcuts with shellLinkObject
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
I was thinking that you could parse through the folder and find all .lnk's then look at the create date.
Top
#89616 - 2002-11-22 02:25 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

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

_________________________
!

download KiXnet

Top
#89617 - 2002-11-22 02:29 AM Re: help with creating shortcuts with shellLinkObject
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
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


Top
#89618 - 2002-11-22 02:30 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

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

download KiXnet

Top
#89619 - 2002-11-22 02:37 AM Re: help with creating shortcuts with shellLinkObject
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
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]
Top
#89620 - 2002-11-22 02:50 AM Re: help with creating shortcuts with shellLinkObject
Lonkero Administrator Offline
KiX Master Guru
*****

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

download KiXnet

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

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

_________________________
!

download KiXnet

Top
#89622 - 2002-11-22 08:42 PM Re: help with creating shortcuts with shellLinkObject
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
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?

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

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

download KiXnet

Top
#89624 - 2002-11-22 09:23 PM Re: help with creating shortcuts with shellLinkObject
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
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


Top
Page 1 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 566 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.073 seconds in which 0.025 seconds were spent on a total of 14 queries. Zlib compression enabled.

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