Roger,
<div class="moz-text-flowed" style="font-family: -moz-fixed">Mike Driscoll wrote:
Hi,

I've had this niggling issue from time to time. I want to create a
shortcut on the user's desktop to a website that specifically loads
Firefox even if Firefox is not the default browser.

I usually use COM as it allows very specific settings of the shortcut,
such as the Working Directory and the Target Path. However, the
following will not work for some reason:

<code>

import win32com.client
import winshell

shell = win32com.client.Dispatch('WScript.Shell')
userDesktop = winshell.desktop()

shortcut = shell.CreateShortCut(userDesktop + '\\MyShortcut.lnk')
shortcut.Targetpath = r'"C:\Program Files\Mozilla Firefox\firefox.exe"
https:\www.myCompanyWebsite.com\ <http://www.myCompanyWebsite.com%5C>auth\preauth.php'
shortcut.WorkingDirectory = r'C:\Program Files\Mozilla
Firefox'
shortcut.save()

</code>

This creates the following target path (which doesn't work for obvious reasons) in the shortcut's Target Path. The extra "C:\" is getting in there somehow...

"C:\"C:\Program Files\Mozilla Firefox\firefox.exe" https:
\www.myCompanyWebsite.com\ <http://www.myCompanyWebsite.com%5C>auth\preauth.php"

If I leave the website off the TargetPath, it works. If I take the path to Firefox out of the TargetPath, it works too. Is there another method I can use other than
creating the shortcut by hand and using the shutil module?

Thank you for any ideas.

Mike

I think you need to put the URL in shortcut.Arguments rather than
appending it to the executable path.

         Roger


</div>

Someone on c.l.py pointed this out too. I was unaware that that existed. It works great though. Thanks a lot!

Mike
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to