Xenobiologist Posted October 28, 2009 Share Posted October 28, 2009 So, is there still a question open? Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
gte Posted October 28, 2009 Share Posted October 28, 2009 I don't believe win2k server has a native zip utility in the OS ... is there a way to have this process execute in AIT?I'd like to open the file, extract on the .xml inside of it (ignore the other file types) and then close the file and leave it where it was so that I can work with the extracted xml fileThis uses COM to ask the built in windows unzipper to unzip the fileBut how do I zip a file? HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
gte Posted October 28, 2009 Share Posted October 28, 2009 Also, how do you have it unzip an entire folder, and is there a way to have it only extract a certain file type? HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
gte Posted October 28, 2009 Share Posted October 28, 2009 Got it working thanks trance, great function! The question is, will this work on server 2000? Do I need to include a file if not? expandcollapse popup#Include <File.au3> ; Tab 1 Modules ;~ DirCreate(@DesktopDir & "\Extracted") ; to extract to $sPath = "D:\test" $zipfilelist = _FileListToArray($sPath,"*.zip",1) ;~ MsgBox(0, "File List", $zipfilelist[1] & $zipfilelist[2] & $zipfilelist[3] & $zipfilelist[4] & $zipfilelist[5] & $zipfilelist[6] & $zipfilelist[7] & $zipfilelist[8] & $zipfilelist[9] & $zipfilelist[10] & $zipfilelist[11]) for $i = 1 to $zipfilelist[0] Step 1 ;~ MsgBox(0, "$i", $zipfilelist[$i]) Local $xmlname1 Local $xmlname2 $xmlname1 = StringReplace($zipfilelist[$i], ".", "") ;~ MsgBox(0,"xmlname1",$xmlname1) $xmlname2 = StringReplace($xmlname1, "zip", ".xml") ;~ MsgBox(0,"xmlname2",$xmlname2) ;~ MsgBox(0, "extract", "_ExtractZip(D:\dma\fecs\downloadbak\test\" & $zipfilelist[$i] ) _ExtractZip("D:\test\" & $zipfilelist[$i] , "", $xmlname2, "C:\temp\testxmls") ;~ _ExtractZip(@DesktopDir & "\YourZipFile.zip", "SomeFolderWithinOrNothing", "FileOrFolderToExtract.extensionIfEny", @DesktopDir & "\Extracted") ;~ MsgBox(0,0,"END") Next ConsoleWrite(@error & @CRLF) ; #FUNCTION# ;=============================================================================== ; ; Name...........: _ExtractZip ; Description ...: Extracts file/folder from ZIP compressed file ; Syntax.........: _ExtractZip($sZipFile, $sFolderStructure, $sFile, $sDestinationFolder) ; Parameters ....: $sZipFile - full path to the ZIP file to process ; $sFolderStructure - 'path' to the file/folder to extract inside ZIP file ; $sFile - file/folder to extract ; $sDestinationFolder - folder to extract to. Must exist. ; Return values .: Success - Returns 1 ; - Sets @error to 0 ; Failure - Returns 0 sets @error: ; |1 - Shell Object creation failure ; |2 - Destination folder is unavailable ; |3 - Structure within ZIP file is wrong ; |4 - Specified file/folder to extract not existing ; Author ........: trancexx ; ;========================================================================================== Func _ExtractZip($sZipFile, $sFolderStructure, $sFile, $sDestinationFolder) Local $i Do $i += 1 $sTempZipFolder = @TempDir & "\Temporary Directory " & $i & " for " & StringRegExpReplace($sZipFile, ".*\\", "") Until Not FileExists($sTempZipFolder) ; this folder will be created during extraction Local $oShell = ObjCreate("Shell.Application") If Not IsObj($oShell) Then Return SetError(1, 0, 0) ; highly unlikely but could happen EndIf Local $oDestinationFolder = $oShell.NameSpace($sDestinationFolder) If Not IsObj($oDestinationFolder) Then Return SetError(2, 0, 0) ; unavailable destionation location EndIf Local $oOriginFolder = $oShell.NameSpace($sZipFile & "\" & $sFolderStructure) ; FolderStructure is overstatement because of the available depth If Not IsObj($oOriginFolder) Then Return SetError(3, 0, 0) ; unavailable location EndIf ;Local $oOriginFile = $oOriginFolder.Items.Item($sFile) Local $oOriginFile = $oOriginFolder.ParseName($sFile) If Not IsObj($oOriginFile) Then Return SetError(4, 0, 0) ; no such file in ZIP file EndIf ; copy content of origin to destination $oDestinationFolder.CopyHere($oOriginFile, 4) ; 4 means "do not display a progress dialog box", but apparently doesn't work DirRemove($sTempZipFolder, 1) ; clean temp dir Return 1 ; All OK! EndFunc HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
gte Posted October 29, 2009 Share Posted October 29, 2009 Anyone know if this works on win2k server and win2k3 server? My exe is even close enough to test this on a box HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
gte Posted November 2, 2009 Share Posted November 2, 2009 I believe it is not working on 2kserver as I am getting this in 2kserverIt does work in 2k3 server HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted November 2, 2009 Share Posted November 2, 2009 Windows 2000 didn't get the "compressed folders" feature for some weird reason, but you can install the files from Win98/ME and it should work (never tried it myself). See guide HERE .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
gte Posted November 3, 2009 Share Posted November 3, 2009 Thanks AdmiralIt does not work, I see the tutorial was written in 2009, but the files it suggests are not available, I could only find the XP sp2 version of the kb329048, so I can't even get the files to try.I checked the dlldump site and tried to use those, and that did not work.If anyone has any ideas on how to make this work, I've put tons of time into this app, and without this function it's pretty much worthless.Windows 2000 didn't get the "compressed folders" feature for some weird reason, but you can install the files from Win98/ME and it should work (never tried it myself). See guide HERE HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
gte Posted November 4, 2009 Share Posted November 4, 2009 I found this tonight http://download.microsoft.com/download/Win98/UPDATE/25556/W98/EN-US/329048USA8.EXE I'll have to try it tomorrow Maybe someone has this patch/files referenced in the link Admiral posted on an old winME disc? HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
gte Posted November 4, 2009 Share Posted November 4, 2009 I was able to register these and have the extract function in the windows right click menu This function now fails at this line ... help? Do I need to start a separate thread for this? Local $oOriginFile = $oOriginFolder.ParseName($sFile) ; fails here $oOriginFolder is blank $sFile has an xml value name I ran this on XP and $oOriginFolder was also blank there? Error message is still expandcollapse popup#Include <File.au3> ; Tab 1 Modules ;~ DirCreate(@DesktopDir & "\Extracted") ; to extract to $sPath = "D:\test" $zipfilelist = _FileListToArray($sPath,"*.zip",1) ;~ MsgBox(0, "File List", $zipfilelist[1] & $zipfilelist[2] & $zipfilelist[3] & $zipfilelist[4] & $zipfilelist[5] & $zipfilelist[6] & $zipfilelist[7] & $zipfilelist[8] & $zipfilelist[9] & $zipfilelist[10] & $zipfilelist[11]) for $i = 1 to $zipfilelist[0] Step 1 ;~ MsgBox(0, "$i", $zipfilelist[$i]) Local $xmlname1 Local $xmlname2 $xmlname1 = StringReplace($zipfilelist[$i], ".", "") ;~ MsgBox(0,"xmlname1",$xmlname1) $xmlname2 = StringReplace($xmlname1, "zip", ".xml") ;~ MsgBox(0,"xmlname2",$xmlname2) ;~ MsgBox(0, "extract", "_ExtractZip(D:\dma\fecs\downloadbak\test\" & $zipfilelist[$i] ) _ExtractZip("D:\test\" & $zipfilelist[$i] , "", $xmlname2, "C:\temp\testxmls") ;~ _ExtractZip(@DesktopDir & "\YourZipFile.zip", "SomeFolderWithinOrNothing", "FileOrFolderToExtract.extensionIfEny", @DesktopDir & "\Extracted") ;~ MsgBox(0,0,"END") Next ConsoleWrite(@error & @CRLF) ; #FUNCTION# ;=============================================================================== ; ; Name...........: _ExtractZip ; Description ...: Extracts file/folder from ZIP compressed file ; Syntax.........: _ExtractZip($sZipFile, $sFolderStructure, $sFile, $sDestinationFolder) ; Parameters ....: $sZipFile - full path to the ZIP file to process ; $sFolderStructure - 'path' to the file/folder to extract inside ZIP file ; $sFile - file/folder to extract ; $sDestinationFolder - folder to extract to. Must exist. ; Return values .: Success - Returns 1 ; - Sets @error to 0 ; Failure - Returns 0 sets @error: ; |1 - Shell Object creation failure ; |2 - Destination folder is unavailable ; |3 - Structure within ZIP file is wrong ; |4 - Specified file/folder to extract not existing ; Author ........: trancexx ; ;========================================================================================== Func _ExtractZip($sZipFile, $sFolderStructure, $sFile, $sDestinationFolder) Local $i Do $i += 1 $sTempZipFolder = @TempDir & "\Temporary Directory " & $i & " for " & StringRegExpReplace($sZipFile, ".*\\", "") Until Not FileExists($sTempZipFolder) ; this folder will be created during extraction Local $oShell = ObjCreate("Shell.Application") If Not IsObj($oShell) Then Return SetError(1, 0, 0) ; highly unlikely but could happen EndIf Local $oDestinationFolder = $oShell.NameSpace($sDestinationFolder) If Not IsObj($oDestinationFolder) Then Return SetError(2, 0, 0) ; unavailable destionation location EndIf Local $oOriginFolder = $oShell.NameSpace($sZipFile & "\" & $sFolderStructure) ; FolderStructure is overstatement because of the available depth If Not IsObj($oOriginFolder) Then Return SetError(3, 0, 0) ; unavailable location EndIf ;Local $oOriginFile = $oOriginFolder.Items.Item($sFile) Local $oOriginFile = $oOriginFolder.ParseName($sFile) If Not IsObj($oOriginFile) Then Return SetError(4, 0, 0) ; no such file in ZIP file EndIf ; copy content of origin to destination $oDestinationFolder.CopyHere($oOriginFile, 4) ; 4 means "do not display a progress dialog box", but apparently doesn't work DirRemove($sTempZipFolder, 1) ; clean temp dir Return 1 ; All OK! EndFunc I found this tonight http://download.microsoft.com/download/Win98/UPDATE/25556/W98/EN-US/329048USA8.EXE I'll have to try it tomorrow Maybe someone has this patch/files referenced in the link Admiral posted on an old winME disc? HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
gte Posted November 4, 2009 Share Posted November 4, 2009 Ok Apparently it can't read the zip file files, but it can count the number of items? It appears in 2k3, the zip file is treated just like a folder, where in 2k, it's still a file and a precursor operation to the file copy needs to be function zip open, then zip copy/extract HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
gte Posted November 4, 2009 Share Posted November 4, 2009 When you try and browse to it, it just displays emptiness, windows 2000 server cannot treat the zip file as a folder, but win2k3 can, which is why this function fails on 2k boxes HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted November 4, 2009 Share Posted November 4, 2009 Maybe the zip file is in a format that Windows can't handle? (I have no Win2000 to test with).Have you thought about going an alternative way, maybe something like 7Zip UDF? (just an idea, I never used it myself so don't know if it is any good) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
trancexx Posted November 4, 2009 Share Posted November 4, 2009 Here's the thing. You obviously can't copy zipfldr.dll from XP (or whatever) to win2k for it to work properly. Your attempt to register it Run("regsvr32.exe zipfldr.dll") fails. It's failing because zipfldr.dll have imported functions from other dlls that are not found on win2k. To find which one for start run DllOpen("zipfldr.dll") That doesn't mean it can't be used, just requires additional work. That of course also means that it may just not work at all . Post the error message you get when you run suggested code on win2k. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
gte Posted November 4, 2009 Share Posted November 4, 2009 The error message my program gives is the following I'm not sure what you are looking for with the dllopen, but I ran this code and $dllinfo = 1 and $result = 0 $dllinfo = DllOpen("c:\winnt\system32\zipfldr.dll") $result = DllCall($dllinfo, "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "int", 0) MsgBox(0, 0, $dllinfo) MsgBox(0, 0, $result) Here's the thing. You obviously can't copy zipfldr.dll from XP (or whatever) to win2k for it to work properly. Your attempt to register it Run("regsvr32.exe zipfldr.dll") fails. It's failing because zipfldr.dll have imported functions from other dlls that are not found on win2k. To find which one for start run DllOpen("zipfldr.dll") That doesn't mean it can't be used, just requires additional work. That of course also means that it may just not work at all . Post the error message you get when you run suggested code on win2k. HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
trancexx Posted November 4, 2009 Share Posted November 4, 2009 The error message my program gives is the following I'm not sure what you are looking for with the dllopen, but I ran this code and $dllinfo = 1 and $result = 0 $dllinfo = DllOpen("c:\winnt\system32\zipfldr.dll") $result = DllCall($dllinfo, "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "int", 0) MsgBox(0, 0, $dllinfo) MsgBox(0, 0, $result) I didn't ask that. Run this on win2k. And don't change anything: RunWait("regsvr32.exe zipfldr.dll") MsgBox(0,'DllOpen',DllOpen("zipfldr.dll")) Show what you get. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted November 4, 2009 Share Posted November 4, 2009 (edited) DllCall returns an array, you can't check it like that! $result = DllCall($dllinfo, "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "int", 0) _ArrayDisplay($result) But I don't think that was what trancexx meant.... Edit: yep I was right Edited November 4, 2009 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
gte Posted November 5, 2009 Share Posted November 5, 2009 It has a box that says it was successfully registered, and then this HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
trancexx Posted November 5, 2009 Share Posted November 5, 2009 It has a box that says it was successfully registered, and then thisThat means you can use the function and there shouldn't be any problems.PM that you send me, on the other hand, shows different situation, error while registering. Confusing. You. ♡♡♡ . eMyvnE 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