timyboy Posted May 12, 2013 Share Posted May 12, 2013 Is there a UDF which automatically in a folder and subfolders for. DLL is located and if already present renewed? Link to comment Share on other sites More sharing options...
JohnOne Posted May 12, 2013 Share Posted May 12, 2013 No. But you can make one. 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...
AZJIO Posted May 12, 2013 Share Posted May 12, 2013 #include <FileOperations.au3> $aFileList = _FO_FileSearch(@SystemDir, '*.dll') For $i = 1 To $aFileList[0] RunWait('regsvr32.exe /s ' & $aFileList[$i]) Next My other projects or all Link to comment Share on other sites More sharing options...
timyboy Posted May 13, 2013 Author Share Posted May 13, 2013 expandcollapse popupRequireAdmin IsAdmin() #include-once #include <Date.au3> #include <Array.au3> #include <File.au3> #include <DateTimeConstants.au3> Global $sFile,$tFile,$tPath If @OSArch = "64" Then $tPath = "\%Systemroot%\System32\" ;Die 64-Bit-Version ist If @OSArch = "86" Then $tPath = "\%Systemroot%\SysWoW64\" ;Die 32-Bit-Version ist Global $sPath = @ScriptDir Global $hSearch = FileFindFirstFile($sPath & "\*.dll") Global $tSearch = FileFindFirstFile($tPath & "\*.dll") If $hSearch = -1 Then TrayTip("Info", "Keine neuen DLLs enthalten ! ", 5, 1) Sleep(1250) TrayTip("clears any tray tip", "", 0) Exit EndIf While True $sFile = FileFindNextFile($hSearch) If @error Then ExitLoop $tFile = FileFindNextFile($tSearch) If @error Then _Neu() _Version() ExitLoop WEnd Func _Neu() FileCopy($sFile , $tPath, 9) Sleep(50) ShellExecute("regsvr32.exe" & '/s' , "'" & $tPath & "\" & $sFile & "'") ConsoleWrite("Dll registriert: " & $sFile & @CRLF) Sleep(50) Exit EndFunc Func _Version() Local $Fileversion1 = FileGetVersion($hSearch, 1) If @error Then _Time() Local $Fileversion2 = FileGetVersion($tSearch, 1) If @error Then _Time() If $Fileversion1 > $Fileversion2 Then FileDelete($Fileversion2) Sleep(50) FileCopy($Fileversion1 , $Fileversion2, 9) Sleep(50) ShellExecute("regsvr32.exe" , ' /s ' & $tPath & "\" & $tFile & "'") ConsoleWrite("Dll registriert: " & $tFile & @CRLF) Sleep(50) Else FileDelete($Fileversion1) Sleep(50) ConsoleWrite("KEINE Dll registriert: " & $tFile & @CRLF) Sleep(50) Endif EndFunc Func _Time() Local $File1 = FileGetTime($hSearch, 1) Local $File2 = FileGetTime($tSearch, 1) If Not @error Then If $File1[0]>$File2[0] or $File1[1]>$File2[1] or $File1[2]>$File2[2] or $File1[3]>$File2[3] or $File1[4]>$File2[4] then ; mit [5] haste auch noch die Sekunden ;) FileDelete($File2) ;oder du machst FileCopy und mit dem flag das er es überschreiben soll ;-) FileCopy("Pfad wo es jetzt liegt", "Pfadwo es hin soll",1) die 1 heisst überschreiben Sleep(50) FileCopy($File1, $File2, 9) Sleep(50) ShellExecute("regsvr32.exe", ' /s ' & $tPath & "\" & $tFile & "'") ConsoleWrite("Dll registriert: " & $tFile & @CRLF) TrayTip("Info", "Dll registriert: " & $tFile & @CRLF , 5, 1) Sleep(2500) TrayTip("clears any tray tip", "", 0) Sleep(50) Else FileDelete($File1) Sleep(50) ConsoleWrite("KEINE Dll registriert: " & $tFile & @CRLF) TrayTip("KEINE Dll registriert:", "$tFile & @CRLF " , 5, 1) Sleep(2500) TrayTip("clears any tray tip", "", 0) Sleep(50) Endif EndIf ;$Filex[0] = year (four digits) x steht für die jeweilige Zahl ;) ;$Filex[1] = month (range 01 - 12) ;$Filex[2] = day (range 01 - 31) ;$Filex[3] = hour (range 00 - 23) ;$Filex[4] = min (range 00 - 59) ;$Filex[5] = sec (range 00 - 59) EndFunc Link to comment Share on other sites More sharing options...
timyboy Posted May 13, 2013 Author Share Posted May 13, 2013 Where is the error because the DLL will always new regestriert, although this should happen only in newer versions. Link to comment Share on other sites More sharing options...
AZJIO Posted May 13, 2013 Share Posted May 13, 2013 timyboy, $tPath = ';)' If @OSArch = "64" Then $tPath = "\%Systemroot%\System32\" ;Die 64-Bit-Version ist If @OSArch = "86" Then $tPath = "\%Systemroot%\SysWoW64\" ;Die 32-Bit-Version ist MsgBox(0, 'O_o', $tPath) My other projects or all Link to comment Share on other sites More sharing options...
timyboy Posted May 15, 2013 Author Share Posted May 15, 2013 better? If @OSArch = "64" Then $tPath = "\%Systemroot%\System32\" ;Die 64-Bit-Version ist Else If @OSArch = "86" Then $tPath = "\%Systemroot%\SysWoW64\" ;Die 32-Bit-Version ist EndIf EndIf Link to comment Share on other sites More sharing options...
timyboy Posted May 15, 2013 Author Share Posted May 15, 2013 I habe problems with ShellExecute("regsvr32.exe" & '/s' , "'" & $tPath & "" & $sFile & "'") what is wrong? Link to comment Share on other sites More sharing options...
AZJIO Posted May 15, 2013 Share Posted May 15, 2013 (edited) MsgBox(0, '', @OSArch) 'x64' = '64' ? 'x86' = '86' ? You can check variables? better? $tPath = ';)' If @OSArch = "64" Then $tPath = "\%Systemroot%\System32\" ;Die 64-Bit-Version ist Else If @OSArch = "86" Then $tPath = "\%Systemroot%\SysWoW64\" ;Die 32-Bit-Version ist EndIf EndIf MsgBox(0, 'O_o', $tPath) Edited May 15, 2013 by AZJIO My other projects or all Link to comment Share on other sites More sharing options...
timyboy Posted May 17, 2013 Author Share Posted May 17, 2013 (edited) Ok, thanks. And now i have problems with the regsvr32. And a dll is registered to be tried again and again, although this is not new. expandcollapse popup#RequireAdmin IsAdmin() #include-once #include <Date.au3> #include <Array.au3> #include <File.au3> #include <DateTimeConstants.au3> Global $sFile,$tFile,$tPath Global $sPath = @ScriptDir Global $hSearch = FileFindFirstFile($sPath & "\*.dll") Global $tSearch = FileFindFirstFile($tPath & "\*.dll") If @OSArch = "64" Then $tPath = "\%Systemroot%\System32\" ;Die 64-Bit-Version ist Else If @OSArch = "86" Then $tPath = "\%Systemroot%\SysWoW64\" ;Die 32-Bit-Version ist EndIf EndIf If $hSearch = -1 Then TrayTip("Info", "Keine neuen DLLs enthalten ! ", 5, 1) Sleep(1250) TrayTip("clears any tray tip", "", 0) Exit EndIf While True $sFile = FileFindNextFile($hSearch) If @error Then ExitLoop $tFile = FileFindNextFile($tSearch) If @error Then _Neu() _Version() ExitLoop WEnd Func _Neu() FileCopy($sFile , $tPath, 9) Sleep(50) ShellExecute("regsvr32.exe" , "'" & $tPath & "\" & $sFile & "'") ConsoleWrite("Dll registriert: " & $sFile & @CRLF) Sleep(50) Exit EndFunc Func _Version() Local $Fileversion1 = FileGetVersion($hSearch, 1) If @error Then _Time() Local $Fileversion2 = FileGetVersion($tSearch, 1) If @error Then _Time() If $Fileversion1 > $Fileversion2 Then FileDelete($Fileversion2) Sleep(50) FileCopy($Fileversion1 , $Fileversion2, 9) Sleep(50) ShellExecute("regsvr32.exe" , ' /s ' & $tPath & "/" & $tFile & "'") ConsoleWrite("Dll registriert: " & $tFile & @CRLF) Sleep(50) Else FileDelete($Fileversion1) Sleep(50) ConsoleWrite("KEINE Dll registriert: " & $tFile & @CRLF) Sleep(50) Endif EndFunc Func _Time() Local $File1 = FileGetTime($hSearch, 1) Local $File2 = FileGetTime($tSearch, 1) If Not @error Then If $File1[0]>$File2[0] or $File1[1]>$File2[1] or $File1[2]>$File2[2] or $File1[3]>$File2[3] or $File1[4]>$File2[4] then ; mit [5] haste auch noch die Sekunden ;) FileDelete($File2) ;oder du machst FileCopy und mit dem flag das er es überschreiben soll ;-) FileCopy("Pfad wo es jetzt liegt", "Pfadwo es hin soll",1) die 1 heisst überschreiben Sleep(50) FileCopy($File1, $File2, 9) Sleep(50) ShellExecute("regsvr32.exe", "'" & $tPath & "\" & $tFile & "'") ConsoleWrite("Dll registriert: " & $tFile & @CRLF) TrayTip("Info", "Dll registriert: " & $tFile & @CRLF , 5, 1) Sleep(2500) TrayTip("clears any tray tip", "", 0) Sleep(50) Else FileDelete($File1) Sleep(50) ConsoleWrite("KEINE Dll registriert: " & $tFile & @CRLF) TrayTip("KEINE Dll registriert:", "$tFile & @CRLF " , 5, 1) Sleep(2500) TrayTip("clears any tray tip", "", 0) Sleep(50) Endif EndIf ;$Filex[0] = year (four digits) x steht für die jeweilige Zahl ;) ;$Filex[1] = month (range 01 - 12) ;$Filex[2] = day (range 01 - 31) ;$Filex[3] = hour (range 00 - 23) ;$Filex[4] = min (range 00 - 59) ;$Filex[5] = sec (range 00 - 59) EndFunc Edited May 17, 2013 by timyboy Link to comment Share on other sites More sharing options...
AZJIO Posted May 17, 2013 Share Posted May 17, 2013 I started to do it, but I got confused and tired. expandcollapse popup#RequireAdmin IsAdmin() #include-once #include <Date.au3> #include <Array.au3> #include <File.au3> #include <DateTimeConstants.au3> Global $sFile, $tFile, $SysPath Global $SysPath If @OSArch = 'x64' Then $SysPath = @HomeDrive '\System32' ;Die 64-Bit-Version ist Else $SysPath = @HomeDrive '\SysWoW64' ;Die 32-Bit-Version ist EndIf Global $sPath = @ScriptDir ; Global $hSearch = FileFindFirstFile($sPath & "\*.dll") ; Global $tSearch = FileFindFirstFile($SysPath & "\*.dll") $aSysFile = _FileListToArray($SysPath, "*.dll", 1) $aCurFile = _FileListToArray($sPath, "*.dll", 1) If @error Then ; If $hSearch = -1 Then TrayTip("Info", "Keine neuen DLLs enthalten ! ", 5, 1) Sleep(1250) TrayTip("clears any tray tip", "", 0) Exit EndIf While True ; $sFile = FileFindNextFile($hSearch) ; If @error Then ExitLoop ; $tFile = FileFindNextFile($tSearch) For $i = 1 To $aCurFile[0] If Not FileExists($SysPath & "\" & $aCurFile[$i]) Then _Neu($i) Next ; If @error Then _Neu() _Version() ExitLoop WEnd Func _Neu($i) FileCopy($sPath & "\" & $aCurFile[$i], $SysPath & "\" & $aCurFile[$i], 9) Sleep(50) ; ShellExecute('regsvr32.exe /s', $SysPath & "\" & $aCurFile[$i]) MsgBox(0, 'Yes?', 'regsvr32.exe /s ' & $SysPath & '\' & $aCurFile[$i]) RunWait('regsvr32.exe /s ' & $SysPath & '\' & $aCurFile[$i]) ConsoleWrite("Dll registriert: " & $sFile & @CRLF) Sleep(50) ; ??? Exit ; ??? But what about the rest of the files? let them go down to the woods? EndFunc ;==>_Neu My other projects or all Link to comment Share on other sites More sharing options...
timyboy Posted May 17, 2013 Author Share Posted May 17, 2013 syntax error Link to comment Share on other sites More sharing options...
BrewManNH Posted May 17, 2013 Share Posted May 17, 2013 syntax error Could you be any more vague than this? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator 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