JSThePatriot Posted August 10, 2005 Share Posted August 10, 2005 I have searched the forums, and have tried many things myself. I know exactly where the shortcut is and its proper name, but I cannot delete it. I cant even do a FileDelete("*.lnk"), I even tried FileDelete("*.*") in a folder that had only short cuts in it. I am trying to customize a programs installation, and that requires the option to delete the shortcuts (on the desktop) since the installer doesnt ask. Please inform me of any possible option. I am on Windows XP Pro, but this should be portable to all the Windows OS's TIA, JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
/dev/null Posted August 10, 2005 Share Posted August 10, 2005 dos command "del" will delete it. --> Run(....) Cheers Kurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 10, 2005 Author Share Posted August 10, 2005 dos command "del" will delete it. --> Run(....)CheersKurt<{POST_SNAPBACK}>Hrm. I guess that would work. I would have to check which operating system they were on.I will see. In the mean time if anyone else comes up with different options please let me know.I dont understand why FileDelete() doesnt work.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
hgeras Posted August 10, 2005 Share Posted August 10, 2005 (edited) I was trying to retrieve info on a shortcut on my desktop through the FileGetShortcut() and it always returned error. FIleExists didnt work either...By the way it was acrobat Reader's shortcut (adobe.lnk). dim $var[7] If FileExists(@desktopdir & "\Adobe.lnk") then Msgbox(0,"","FOUND") $var=FileGetShortcut(@desktopdir & "\adobe.lnk") if @error then MsgBox(0,"","ERROR") For $i=0 to 6 MsgBox(0,"",$var[$i]) Next EDIT:Added code Edited August 10, 2005 by hgeras Useful information about COM/Objects referenceMy Scripts:PapDefragNvidia Temperature Logger V3.0 with graph analyzerAutoiIt Update Checker And Downloader V1.0ArrayPush UDF Link to comment Share on other sites More sharing options...
/dev/null Posted August 10, 2005 Share Posted August 10, 2005 Both AutoIT functions FileExists() and FileDelete() use FindFirstFile() (win32 API) in the source code. So, I guess FindFirstFile() fails to find a shortcut, and thus returns INVALID_HANDLE_VALUE. - utility.cpp:717 (public source). Cheers Kurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
hgeras Posted August 10, 2005 Share Posted August 10, 2005 It is possible for FileExists() and FileDelete() not to work for the reason you said.But what about the FileGetShortcut()?It is supposed to handle Shortcuts.... Useful information about COM/Objects referenceMy Scripts:PapDefragNvidia Temperature Logger V3.0 with graph analyzerAutoiIt Update Checker And Downloader V1.0ArrayPush UDF Link to comment Share on other sites More sharing options...
/dev/null Posted August 10, 2005 Share Posted August 10, 2005 It is possible for FileExists() and FileDelete() not to work for the reason you said.But what about the FileGetShortcut()?It is supposed to handle Shortcuts....<{POST_SNAPBACK}>FileGetShortcut() also uses FileFindFirst() in function utiliy.cpp::Util_DoesFileExist(). However, I'm just speculating, as I did not try to troubleshoot the problem yet. Could well be another reason why the functions fail.CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
anystupidassname Posted August 10, 2005 Share Posted August 10, 2005 FileDelete works for me. Am I missing something? This signature is computer generated, nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#....... Link to comment Share on other sites More sharing options...
/dev/null Posted August 10, 2005 Share Posted August 10, 2005 FileDelete works for me. Am I missing something?<{POST_SNAPBACK}>maybe windows version?CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
anystupidassname Posted August 10, 2005 Share Posted August 10, 2005 maybe windows version?CheersKurt<{POST_SNAPBACK}>I'm on XPP SP2I thought maybe because I don't leave the Windows default HKEY_CLASSES_ROOT\lnkfile\ "NeverShowExt"that hides lnk extension but I set it back to default and FileDelete still works... ::headscratch:: I also tried the non beta version of AutoIt. First time I've had trouble getting something to NOT work with AutoIt This signature is computer generated, nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#....... Link to comment Share on other sites More sharing options...
hgeras Posted August 10, 2005 Share Posted August 10, 2005 I have XP Pro SP2 too and it doesnt work...I believe it has something to do with the shortcuts that you make yourself and the shortcuts that are made through app installers.... Useful information about COM/Objects referenceMy Scripts:PapDefragNvidia Temperature Logger V3.0 with graph analyzerAutoiIt Update Checker And Downloader V1.0ArrayPush UDF Link to comment Share on other sites More sharing options...
CyberSlug Posted August 11, 2005 Share Posted August 11, 2005 I believe it has something to do with the shortcuts that you make yourself and the shortcuts that are made through app installers....Probably. Properties of the Adobe Reader shortcut. It seems that MSI setup files produce special shortcuts. Word,Excel,etc. have these "special" shortcuts in the Start Menu. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 11, 2005 Author Share Posted August 11, 2005 The only problem I have with that theory, is the fact that all the shortcuts I am trying to delete dont have that 'special' stuff. It is created by an application, but still it should be allowed to be deleted. Oh well... I will have to come up with another way to go about this. Maybe just set the attribute hidden, but if the person has hidden objects showing it wont work If anyone else comes up with something let me know. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Holger Posted August 11, 2005 Share Posted August 11, 2005 (edited) I have here XP and SP2 and at work SP1 and had never problems with creating and deleting shortcuts!? Strange.... Really stupid question (I know): does deleting with "Del"-key work? What I experience sometimes is that a virus scanner sometimes locks the file I want to delete... Edited August 11, 2005 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 11, 2005 Author Share Posted August 11, 2005 I have here XP and SP2 and at work SP1 and had never problems with creating and deleting shortcuts!?Strange.... <{POST_SNAPBACK}>Are you deleting shortcuts that you made or were made by programs? That seems to be the issue.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Holger Posted August 11, 2005 Share Posted August 11, 2005 Both is working here: I could also delete the Acrobat Reader-shortcut from my desktop (All Users) and could delete normal and 'special' shortcuts... Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 11, 2005 Author Share Posted August 11, 2005 Both is working here: I could also delete the Acrobat Reader-shortcut from my desktop (All Users) and could delete normal and 'special' shortcuts...<{POST_SNAPBACK}>What code are you using and are you using v3 or beta?JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Holger Posted August 11, 2005 Share Posted August 11, 2005 (edited) Ohhhh...wait - I think I can reproduce.... Edit are you sure you used the right directory-macro:@DesktopDir or it's maybe in 'All Users'-profile -> @DesktopCommonDir ?Forgot: it works with release and beta versions.I have no more ideas at the moment... Edited August 11, 2005 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
therks Posted August 11, 2005 Share Posted August 11, 2005 (edited) I have no problems with mine... It must be a directory thing. Can you try reading/deleting other types of files in the same directory?*Edit: The code I used was simple.I created a shortcut called "short"Then just FileDelete('short.lnk')*Edit2: Some more expansive example code:$v = FileCreateShortcut(@COMSPEC, @DesktopDir & '\short.lnk') If $v Then MsgBox(0, '', 'Created') $v = FileDelete(@DesktopDir & '\short.lnk') If $v Then MsgBox(0, '', 'Deleted') Else MsgBox(0, '', 'Error deleting') EndIf Else MsgBox(0, '', 'Error deleting') EndIfWorks fine for me. How about you? Edited August 11, 2005 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
anystupidassname Posted August 11, 2005 Share Posted August 11, 2005 Ohhhh...wait - I think I can reproduce.... Edit are you sure you used the right directory-macro:@DesktopDir or it's maybe in 'All Users'-profile -> @DesktopCommonDir ?Forgot: it works with release and beta versions.I have no more ideas at the moment...<{POST_SNAPBACK}>I'm unable to reproduce, sorry...I tried several MSI packages (running msi V 3.01.4000.1823)And I also tried some shortcuts created by a REAL installer like Inno...I can't make it NOT work!!! This signature is computer generated, nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#....... 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