Sign in to follow this  
Followers 0
1bobby

Detect Icon on Desktop

5 posts in this topic

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!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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....

Share this post


Link to post
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....

Share this post


Link to post
Share on other sites

I tried the code you gave me and it still does the same thing.?

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  
Followers 0