Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2012-03-12
10
Medium Priority
?
2,137 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Suggested Courses

618 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