Sign in to follow this  
Followers 0
HockeyFan

Argh! Newbie Needs Help!

8 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  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

Share this post


Link to post
Share on other sites

Try:

If FileExists(@DesktopDir & "\ADA Dial-Up.lnk") Then

Thanks...I realized big_daddys typo and used lnk instead of ink.

Share this post


Link to post
Share on other sites

Thanks...I realized big_daddys typo and used lnk instead of ink.

Whoops...sorry about that!

Share this post


Link to post
Share on other sites

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!

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