Adrive Posted July 2, 2010 Author Posted July 2, 2010 Thanks for the alternatives but none of them have Func _Zip_AddFolderContents() how do i add contents of a folder to a zip file invisible mode? i have added some new lines in function and now it shows the window only for 1 second. Func _Zip_AddFolderContents($hZipFile, $hFolder, $flag = 1) Local $DLLChk = _Zip_DllChk() If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file If StringRight($hFolder, 1) <> "\" Then $hFolder &= "\" $files = _Zip_Count($hZipFile) WinSetState("Compressing...", "", @SW_HIDE) $oApp = ObjCreate("Shell.Application") WinSetState("Compressing...", "", @SW_HIDE) $oFolder = $oApp.NameSpace($hFolder) WinSetState("Compressing...", "", @SW_HIDE) $oCopy = $oApp.NameSpace($hZipFile).CopyHere($oFolder.Items, 1028) WinSetState("Compressing...", "", @SW_HIDE) $oFC = $oApp.NameSpace($hFolder).items.count WinSetState("Compressing...", "", @SW_HIDE) While 1 WinSetState("Compressing...", "", @SW_HIDE) If $flag = 1 then _Hide() If _Zip_Count($hZipFile) = ($files+$oFC) Then ExitLoop Sleep(10) WEnd Return SetError(0,0,1) EndFunc ;==>_Zip_AddFolderContents but still not perfect, and the Alternative UDFs does not have _Zip_AddFolderContents()
wraithdu Posted July 2, 2010 Posted July 2, 2010 (edited) The 'Compressing...' window is not the same as the progress dialog in my testing. I have been unable to properly suppress that window. The progress dialog is suppressed, for example, when extracting a zip file. I believe the 'Compressing...' window is created by the zipfldr.dll library, while the true progress dialog is created (or suppressed) by the shell itself. Edited July 2, 2010 by wraithdu
SublimePorte Posted July 4, 2010 Posted July 4, 2010 (edited) Adrive, i changed the line as suggested, but the result is same as before. the documentation which you provided, i have read that too. now i am totally confused what to do. any one please help if you can. Works fine here. Are you sure you modified it accordingly? Here's the modified function from the UDF: Func _Zip_AddFolderContents($hZipFile, $hFolder, $flag = 0) Local $DLLChk = _Zip_DllChk() If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file If StringRight($hFolder, 1) <> "\" Then $hFolder &= "\" $files = _Zip_Count($hZipFile) $oApp = ObjCreate("Shell.Application") $oFolder = $oApp.NameSpace($hFolder) $oCopy = $oApp.NameSpace($hZipFile).CopyHere($oFolder.Items, $flag) $oFC = $oApp.NameSpace($hFolder).items.count While 1 If _Zip_Count($hZipFile) = ($files+$oFC) Then ExitLoop Sleep(10) WEnd Return SetError(0,0,1) EndFunc ;==>_Zip_AddFolderContents Note the line that calls _Hide is removed, as it's pointless. And that the CopyHere() call now passes $flag, and that $flag's default value is now 0. Now to use this function, pass it the flags you want to use, which in your case is the value 4 (there's many other options too). And here is a sample call to the function: #include <Zip.au3> _Zip_AddFolderContents("c:\test.zip", "c:\tmp", 4) Works perfect on my end, no copy progress dialog. removing the flag brings the dialog back. Also note that if the files exist, you'll still get a prompt saying the files exist, in which case you need to use the flag value: 20 which answers yes to all dialog questions and suppresses the progress. Edited July 4, 2010 by SublimePorte
Moderators Melba23 Posted July 4, 2010 Moderators Posted July 4, 2010 SublimePorte, Of interest, what OS are you using? As wraithdu has pointed out above, the dialog appears to come from different places depending on OS. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
SublimePorte Posted July 5, 2010 Posted July 5, 2010 (edited) Vista SP1 X64. I really don't see why it shouldn't work. Yes the UDF is bodged, and could most likely cause different results on different platforms, but not once it's fixed, it shouldn't. Edited July 5, 2010 by SublimePorte
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