Jump to content

Recommended Posts

Posted

:) 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
  • Moderators
Posted (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
Exit
First 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 by big_daddy
Posted

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! :">

  • Developers
Posted

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.
  :)

Posted (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 by MHz
Posted

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!

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
×
×
  • Create New...