Solved

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

Posted on 2012-03-12
10
2,048 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 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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
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 a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

730 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