1bobby Posted November 13, 2007 Share Posted November 13, 2007 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 More sharing options...
Moderators SmOke_N Posted November 13, 2007 Moderators Share Posted November 13, 2007 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 More sharing options...
Nahuel Posted November 13, 2007 Share Posted November 13, 2007 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 More sharing options...
1bobby Posted November 13, 2007 Author Share Posted November 13, 2007 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 More sharing options...
1bobby Posted November 13, 2007 Author Share Posted November 13, 2007 I tried the code you gave me and it still does the same thing.? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now