View Full Version : Deleting Shortcuts on the desktop
NewsArchive
06-28-2012, 10:42 AM
I want to delete the old shortcut/s on the desktop for my older application.
Heres what I tried and did not work
Loop
If %_CSIDL_COMMON_DESKTOPDIRECTORY%\Program Name File exists Then
Delete Files "%_CSIDL_COMMON_DESKTOPDIRECTORY%\Program Name"
Else
Break Loop
End
End
Is there and ext on these?
Jim
NewsArchive
06-28-2012, 10:43 AM
Jim,
>I want to delete the old shortcut/s on the desktop for my older
>application.
>
> Heres what I tried and did not work
>
> Loop
> If %_CSIDL_COMMON_DESKTOPDIRECTORY%\Program Name File exists Then
> Delete Files "%_CSIDL_COMMON_DESKTOPDIRECTORY%\Program Name"
> Else
> Break Loop
> End
> End
>
> Is there and ext on these?
Yes, a Shortcut has a .lnk extension.
BTW, your code results in an endless LOOP if there is a file in your
Shortcut folder. And you do not need a LOOP at all. You can try a wildcard
(e.g.: *.lnk)
Friedrich
NewsArchive
06-30-2012, 12:55 AM
Thanks.
I had some customers with more than one after other installs so I had to use a wild card. I did not
show that. I thought my loop would delete the shortcut and then if it did not find another it would
break the loop with the else condition..
I would really like to be able to read a *.Ink file for its Start In path. I have had some
customers create their own that I would like to delete. They would not work but why confuse the
customer. I have not looked at it with my tools in clarion to read files. Shortcuts will not open in
Textpad.
Jim
NewsArchive
06-30-2012, 12:56 AM
Jimmy,
Absolutely no problem. What you can do is to retrieve the "Target" from a
Shortcut .lnk. See "Get File Info (Shortcut Target)" script function.
You can use the "Handle File Listing..." script function to retrieve the
name of all the .lnk files and then LOOP through the list to get the targets
from the .lnk files.
BTW, only use a wildcard driven delete file method when you remove from a
Desktop sub-folder. Do not use a wildcard to remove all .lnk files because
this will remove all Shortcuts from the Desktop. This might result in a
support nightmare for you. I assume you would like to retrieve the target
to find out if a Shortcut really points to your application.
So just read all .lnk files from the Desktop into a list and then LOOP
through the list to retrieve the target. If the target points to your app
then you can remove it (if the customer agrees to it <g>).
Friedrich
NewsArchive
06-30-2012, 12:56 AM
BTW, if you need help with the code logic, just let me know.
Friedrich
NewsArchive
06-30-2012, 12:56 AM
I'll remember that. Thanks
Jim
NewsArchive
06-30-2012, 12:57 AM
They will not have a choice<bg>.
Better to get rid of the old ones pointing to C: drive install from years ago. Now the programs in
the Program Files like it should be, all data in the all users shared folder and the users run not
as administrator just like you and mickey said many moons ago.
Most of this products use is by people who trash their computer running as administrator. I now have
them required to use as a non admin UAC in the hopes they will not trash their whole computer and
my program. Not sure if that really works but maybe some guru does.
Jim
> If the target points to your app
>then you can remove it (if the customer agrees to it <g>).
>
>Friedrich
>
>
NewsArchive
06-30-2012, 12:57 AM
> They will not have a choice<bg>.
>
> Better to get rid of the old ones pointing to C: drive
> install from years ago. Now the programs in the Program
> Files like it should be, all data in the all users shared
> folder and the users run not as administrator just like
> you and mickey said many moons ago.
<BG> Aha, okay! Yes, then it makes 100% sense :)
Friedrich
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.