?
Solved

How can I change the icon of a url that I created

Posted on 2012-03-12
10
Medium Priority
?
2,104 Views
Last Modified: 2012-03-23
Good afternoon experts,

The following code snippent should create a desktop shortcut with the icon path that I associated with it:


Set objShell = CreateObject("WScript.Shell")
strDesktopFld = objShell.SpecialFolders("Desktop")
Set objURLShortcut = objShell.CreateShortcut(strDesktopFld & "\NYOI 2012 National Outcomes Unique Web survey.url")
objURLShortcut.TargetPath = "https://confirm.opinionport.com/wix/p8341310.aspx?org=10801&site=13047"
objURLShortcut.IconLocation =  "\\wks-wnxp-01901\YOUTHDB\icos\Nyoi.ico,0"
objURLShortcut.Save



When I run the vbs file I get the following error:

 Microsoft VBScript runtime error: Object doesn't support this property or method: 'objURLShortcut.IconLocation'


I am probably mission something very simple , because I have looked at the syntax of the .iconlocation property and it looks correct to me.  Any thoughts.
0
Comment
Question by:BLACK THANOS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +3
10 Comments
 
LVL 1

Expert Comment

by:microportal
ID: 37711962
I think you have to correct the path
"\\wks-wnxp-01901\YOUTHDB\icos\Nyoi.ico,0"

like this example
"D:\\WINNT\\System32\\winmine.exe,0";
0
 
LVL 8

Expert Comment

by:fundacionrts
ID: 37711986
CreateShortcut of URL type only support:

* FullName Property
* TargetPath Property

Reference: http://msdn.microsoft.com/es-es/library/ie/265a4017%28v=vs.80%29.aspx
0
 
LVL 12

Accepted Solution

by:
rlandquist earned 1000 total points
ID: 37712080
Unfortunately, you cannot change the icon for a URL shortcut as fundacionrts stated above.
HOWEVER, what you could do is make a shortcut to Internet Explorer and specify the url to open.

to do this, just change your TargetPath to:
"C:\Program Files\Internet Explorer\iexplore.exe https://confirm.opinionport.com/wix/p8341310.aspx?org=10801&site=13047"
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 65

Expert Comment

by:RobSampson
ID: 37712591
rlandquist is correct.  If you create an .LNK file, instead of a .URL file, you can change the .Icon property.

Regards,

Rob.
0
 

Author Comment

by:BLACK THANOS
ID: 37712790
Stay tuned,

I am testing things out now everyone. I might have to share the point on this one.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 37712929
>>  I might have to share the point on this one

Not with me....I didn't help, I'm just agreeing ;-)

Rob.
0
 
LVL 38

Assisted Solution

by:BillDL
BillDL earned 1000 total points
ID: 37713942
REGISHYDE

Have you ever inspected a *.URL file in a text editor?

It's just plain text in a format like an *.INI file with standard CR/LF's, and can be created easily by redirecting a series of text strings to the file so that each desired parameter is on a separate line.  You might have to escape some of the characters in the strings so that they are written literally.

IconFile=   (path to ico, exe, dll, or other "library" file containing icons)
IconIndex=  (index number of icon starting from Zero)

Reference:
http://www.cyanwerks.com/file-format-url.html

Some of the lines are only really used for *.URL files created as Internet Explorer "Favorites".
0
 

Author Comment

by:BLACK THANOS
ID: 37717291
Interesting BillDL.  This seems to be what I am looking for. I will see how difficult the process is and get back to this forum. I can escape characters easily enough, I just want to be able to use this solution to embed the path to the icon into it.
0
 

Author Closing Comment

by:BLACK THANOS
ID: 37759846
rlandquist and Billdl  each gave me a solution to my problem, however, rlandquist's solution  was the most efficient and quickest way to set an icon.
0
 
LVL 38

Expert Comment

by:BillDL
ID: 37759986
Thank you REGISHYDE
0

Featured Post

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question