Jump to content

Detect Icon on Desktop


1bobby
 Share

Recommended Posts

I have a script to install a shortcut to a program which must go on the user desk top, as his name must be in the path. When I do a "If FileExist, I don't get a hit, I want to create the Icon, if I do get a hit, I want to skip the function altogether.

The code: MsgBox(4096,"test", "file = " & "C:\Documents and Settings\" & GUICtrlread($UserName) & "\Desktop\PMM", 15)

If FileExists("C:\Documents and Settings\" & GUICtrlread($UserName) & "Desktop\pmm.*") Then

Sleep(500)

Return

EndIf

The function runs everytime ends with an error, do you want to replace the icon and there is an PMM Icon on the desk top.

Thanks, nubee!

Link to comment
Share on other sites

  • Moderators

Hard coding it is going to cause you more issues than you are currently having.

Use @DesktopDir instead.

FileExists does not accept wild cards.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

C:\Documents and Settings\" & GUICtrlread($UserName) & "Desktop\pmm.* =

C:\Documents and Settings\UsernameDesktop\pmm.*

If you want to search the current user's Destop for a shortcut, why not do this?

If FileExists(@DesktopDir & "\PMM.lnk") Then....

Link to comment
Share on other sites

C:\Documents and Settings\" & GUICtrlread($UserName) & "Desktop\pmm.* =

C:\Documents and Settings\UsernameDesktop\pmm.*

If you want to search the current user's Destop for a shortcut, why not do this?

If FileExists(@DesktopDir & "\PMM.lnk") Then....

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...