Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Error setting shortcut icon

Reply
 
Old 03-11-2009   #1 (permalink)
John


 
 

Error setting shortcut icon

Hi

I am using below code to create an icon on desktop;

dstFolder = "C:\My App " & Mid(FormatDateTime(date,0),7,4) & "." &
Mid(FormatDateTime(date,0),4,2) & "." & Mid(FormatDateTime(date,0),1,2)
dstFolderFile = dstFolder & "\My App.exe"

Set objShell = CreateObject("WScript.Shell")
strFolder = objShell.SpecialFolders("AllUsersDesktop")
Set link = objShell.CreateShortcut(strFolder & "\My App.lnk")

link.Description = "My App"
link.TargetPath = dstFolderFile
link.WorkingDirectory = dstFolder
link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13
link.Save

Problem is I am getting the belwo error on line 'link.SetIconLocation
"C:\Windows\System32\SHELL32.dll", 13';

Error: Object doesn't support this property or method:
'link.SetIconLocation'

What is the problem and how can I fix it?

Thanks

Regards



My System SpecsSystem Spec
Old 03-12-2009   #2 (permalink)
Charles E Finkenbiner


 
 

Re: Error setting shortcut icon

Hi John,

I see 2 errors in your line of code. You posted this line as your problem:

'link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13'

The 2 errors I see are that you left out the = sign and you have your
closing double-quote in the wrong place. The correct code should be:

link.SetIconLocation = "C:\Windows\System32\SHELL32.dll, 13"


Hope this helps,

CEF

John wrote:
Quote:

> Hi
>
> I am using below code to create an icon on desktop;
>
> dstFolder = "C:\My App " & Mid(FormatDateTime(date,0),7,4) & "." &
> Mid(FormatDateTime(date,0),4,2) & "." & Mid(FormatDateTime(date,0),1,2)
> dstFolderFile = dstFolder & "\My App.exe"
>
> Set objShell = CreateObject("WScript.Shell")
> strFolder = objShell.SpecialFolders("AllUsersDesktop")
> Set link = objShell.CreateShortcut(strFolder & "\My App.lnk")
>
> link.Description = "My App"
> link.TargetPath = dstFolderFile
> link.WorkingDirectory = dstFolder
> link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13
> link.Save
>
> Problem is I am getting the belwo error on line 'link.SetIconLocation
> "C:\Windows\System32\SHELL32.dll", 13';
>
> Error: Object doesn't support this property or method:
> 'link.SetIconLocation'
>
> What is the problem and how can I fix it?
>
> Thanks
>
> Regards
My System SpecsSystem Spec
Old 03-12-2009   #3 (permalink)
John


 
 

Re: Error setting shortcut icon

Hi

Thanks. I have tried

link.SetIconLocation = "C:\Windows\System32\SHELL32.dll, 13"

but still same error "Object doesn't support this property or method:
'link.SetIconLocation'". If I rem out this line then shortcut is created
fine on the desktop.

Thanks

Regards

"Charles E Finkenbiner" <CharlesEF_@_CEF-Inc.Com> wrote in message
news:usy2cTtoJHA.3332@xxxxxx
Quote:

> Hi John,
>
> I see 2 errors in your line of code. You posted this line as your
> problem:
>
> 'link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13'
>
> The 2 errors I see are that you left out the = sign and you have your
> closing double-quote in the wrong place. The correct code should be:
>
> link.SetIconLocation = "C:\Windows\System32\SHELL32.dll, 13"
>
>
> Hope this helps,
>
> CEF
>
> John wrote:
Quote:

>> Hi
>>
>> I am using below code to create an icon on desktop;
>>
>> dstFolder = "C:\My App " & Mid(FormatDateTime(date,0),7,4) & "." &
>> Mid(FormatDateTime(date,0),4,2) & "." & Mid(FormatDateTime(date,0),1,2)
>> dstFolderFile = dstFolder & "\My App.exe"
>>
>> Set objShell = CreateObject("WScript.Shell")
>> strFolder = objShell.SpecialFolders("AllUsersDesktop")
>> Set link = objShell.CreateShortcut(strFolder & "\My App.lnk")
>>
>> link.Description = "My App"
>> link.TargetPath = dstFolderFile
>> link.WorkingDirectory = dstFolder
>> link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13
>> link.Save
>>
>> Problem is I am getting the belwo error on line 'link.SetIconLocation
>> "C:\Windows\System32\SHELL32.dll", 13';
>>
>> Error: Object doesn't support this property or method:
>> 'link.SetIconLocation'
>>
>> What is the problem and how can I fix it?
>>
>> Thanks
>>
>> Regards

My System SpecsSystem Spec
Old 03-12-2009   #4 (permalink)
T Lavedas


 
 

Re: Error setting shortcut icon

On Mar 12, 8:52*am, "John" <i...@xxxxxx> wrote:
Quote:

> Hi
>
> Thanks. I have tried
>
> link.SetIconLocation = "C:\Windows\System32\SHELL32.dll, 13"
>
> but still same error "Object doesn't support this property or method:
> 'link.SetIconLocation'". If I rem out this line then shortcut is created
> fine on the desktop.
>
> Thanks
>
> Regards
>
> "Charles E Finkenbiner" <CharlesEF_@_CEF-Inc.Com> wrote in messagenews:usy2cTtoJHA.3332@xxxxxx
>
Quote:

> > Hi John,
>
Quote:

> > I see 2 errors in your line of code. *You posted this line as your
> > problem:
>
Quote:

> > 'link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13'
>
Quote:

> > The 2 errors I see are that you left out the = sign and you have your
> > closing double-quote in the wrong place. The correct code should be:
>
Quote:

> > link.SetIconLocation = "C:\Windows\System32\SHELL32.dll, 13"
>
Quote:

> > Hope this helps,
>
Quote:

> > CEF
>
Quote:

> > John wrote:
Quote:

> >> Hi
>
Quote:
Quote:

> >> I am using below code to create an icon on desktop;
>
Quote:
Quote:

> >> * dstFolder = "C:\My App " & Mid(FormatDateTime(date,0),7,4) & "."&
> >> Mid(FormatDateTime(date,0),4,2) & "." & Mid(FormatDateTime(date,0),1,2)
> >> * dstFolderFile = dstFolder & "\My App.exe"
>
Quote:
Quote:

> >> * Set objShell = CreateObject("WScript.Shell")
> >> * strFolder = objShell.SpecialFolders("AllUsersDesktop")
> >> * Set link = objShell.CreateShortcut(strFolder & "\My App.lnk")
>
Quote:
Quote:

> >> * link.Description = "My App"
> >> * link.TargetPath = dstFolderFile
> >> * link.WorkingDirectory = dstFolder
> >> * link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13
> >> * link.Save
>
Quote:
Quote:

> >> Problem is I am getting the belwo error on line 'link.SetIconLocation
> >> "C:\Windows\System32\SHELL32.dll", 13';
>
Quote:
Quote:

> >> Error: Object doesn't support this property or method:
> >> 'link.SetIconLocation'
>
Quote:
Quote:

> >> What is the problem and how can I fix it?
>
Quote:
Quote:

> >> Thanks
>
Quote:
Quote:

> >> Regards
The correct syntax is ...

link.IconLocation = "C:\Windows\System32\SHELL32.dll, 13"

See WSH 5.6 documentation download (URL all one line)
http://www.microsoft.com/downloads/d...displaylang=en

Tom Lavedas
***********
http://there.is.no.more/tglbatch/
My System SpecsSystem Spec
Old 03-12-2009   #5 (permalink)
Charles E Finkenbiner


 
 

Re: Error setting shortcut icon

Hi John,

Tom's post below is correct. I missed the 3rd error in your code. Tom
caught it.


Hope this helps,

CEF

John wrote:
Quote:

> Hi
>
> Thanks. I have tried
>
> link.SetIconLocation = "C:\Windows\System32\SHELL32.dll, 13"
>
> but still same error "Object doesn't support this property or method:
> 'link.SetIconLocation'". If I rem out this line then shortcut is created
> fine on the desktop.
>
> Thanks
>
> Regards
>
> "Charles E Finkenbiner" <CharlesEF_@_CEF-Inc.Com> wrote in message
> news:usy2cTtoJHA.3332@xxxxxx
Quote:

>> Hi John,
>>
>> I see 2 errors in your line of code. You posted this line as your
>> problem:
>>
>> 'link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13'
>>
>> The 2 errors I see are that you left out the = sign and you have your
>> closing double-quote in the wrong place. The correct code should be:
>>
>> link.SetIconLocation = "C:\Windows\System32\SHELL32.dll, 13"
>>
>>
>> Hope this helps,
>>
>> CEF
>>
>> John wrote:
Quote:

>>> Hi
>>>
>>> I am using below code to create an icon on desktop;
>>>
>>> dstFolder = "C:\My App " & Mid(FormatDateTime(date,0),7,4) & "." &
>>> Mid(FormatDateTime(date,0),4,2) & "." & Mid(FormatDateTime(date,0),1,2)
>>> dstFolderFile = dstFolder & "\My App.exe"
>>>
>>> Set objShell = CreateObject("WScript.Shell")
>>> strFolder = objShell.SpecialFolders("AllUsersDesktop")
>>> Set link = objShell.CreateShortcut(strFolder & "\My App.lnk")
>>>
>>> link.Description = "My App"
>>> link.TargetPath = dstFolderFile
>>> link.WorkingDirectory = dstFolder
>>> link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13
>>> link.Save
>>>
>>> Problem is I am getting the belwo error on line 'link.SetIconLocation
>>> "C:\Windows\System32\SHELL32.dll", 13';
>>>
>>> Error: Object doesn't support this property or method:
>>> 'link.SetIconLocation'
>>>
>>> What is the problem and how can I fix it?
>>>
>>> Thanks
>>>
>>> Regards
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
security icon over program icon/shortcut Vista security
Shortcut Icon Vista General
Shortcut Icon General Discussion
File Icon Removal (Not a Shortcut Icon) Vista General
Shortcut icon error Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46