Jump to content
Sign in to follow this  
Diana (Cda)

Change shorcut icon?

Recommended Posts

Hi! This forum has been great for me in last couple of weeks. I've combed the posts for scripts, as usual, and have had best success rates ever in figuring out things on my own. There just this script that I need help with. Here it is:

; AutoIt v3.0

; first part in "" below, re Firefox, is path to the Firefox EXE
; @DesktopDir is path to current user's desktop (whereas @DesktopCommonDir may be less specific.  Need to investigate that.)
; the " & '\FF shortcut.lnk' is name shortcut will have

FileCreateShortcut('"C:\DOCUME~1\user.TC\APPS\FIREFO~1.6(P\FIREFO~1.EXE" ""', @DesktopDir & '\FF shortcut.lnk')

; message box saying "done"
MsgBox(64, 'Shortcut status ...', "Shortcut has been created on the desktop.", 3)

; finished
The problem lies in the resulting shortcut icon's image that relates to the path of the EXE. When I just use this:


the shortcut shows the Firefox icon (in this case).

But if I change the script to put the actual complete path I need, which has the extra double quotes at the end for the target URL, and as seen in the code example above:

FileCreateShortcut('"C:\DOCUME~1\user.TC\APPS\FIREFO~1.6(P\FIREFO~1.EXE" ""',

I get exactly the path I need in the icon and just have to dump in the URL, but the Firefox icon no longer shows up and I get a generic one.

The "" allows me to put in a URL without worrying about having to type them in when I'm going to actually use the shortcut.

Funnily enough, when I manually add in the URL in along with the double quotes, a shortcut created without the double quotes has the correct Firefox image. (?)

Is there a way to get the path I need in the shortcut, i.e.,

FileCreateShortcut('"C:\DOCUME~1\user.TC\APPS\FIREFO~1.6(P\FIREFO~1.EXE" ""',

yet get the Firefox image? Pls advise.

(p.s., the reason I need this is because I'm using portable Firefox as my default browser but naturally, it's not associated to URLs. Since I can't change the assocations, by making the shortcuts up this way, I can have my cake and eat it to, as something like this in shortcut path:

FileCreateShortcut('"C:\DOCUME~1\user.TC\APPS\FIREFO~1.6(P\FIREFO~1.EXE" "www.google.com"'

will launch Firefox and will go to the www.google.com URL. Just an fyi.)

Share this post

Link to post
Share on other sites

FileCreateShortcut(@scriptdir & "\FirefoxPortable.exe",@scriptdir & "\Google.ca",@scriptdir,"""www.google.ca""")

F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]

Share this post

Link to post
Share on other sites


;FileCreateShortcut ( "file", "lnk" [, "workdir" [, "args" [, "desc" [, "icon" [, "hotkey" [, icon number [, state]]]]]]] )
FileCreateShortcut('"C:\DOCUME~1\user.TC\APPS\FIREFO~1.6(P\FIREFO~1.EXE"', @DesktopDir & '\FF shortcut.lnk','','""')
Excellent! Thank you. This first one works just perfectly so didn't even try the second one.

I have my new shortcut _with_ the Firefox icon ready for inputing the URL path because of the waiting empty "" marks! Brilliant. Thanks.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...