Add to Favourites - Icon 
Author Message
 Add to Favourites - Icon

Please stear me to info on adding favourites programatically and associating
an icon to the link (like deja.com)

TIA

Nic Roche
Net Extra
www.extra.net.au



Mon, 17 Dec 2001 03:00:00 GMT  
 Add to Favourites - Icon
See the WSH docs for the WScript.Shell object...

Use Shell.SpecialFolders("Favorites") to get the path for your IE
favorites...
Use Shell.CreateShortcut with a file name ending in .url to create a
WshURLShortcut object

Here's the example from the docs on the WshURLShortcut object:

Example
The following example creates a URLshortcut to www.microsoft.com:

Set WshShell = WScript.CreateObject("WScript.Shell")
Set oUrlLink = WshShell.CreateShortcut("Microsoft Web Site.URL")
oUrlLink.TargetPath = "http://www.microsoft.com"
oUrlLink.Save

You'd build the file name for the CreateShortcut from the path you get from
Shell.SpecialFolders("Favorites").

--
Michael Harris


| Please stear me to info on adding favourites programatically and
associating
| an icon to the link (like deja.com)
|
| TIA
|
| Nic Roche
| Net Extra
| www.extra.net.au
|
|
|



Mon, 17 Dec 2001 03:00:00 GMT  
 Add to Favourites - Icon
Here is how to create a shortcut with whatever icon you choose.
However, I have not figured out how this works for .url yet.

Maybe someone could post how to create a custom icon for an .url
shortcut.  I found this at one of the WSH sites posted here.

Dim WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")
Dim MyShortcut, MyDesktop, DesktopPath
DesktopPath = WSHShell.SpecialFolders("Desktop")
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\Internet
Explorer.lnk")
MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings("c:\program
files\internet explorer\iexplore.exe")
MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings
("c:\program files\internet explorer")
MyShortcut.WindowStyle = 4
' This changes the shortcut's icon to that of NOtepad
MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("%windir%
\notepad.exe, 0")
MyShortcut.Save



Quote:
> See the WSH docs for the WScript.Shell object...

> Use Shell.SpecialFolders("Favorites") to get the path for your IE
> favorites...
> Use Shell.CreateShortcut with a file name ending in .url to create a
> WshURLShortcut object

> Here's the example from the docs on the WshURLShortcut object:

> Example
> The following example creates a URLshortcut to www.microsoft.com:

> Set WshShell = WScript.CreateObject("WScript.Shell")
> Set oUrlLink = WshShell.CreateShortcut("Microsoft Web Site.URL")
> oUrlLink.TargetPath = "http://www.microsoft.com"
> oUrlLink.Save

> You'd build the file name for the CreateShortcut from the path you
get from
> Shell.SpecialFolders("Favorites").

> --
> Michael Harris



> | Please stear me to info on adding favourites programatically and
> associating
> | an icon to the link (like deja.com)
> |
> | TIA
> |
> | Nic Roche
> | Net Extra
> | www.extra.net.au
> |
> |
> |

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


Mon, 17 Dec 2001 03:00:00 GMT  
 Add to Favourites - Icon
If the file name passed to CreateShortcut has a .lnk extension, the object
returned is a WshShortcut object.  If it has a .url extension, the object
returned is a WshURLShortcut object.  These each have different properties
that you set before you use the Save method.

--
Michael Harris


| Here is how to create a shortcut with whatever icon you choose.
| However, I have not figured out how this works for .url yet.
|
| Maybe someone could post how to create a custom icon for an .url
| shortcut.  I found this at one of the WSH sites posted here.
|
|
| Dim WSHShell
| Set WSHShell = WScript.CreateObject("WScript.Shell")
| Dim MyShortcut, MyDesktop, DesktopPath
| DesktopPath = WSHShell.SpecialFolders("Desktop")
| Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\Internet
| Explorer.lnk")
| MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings("c:\program
| files\internet explorer\iexplore.exe")
| MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings
| ("c:\program files\internet explorer")
| MyShortcut.WindowStyle = 4
| ' This changes the shortcut's icon to that of NOtepad
| MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("%windir%
| \notepad.exe, 0")
| MyShortcut.Save
|
|


| > See the WSH docs for the WScript.Shell object...
| >
| > Use Shell.SpecialFolders("Favorites") to get the path for your IE
| > favorites...
| > Use Shell.CreateShortcut with a file name ending in .url to create a
| > WshURLShortcut object
| >
| > Here's the example from the docs on the WshURLShortcut object:
| >
| > Example
| > The following example creates a URLshortcut to www.microsoft.com:
| >
| > Set WshShell = WScript.CreateObject("WScript.Shell")
| > Set oUrlLink = WshShell.CreateShortcut("Microsoft Web Site.URL")
| > oUrlLink.TargetPath = "http://www.microsoft.com"
| > oUrlLink.Save
| >
| > You'd build the file name for the CreateShortcut from the path you
| get from
| > Shell.SpecialFolders("Favorites").
| >
| > --
| > Michael Harris
| >


| > | Please stear me to info on adding favourites programatically and
| > associating
| > | an icon to the link (like deja.com)
| > |
| > | TIA
| > |
| > | Nic Roche
| > | Net Extra
| > | www.extra.net.au
| > |
| > |
| > |
| >
| >
|
|
| Sent via Deja.com http://www.deja.com/
| Share what you know. Learn what you don't.



Tue, 18 Dec 2001 03:00:00 GMT  
 Add to Favourites - Icon
Is there a similar way for WshURLShortcut object to have a special
IconLocation as there ie for WshShortcut?



Quote:
> If the file name passed to CreateShortcut has a .lnk extension, the
object
> returned is a WshShortcut object.  If it has a .url extension, the
object
> returned is a WshURLShortcut object.  These each have different
properties
> that you set before you use the Save method.

> --
> Michael Harris



> | Here is how to create a shortcut with whatever icon you choose.
> | However, I have not figured out how this works for .url yet.
> |
> | Maybe someone could post how to create a custom icon for an .url
> | shortcut.  I found this at one of the WSH sites posted here.
> |
> |
> | Dim WSHShell
> | Set WSHShell = WScript.CreateObject("WScript.Shell")
> | Dim MyShortcut, MyDesktop, DesktopPath
> | DesktopPath = WSHShell.SpecialFolders("Desktop")
> | Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\Internet
> | Explorer.lnk")
> | MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings
("c:\program
> | files\internet explorer\iexplore.exe")
> | MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings
> | ("c:\program files\internet explorer")
> | MyShortcut.WindowStyle = 4
> | ' This changes the shortcut's icon to that of NOtepad
> | MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("%
windir%
> | \notepad.exe, 0")
> | MyShortcut.Save
> |
> |


> | > See the WSH docs for the WScript.Shell object...
> | >
> | > Use Shell.SpecialFolders("Favorites") to get the path for your IE
> | > favorites...
> | > Use Shell.CreateShortcut with a file name ending in .url to
create a
> | > WshURLShortcut object
> | >
> | > Here's the example from the docs on the WshURLShortcut object:
> | >
> | > Example
> | > The following example creates a URLshortcut to www.microsoft.com:
> | >
> | > Set WshShell = WScript.CreateObject("WScript.Shell")
> | > Set oUrlLink = WshShell.CreateShortcut("Microsoft Web Site.URL")
> | > oUrlLink.TargetPath = "http://www.microsoft.com"
> | > oUrlLink.Save
> | >
> | > You'd build the file name for the CreateShortcut from the path you
> | get from
> | > Shell.SpecialFolders("Favorites").
> | >
> | > --
> | > Michael Harris
> | >


> | > | Please stear me to info on adding favourites programatically and
> | > associating
> | > | an icon to the link (like deja.com)
> | > |
> | > | TIA
> | > |
> | > | Nic Roche
> | > | Net Extra
> | > | www.extra.net.au
> | > |
> | > |
> | > |
> | >
> | >
> |
> |
> | Sent via Deja.com http://www.deja.com/
> | Share what you know. Learn what you don't.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


Tue, 18 Dec 2001 03:00:00 GMT  
 Add to Favourites - Icon
Open it as a text file and append the following 2 lines:

IconIndex=3
IconFile=C:\WINNT\system32\url.dll

of course, with appropriate values.

Here's the actual .url file I did this to:

[DEFAULT]
BASEURL=http://www.experts-exchange.com/
[InternetShortcut]
URL=http://www.experts-exchange.com/
Modified=60F44391BFC4BE016A
IconIndex=3
IconFile=C:\WINNT\system32\url.dll

Since it's in INI file format, if you have the tools to mess with INI files
from script, you could use those instead.

--
Michael Harris


| Is there a similar way for WshURLShortcut object to have a special
| IconLocation as there ie for WshShortcut?
|
|


| > If the file name passed to CreateShortcut has a .lnk extension, the
| object
| > returned is a WshShortcut object.  If it has a .url extension, the
| object
| > returned is a WshURLShortcut object.  These each have different
| properties
| > that you set before you use the Save method.
| >
| > --
| > Michael Harris
| >

| > | Here is how to create a shortcut with whatever icon you choose.
| > | However, I have not figured out how this works for .url yet.
| > |
| > | Maybe someone could post how to create a custom icon for an .url
| > | shortcut.  I found this at one of the WSH sites posted here.
| > |
| > |
| > | Dim WSHShell
| > | Set WSHShell = WScript.CreateObject("WScript.Shell")
| > | Dim MyShortcut, MyDesktop, DesktopPath
| > | DesktopPath = WSHShell.SpecialFolders("Desktop")
| > | Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\Internet
| > | Explorer.lnk")
| > | MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings
| ("c:\program
| > | files\internet explorer\iexplore.exe")
| > | MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings
| > | ("c:\program files\internet explorer")
| > | MyShortcut.WindowStyle = 4
| > | ' This changes the shortcut's icon to that of NOtepad
| > | MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("%
| windir%
| > | \notepad.exe, 0")
| > | MyShortcut.Save
| > |
| > |


| > | > See the WSH docs for the WScript.Shell object...
| > | >
| > | > Use Shell.SpecialFolders("Favorites") to get the path for your IE
| > | > favorites...
| > | > Use Shell.CreateShortcut with a file name ending in .url to
| create a
| > | > WshURLShortcut object
| > | >
| > | > Here's the example from the docs on the WshURLShortcut object:
| > | >
| > | > Example
| > | > The following example creates a URLshortcut to www.microsoft.com:
| > | >
| > | > Set WshShell = WScript.CreateObject("WScript.Shell")
| > | > Set oUrlLink = WshShell.CreateShortcut("Microsoft Web Site.URL")
| > | > oUrlLink.TargetPath = "http://www.microsoft.com"
| > | > oUrlLink.Save
| > | >
| > | > You'd build the file name for the CreateShortcut from the path you
| > | get from
| > | > Shell.SpecialFolders("Favorites").
| > | >
| > | > --
| > | > Michael Harris
| > | >


| > | > | Please stear me to info on adding favourites programatically and
| > | > associating
| > | > | an icon to the link (like deja.com)
| > | > |
| > | > | TIA
| > | > |
| > | > | Nic Roche
| > | > | Net Extra
| > | > | www.extra.net.au
| > | > |
| > | > |
| > | > |
| > | >
| > | >
| > |
| > |
| > | Sent via Deja.com http://www.deja.com/
| > | Share what you know. Learn what you don't.
| >
| >
|
|
| Sent via Deja.com http://www.deja.com/
| Share what you know. Learn what you don't.



Tue, 18 Dec 2001 03:00:00 GMT  
 Add to Favourites - Icon
Thanks for the replies.

My main focus was on associating the icon with the URL shortcut.

When you add deja.com as a favorite it has its own reference to an icon
"favoric.ico".

The only reference I can find on my system is in the
C:\windows\ShellIconCache (hidden).

I am adding URL Shortcuts on the clients machines. I would like to associate
icons to them.

Any leads...

Nic Roche
Net Extra
www.extra.net.au


Quote:
>Please stear me to info on adding favourites programatically and
associating
>an icon to the link (like deja.com)

>TIA

>Nic Roche
>Net Extra
>www.extra.net.au



Sat, 22 Dec 2001 03:00:00 GMT  
 Add to Favourites - Icon
Michael Harris' previous post did address it.

Nic Roche
Net Extra
www.extra.net.au


Quote:
>Thanks for the replies.

>My main focus was on associating the icon with the URL shortcut.

>When you add deja.com as a favorite it has its own reference to an icon
>"favoric.ico".

>The only reference I can find on my system is in the
>C:\windows\ShellIconCache (hidden).

>I am adding URL Shortcuts on the clients machines. I would like to
associate
>icons to them.

>Any leads...

>Nic Roche
>Net Extra
>www.extra.net.au



>>Please stear me to info on adding favourites programatically and
>associating
>>an icon to the link (like deja.com)

>>TIA

>>Nic Roche
>>Net Extra
>>www.extra.net.au



Sat, 22 Dec 2001 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Add to favourites button

2. Checking/setting homepage and adding page to favourites

3. Checking/setting homepage and adding page to favourites

4. Adding A Page To Your Favourites

5. adding your program icon on IE or Netscape

6. Adding icons for bookmarks?

7. Add custom icon to popup

8. Adding an entry to the Add Remove Programs list

9. How do I get my ICON to show up if a user adds my site to their links?

10. How download icon from web site?

11. icon location problem

12. control icon locatation

 

 
Powered by phpBB® Forum Software