Reaper Posted July 14, 2010 Share Posted July 14, 2010 Ok... Below is the part of the code Im having a problem with... Im using FileInstall for the 2 7zip files needed. Then at the end im using FileDelete to remove the 7zip files. Problem is the filedelete is not removing the 2 files... Any help would be appreciated. expandcollapse popupFunc _x64() TrayTip('Windows® Defender® definition updates addon maker', ' is compiling files. Please wait ...', 120, 1) FileInstall ("C:\aa\7z.dll", @ScriptDir & "\7z.dll") FileInstall ("C:\aa\7z.exe", @ScriptDir & "\7z.exe") Local $x64_vers, $x64ProdName, $x64_msg, $size_plugin, $line_plugin, $silent_x64, $size_sfx $x64_vers = FileGetVersion($download & 'mpas-fex64.exe') $x64ProdName = FileGetVersion($download & 'mpas-fex64.exe', 'ProductName') $x64_msg = $x64ProdName & " " & $x64_vers & ' for Windows 7 (x64)' $silent_x64 = 'mpas-fex64' & '.exe' If FileExists($workdir) Then DirRemove($workdir, 1) DirCreate($workdir) Else EndIf DirCreate($svcpack) FileCopy($download & $x64, $workdir & $x64, 9) RunWait(@ScriptDir & '\7z a -mx=9 ' & '"..\compresed.7z"' & ' *.exe', $workdir, @SW_HIDE) RunWait('CMD /c copy /b Binary64\x64.sfx+Binary64\x64.cfg+compresed.7z ' & '"' & $svcpack & $sfx_x64_plugin & '"', '', @SW_HIDE) FileDelete(@ScriptDir & '\compresed.7z') FileDelete($workdir & 'mpas-fex64.exe') FileMove($svcpack & $sfx_x64_plugin, $Temp1 & $silent_x64, 9) DirRemove($svcpack) DirRemove($workdir) FileDelete($download & 'mpas-fex64.exe') DirRemove($download) FileCopy($Binary & $Tasks, $Temp & $Tasks, 9) FileCopy($Binary & $Install, $Temp2 & $Install, 9) FileCopy($Binary & $Reg, $Temp & $Reg, 9) RunWait(@ScriptDir & '\7z a -mx=9 ' & '"..\Reapers_Definition_Update_For_Windows_Defender_x64_Windows7_AddOn.WA"', $Temp, @SW_HIDE) DirRemove($output) FileDelete($Temp & 'Tasks.txt') FileDelete($Temp & 'DefUpd.reg') FileDelete($Temp2 & 'Install.bat') DirRemove($Temp2) FileDelete($Temp1 & 'mpas-fex64.exe') DirRemove($Temp1) DirRemove($Temp3) DirRemove($Temp) FileMove(@ScriptDir & "\Reapers_Definition_Update_For_Windows_Defender_x64_Windows7_AddOn.WA", @DesktopDir) FileDelete(@ScriptDir & '7z.dll') FileDelete(@ScriptDir & '7z.exe') EndFunc ;==>_x64 Link to comment Share on other sites More sharing options...
enaiman Posted July 14, 2010 Share Posted July 14, 2010 I suspect the 2 files might be in use at the time you try to delete them. The easiest thing to try is: sleep for a couple seconds before attempting to delete those files. If it doesn't work, you'll need to check the process list for 7z and eventually terminate the process then try to delete the files. Just my 2 cents. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Reaper Posted July 14, 2010 Author Share Posted July 14, 2010 Well i tried the sleep... No go.... I was watching task manager and 7z.exe closed well before the filedelete.... Still didnt delete the files... Link to comment Share on other sites More sharing options...
ripdad Posted July 14, 2010 Share Posted July 14, 2010 FileDelete(@ScriptDir & '7z.exe') Should be: FileDelete(@ScriptDir & '\7z.exe') ---- Is $workdir a global var with trailing backslash? example: Global $workdir = @ScriptDir & '\' or inside the function: Local $workdir = @ScriptDir & '\' "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
enaiman Posted July 14, 2010 Share Posted July 14, 2010 @ripdad well done Didn't spot that error. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Reaper Posted July 14, 2010 Author Share Posted July 14, 2010 Thanks to both of you for your help. That did it... File gets deleted fine now... @ripdad Global $workdir = @ScriptDir & '\workdir\' Ok... 1 final question if you dont mind... I would like to have this program check that the computer it is being run on has internet access.. If it does, just continue as normal. If it doesn't, pop up a message saying "This program requires internet access, yada yada yada..." How would I go about doing that? I really appreciate both of you taking time to help me. Thank you. Link to comment Share on other sites More sharing options...
JohnOne Posted July 14, 2010 Share Posted July 14, 2010 Probably just pinging google, if @error try pinging yahoo or something, its doubtfull they would both be down at the same time. Ping() << helpfile. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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