d3mon Posted July 25, 2008 Posted July 25, 2008 (edited) Hello, This is part of my script : FileCreateShortcut(@ProgramFilesDir&"\PMD\PMD.exe",@StartupCommonDir&"\PMD",@ProgramFilesDir&"\PMD") FileDelete(@StartupCommonDir&"\PMD") The script create shortcut but doesn't delete it, why ? Edited July 25, 2008 by d3mon No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE
Paulie Posted July 25, 2008 Posted July 25, 2008 i'd say its not deleting because you have "oÝ÷ Øý½ëkçm+-¢®¶sdfÆT7&VFU6÷'F7WB&öw&ÔfÆW4F"fײgV÷C²b3#µÔBb3#µÔBæWRgV÷C²Ä7F'GW6öÖÖöäF"fײgV÷C²b3#µÔBææ²gV÷C²Ä&öw&ÔfÆW4F"fײgV÷C²b3#µÔBgV÷C²¤fÆTFVÆWFR7F'GW6öÖÖöäF"fײgV÷C²b3#µÔBææ²gV÷C²" in your script. (How about you edit the post and use {code} tages
d3mon Posted July 25, 2008 Author Posted July 25, 2008 FileCreateShortcut(@ProgramFilesDir&"\PMD\PMD.exe",@StartupCommonDir&"\PMD",@ProgramFilesDir&"\PMD") FileDelete(@StartupCommonDir&"\PMD") That's better ^^ Anyhelp ? No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE
Paulie Posted July 25, 2008 Posted July 25, 2008 try this: FileCreateShortcut(@ProgramFilesDir&"\PMD\PMD.exe",@StartupCommonDir&"\PMD.lnk",@ProgramFilesDir&"\PMD") FileDelete(@StartupCommonDir&"\PMD.lnk") Dunno?
d3mon Posted July 25, 2008 Author Posted July 25, 2008 try this: FileCreateShortcut(@ProgramFilesDir&"\PMD\PMD.exe",@StartupCommonDir&"\PMD.lnk",@ProgramFilesDir&"\PMD") FileDelete(@StartupCommonDir&"\PMD.lnk") Dunno? Don't work too...perhaps autoit version problem ? No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE
martin Posted July 25, 2008 Posted July 25, 2008 try this: FileCreateShortcut(@ProgramFilesDir&"\PMD\PMD.exe",@StartupCommonDir&"\PMD.lnk",@ProgramFilesDir&"\PMD") FileDelete(@StartupCommonDir&"\PMD.lnk") Dunno? Maybe you should try FileDelete(@StartupCommonDir&"\PMD.pif") and definitely you should try to stop using AutoIt tags. Use code tags they are reliable, AutoIt tags are not. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
d3mon Posted July 25, 2008 Author Posted July 25, 2008 Maybe you should try FileDelete(@StartupCommonDir&"\PMD.pif") and definitely you should try to stop using AutoIt tags. Use code tags they are reliable, AutoIt tags are not. Don't work too wtf ? No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE
martin Posted July 25, 2008 Posted July 25, 2008 Don't work too wtf ?OK. What I did was I used the command prompt and did DIR. It showed that the file name was as expected but that the extension was pif not lnk. Now I realize that the pif was because I chose a shortcut to a 16 bit DOS program. Apologies. Anyway here is what I did to test and if I keep the lnk extension and make a shortcut to notepad then the filedelete works. ConsoleWrite(FileCreateShortcut(@WindowsDir & "\notepad.exe",@ScriptDir & "\Shortcut To np.lnk",@ScriptDir) & @CR) $s = @ScriptDir & "\Shortcut To np.lnk" ConsoleWrite("$s = " & $s & @CRLF) ConsoleWrite(@CRLF & FileDelete($s) & @CR) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
d3mon Posted July 25, 2008 Author Posted July 25, 2008 OK. What I did was I used the command prompt and did DIR. It showed that the file name was as expected but that the extension was pif not lnk. Now I realize that the pif was because I chose a shortcut to a 16 bit DOS program. Apologies. Anyway here is what I did to test and if I keep the lnk extension and make a shortcut to notepad then the filedelete works. ConsoleWrite(FileCreateShortcut(@WindowsDir & "\notepad.exe",@ScriptDir & "\Shortcut To np.lnk",@ScriptDir) & @CR) $s = @ScriptDir & "\Shortcut To np.lnk" ConsoleWrite("$s = " & $s & @CRLF) ConsoleWrite(@CRLF & FileDelete($s) & @CR) Yep succesfully works ! Why ? because i was using .Ink extension instead of shortcut extension .lnk ...Anyway thanks No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE
sleepydvdr Posted August 1, 2008 Posted August 1, 2008 (edited) FileDelete(@StartupCommonDir&"\PMD.pif") I was having the same problem I was using: filedelete (@DesktopCommonDir & "\example.lnk") It worked on some computer and some operating systems, but not others. Then I found this: filerecycle (@DesktopCommonDir & "\example.lnk") File Recycle has worked every single time for me so far. It doesn't delete it, though - it sends it to the recycle bin. I don't know if this is good enough for your needs, but it's good enough for me. Edited August 1, 2008 by sleepydvdr #include <ByteMe.au3>
youknowwho4eva Posted August 1, 2008 Posted August 1, 2008 what about a filerecycleempty after that? Giggity
leejb Posted August 14, 2012 Posted August 14, 2012 Know this is an old thread, but just thought I'd include that this still seems to be an issue with v3. On Win7 with #RequireAdmin, using FileDelete() on a file located on the desktop x:\users\public\desktop fails, however, doing a FileRecycle() and subsequent FileRecycleEmpty works fine. If there is a solution to get FileEmpty to work it would be nice as I hate having to empty a recycler and have to add the question to ensure it is OK with the user.
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