List Info

Thread: Launching Windows' shortcut editor




Launching Windows' shortcut editor
user name
2006-01-25 17:24:57
[James Carroll]

| Hi, I would like to invoke the same shortcut editor that
you get when
| you right cilck on a shortcut (link) and choose
Properties.  It lets
| you edit the Target and Start In directories, etc.
| 
| I've tried:
|             win32api.ShellExecute (0,
"Properties", filename, 
| None, ".", 0 )
|             win32api.ShellExecute (0, "Edit",
filename, None, ".", 0 )
| Where filename is the .lnk file But I get a permissions
error with the
| "Edit" and no response from
"Properties"

No great expertise here, but from this:

http://vbnet.mvps.org/index.html?code/shell/property
page.htm

I guessed into Python like this:

<code>
from win32com.shell import shell, shellcon

#
# Be warned, shell fns do *not* accept
#  forward-slash filepaths
#
filename = r"c:temptest.lnk"

#
# Done this way to avoid line-wrap probs in email
#
flags = shellcon.SEE_MASK_NOCLOSEPROCESS 
flags |= shellcon.SEE_MASK_INVOKEIDLIST 
flags |= shellcon.SEE_MASK_FLAG_NO_UI

pidl, ignore = shell.SHILCreateFromPath (filename, 0)
shell.ShellExecuteEx (flags, 0, "Properties",
"", "", "", 0, pidl,
"",
0, 0, 0, 0)

</code>

It's pretty crude, and I'm not sure where you'd
go from there, but it does work.

TJG

____________________________________________________________
____________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a
proactive
anti-virus service working around the clock, around the
globe, visit:
http://www.star.net.uk
____________________________________________________________
____________
_______________________________________________
Python-win32 mailing list
Python-win32python.org

http://mail.python.org/mailman/listinfo/python-win32
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )