Home > Archive > Tcl > December 2006 > Re: How to retrieve the target of a Windows shortcut?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: How to retrieve the target of a Windows shortcut?
|
|
| suchenwi 2006-12-13, 4:25 pm |
|
Francois Vogel schrieb:
>
> I'll have a look, thanks a lot, despite I would have loved to be able to
> do that just in plain Tcl.
http://wiki.tcl.tk/1844 has this plain-Tcl solution - see whether it
works for you:
proc readlnk {lnk} {
set res ""
set fp [open $lnk]
foreach snip [split [read $fp] \x00] {
if {[regexp {[A-Z]:\\} $snip] && [file exists $snip]} {
lappend res $snip
}
}
close $fp
join $res
}
| |
| Francois Vogel 2006-12-25, 7:11 pm |
| Emmanuel Frecon a écrit :
> I am coming back from vacation, so this is perhaps reaching you too
> late.
No that's not too late, thank you.
After much browsing and carefully reading the solutions proposed here
and in the wiki, I reached the conclusion that there is no reliable way
to extract the target of a shortcut in pure Tcl.
Since I'm very willing to avoid using external packages such as tcom or
twapi, the only remaining solution is to parse the shortcut file properly.
For that purpose the best (IMHO) information I found is:
http://www.i2s-lab.com/Papers/The_W...File_Format.pdf
I've added this link to the wiki page, and it already has code for
parsing the format partially. It is however quite complex.
For the time being, I've just given up. Maybe later...
Thanks again,
Francois
|
|
|
|
|