Solved

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

Posted on 2012-03-12
10
1,981 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
 
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
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.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now