pecha Posted May 10, 2007 Share Posted May 10, 2007 Help me whith this please, autoit scritp give me a msg "Directory removed " but dont delet, the dir pacth it is not certain ( _DirDeleteEx("@AppDataDir & '\..\Test\Absolute Uninstaller 2.0'") ) ?sorry my bad inglesthanksRun (@ScriptFullPath & '\..\Prog\uninstaller.exe') WinWait("Absolute Uninstaller", "") ;~ WinWait("Microsoft Excel - upseinv analysis.xls") While WinExists("Absolute Uninstaller", "") Sleep(100) WEnd _DirDeleteEx("@AppDataDir & '\..\Test\Absolute Uninstaller 2.0'") Switch @error Case 0 MsgBox(64, 'Info', 'Directory removed.') Case 1 MsgBox(16, 'Error', 'The directory does not exist.') Case 2 MsgBox(16, 'Error', 'A file is in use and the directory could not be romoved.') EndSwitch Func _DirDeleteEx($hDirectory, $iTimeWait = 2) If Not FileExists($hDirectory) Then SetError(1, 0, 0) Local $iTimer = TimerInit(), $iDiff Do DirRemove($hDirectory, 1) $iDiff = TimerDiff($iTimer) If $iDiff >= $iTimeWait Then ExitLoop Until Not FileExists($hDirectory) If Not FileExists($hDirectory) Then Return SetError(0, 0, 1) If $iDiff >= $iTimeWait And FileExists($hDirectory) Then SetError(2, 0, 0) EndFunc Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 10, 2007 Share Posted May 10, 2007 (edited) Your use of quotes is a little off: _DirDeleteEx(@AppDataDir & '\..\Test\Absolute Uninstaller 2.0') The '\..\' part is still not valid, but I'm assuming you will replace the two dots with the rest of the valid path. Edited May 10, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
erebus Posted May 10, 2007 Share Posted May 10, 2007 Of course the "\..\" part is valid; AutoIT supports relative paths just perfect. Replace this: _DirDeleteEx("@AppDataDir & '\..\Test\Absolute Uninstaller 2.0'")oÝ÷ ÙhØb±«¢+Ù}¥É±Ñà¡ÁÁѥȵÀìÅÕ½ÐìÀäÈ츸ÀäÈíQÍÐÀäÈíͽ±ÕÑU¹¥¹Íѱ±ÈȸÀÅÕ½Ðì¤ ...and remember that everytime you use a @macro within "quotes" it stops working as a macro and it becomes a plain string. Also try to use double quotes and not single ones if possible. Link to comment Share on other sites More sharing options...
pecha Posted May 10, 2007 Author Share Posted May 10, 2007 thanks erebus :-) it continues not delete :-/ and script stops ( but it does not finish ) does not go for " Func _DirDeleteEx...... " I go to make an interval, must be effect of the lunch :-P thanks ppl sorry my ingles Link to comment Share on other sites More sharing options...
erebus Posted May 10, 2007 Share Posted May 10, 2007 Does DirRemove(@AppDataDir & '\..\Test\Absolute Uninstaller 2.0', 1) ...itself works on your system? Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 10, 2007 Share Posted May 10, 2007 Of course the "\..\" part is valid; AutoIT supports relative paths just perfect. I knew that AuotIt supports relative paths, but I didn't think you could have that relative reference in the middle of the path, like: C:\Temp\..\Program Files\AutoIt3. The path given was '\..\' coming after @AppDataDir. A quick test script proved me wrong: #include <file.au3> #include <array.au3> $Path = "C:\Temp" If FileExists($Path & "\..\Program Files\AutoIt3\") Then MsgBox(64, "Found", "Found it: " & $Path & "\..\Program Files\AutoIt3") $avList = _FileListToArray($Path & "\..\Program Files\AutoIt3", "*.*", 2) If @error Then MsgBox(16, "Error", "_FileListToArray returned @error = " & @error) Else _ArrayDisplay($avList, "List of AutoIt3") EndIf Else MsgBox(16, "Error", "Couldn't find: " & $Path & "\..\Program Files\AutoIt3") EndIf I learned my new thing for the day; I'm going home... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
pecha Posted May 10, 2007 Author Share Posted May 10, 2007 still not working DirRemove(@AppDataDir & '\..\Test\Absolute Uninstaller 2.0', 1) like this work fine DirRemove("C:\Documents and Settings\Administrador\Application Data\Test\Absolute Uninstaller 2.0" , 1) I do not perceive what it is badly Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 10, 2007 Share Posted May 10, 2007 still not working DirRemove(@AppDataDir & '\..\Test\Absolute Uninstaller 2.0', 1) like this work fine DirRemove("C:\Documents and Settings\Administrador\Application Data\Test\Absolute Uninstaller 2.0" , 1) I do not perceive what it is badly Your relative path is wrong. Evaluate it left-to-right: @AppDataDir = "C:\Documents and Settings\Administrator\Application Data" Next you have ".." which means "back up one in the tree" and gives you: "C:\Documents and Settings\Administrator" Then you have the rest of the path added on, giving you: "C:\Documents and Settings\Administrator\Test\Absolute Uninstaller 2.0" Take the "\.." out and it should work: DirRemove(@AppDataDir & '\Test\Absolute Uninstaller 2.0', 1) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
pecha Posted May 10, 2007 Author Share Posted May 10, 2007 where it's that I was with the head loll I will not forget myself this annymore thanks :-) 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