Solved

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

Posted on 2012-03-12
10
2,009 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
  • 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 250 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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 250 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
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).
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.

810 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