HockeyFan Posted May 5, 2006 Share Posted May 5, 2006 OK, before I go crazy here... Can someone help me with a script that will search a user's Desktop...or the "All User's\Desktop" folder...to see if a shortcut icon exists and if so detete it? This is the test script that I'm using and it always reports back that the shortcut does not exist. IF FileExists(@DesktopDir & "\'ADA Dial-Up'") Then MsgBox(4096, "", "Shortcut exists") Else MsgBox(4096, "", "Shortcut does not exist!") EndIf Exit Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted May 5, 2006 Moderators Share Posted May 5, 2006 (edited) OK, before I go crazy here... Can someone help me with a script that will search a user's Desktop...or the "All User's\Desktop" folder...to see if a shortcut icon exists and if so detete it? This is the test script that I'm using and it always reports back that the shortcut does not exist. IF FileExists(@DesktopDir & "\'ADA Dial-Up'") Then MsgBox(4096, "", "Shortcut exists") Else MsgBox(4096, "", "Shortcut does not exist!") EndIf ExitFirst does the shortcut actually have the single qoutes at the beginning and end? Secondly shortcuts have a file extention of .lnk, so try this: IF FileExists(@DesktopDir & "\'ADA Dial-Up'.lnk") Then MsgBox(4096, "", "Shortcut exists") Else MsgBox(4096, "", "Shortcut does not exist!") EndIf Exit Edit: fixed typo Edited May 5, 2006 by big_daddy Link to comment Share on other sites More sharing options...
HockeyFan Posted May 5, 2006 Author Share Posted May 5, 2006 First does the shortcut actually have the single qoutes at the beginning and end? Secondly shortcuts have a file extention of .ink, so try this: IF FileExists(@DesktopDir & "\'ADA Dial-Up'.ink") Then MsgBox(4096, "", "Shortcut exists") Else MsgBox(4096, "", "Shortcut does not exist!") EndIf Exit Thanks big-daddy...but it still doesn't work. I even tested it by createing a file on my desktop named delete me.txt and it didn't work. I then removed the quotes around Delete Me.txt and it worked. But when I try and enter the dial-up shortcut "ADA Dial-UP" without quotes, it still doesn't find it. I'm really started to get frustrated!! Any more ideas! :"> Link to comment Share on other sites More sharing options...
Developers Jos Posted May 5, 2006 Developers Share Posted May 5, 2006 Thanks big-daddy...but it still doesn't work. I even tested it by createing a file on my desktop named delete me.txt and it didn't work. I then removed the quotes around Delete Me.txt and it worked. But when I try and enter the dial-up shortcut "ADA Dial-UP" without quotes, it still doesn't find it. I'm really started to get frustrated!! Any more ideas! :">Try: If FileExists(@DesktopDir & "\ADA Dial-Up.lnk") Then SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
MHz Posted May 5, 2006 Share Posted May 5, 2006 (edited) Try this UDF _Desktop("ADA Dial-Up.lnk") Func _Desktop($shortcut) ; Delete a Desktop shortcut. If FileExists(@DesktopDir & '\' & $shortcut) Then Return FileDelete(@DesktopDir & '\' & $shortcut) ElseIf FileExists(@DesktopCommonDir & '\' & $shortcut) Then Return FileDelete(@DesktopCommonDir & '\' & $shortcut) EndIf EndFunc covers both desktops Edit: fixid code typo Edited May 5, 2006 by MHz Link to comment Share on other sites More sharing options...
HockeyFan Posted May 5, 2006 Author Share Posted May 5, 2006 Try: If FileExists(@DesktopDir & "\ADA Dial-Up.lnk") Then Thanks...I realized big_daddys typo and used lnk instead of ink. Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted May 5, 2006 Moderators Share Posted May 5, 2006 Thanks...I realized big_daddys typo and used lnk instead of ink.Whoops...sorry about that! Link to comment Share on other sites More sharing options...
HockeyFan Posted May 5, 2006 Author Share Posted May 5, 2006 Try this UDF _Desktop("ADA Dial-Up.lnk") Func _Desktop($shortcut) ; Delete a Desktop shortcut. If FileExists(@DesktopDir & '\' & $shortcut) Then Return FileDelete(@DesktopDir & '\' & $shortcut) ElseIf FileExists(@DesktopCommonDir & '\' & $shortcut) Then Return FileDelete(@DesktopCommonDir & '\' & $shortcut) EndIf EndFunc covers both desktops Edit: fixid code typo THANK YOU!!! That did the trick! Thank you SO much! 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