<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBScript: Извлечь файл из zip-архива средствами Win.Explorer]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=8500&amp;type=atom" />
	<updated>2013-12-20T05:38:44Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=8500</id>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Извлечь файл из zip-архива средствами Win.Explorer]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78299#p78299" />
			<content type="html"><![CDATA[<p>Добрый день</p><p>Недавно прикрутил себе скрипт для упаковки файлов в zip архив, все работает классно )<br />Теперь задачка усложняется, нужно принимать и рапаковывать запароленные zip архивы, почитал форум и таких примеров не нашел, неужели никак не передать пароль в &quot;Shell.Application&quot;?</p>]]></content>
			<author>
				<name><![CDATA[Raul]]></name>
			</author>
			<updated>2013-12-20T05:38:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78299#p78299</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Извлечь файл из zip-архива средствами Win.Explorer]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=74003#p74003" />
			<content type="html"><![CDATA[<p>Нашел на просторах интернета готовую функцию на VBS для извлечения файлов&nbsp; из zip-архива</p><p>Она, кстати, может быть использована также просто для копирования файлов с выводом &quot;термометра&quot; <br />(progress bar)</p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><div class="codebox"><pre><code>
Sub Extract( ByVal myZipFile, ByVal myTargetDir )
&#039; Function to extract all files from a compressed &quot;folder&quot;
&#039; (ZIP, CAB, etc.) using the Shell Folders&#039; CopyHere method
&#039; (http://msdn2.microsoft.com/en-us/library/ms723207.aspx).
&#039; All files and folders will be extracted from the ZIP file.
&#039; A progress bar will be displayed, and the user will be
&#039; prompted to confirm file overwrites if necessary.
&#039;
&#039; Note:
&#039; This function can also be used to copy &quot;normal&quot; folders,
&#039; if a progress bar and confirmation dialog(s) are required:
&#039; just use a folder path for the &quot;myZipFile&quot; argument.
&#039;
&#039; Arguments:
&#039; myZipFile    [string]  the fully qualified path of the ZIP file
&#039; myTargetDir  [string]  the fully qualified path of the (existing) destination folder
&#039;
&#039; Based on an article by Gerald Gibson Jr.:
&#039; http://www.codeproject.com/csharp/decompresswinshellapics.asp
&#039;
&#039; Written by Rob van der Woude
&#039; http://www.robvanderwoude.com

    Dim intOptions, objShell, objSource, objTarget

    &#039; Create the required Shell objects
    Set objShell = CreateObject( &quot;Shell.Application&quot; )

    &#039; Create a reference to the files and folders in the ZIP file
    Set objSource = objShell.NameSpace( myZipFile ).Items( )

    &#039; Create a reference to the target folder
    Set objTarget = objShell.NameSpace( myTargetDir )

    &#039; These are the available CopyHere options, according to MSDN
    &#039; (http://msdn2.microsoft.com/en-us/library/ms723207.aspx).
    &#039; On my test systems, however, the options were completely ignored.
    &#039;      4: Do not display a progress dialog box.
    &#039;      8: Give the file a new name in a move, copy, or rename
    &#039;         operation if a file with the target name already exists.
    &#039;     16: Click &quot;Yes to All&quot; in any dialog box that is displayed.
    &#039;     64: Preserve undo information, if possible.
    &#039;    128: Perform the operation on files only if a wildcard file
    &#039;         name (*.*) is specified.
    &#039;    256: Display a progress dialog box but do not show the file
    &#039;         names.
    &#039;    512: Do not confirm the creation of a new directory if the
    &#039;         operation requires one to be created.
    &#039;   1024: Do not display a user interface if an error occurs.
    &#039;   4096: Only operate in the local directory.
    &#039;         Don&#039;t operate recursively into subdirectories.
    &#039;   8192: Do not copy connected files as a group.
    &#039;         Only copy the specified files.
    intOptions = 256

    &#039; UnZIP the files
    objTarget.CopyHere objSource, intOptions

    &#039; Release the objects
    Set objSource = Nothing
    Set objTarget = Nothing
    Set objShell  = Nothing
End Sub 

</code></pre></div></div></div><p>В общем-то все делается относительно просто через метод .NameSpace объекта Shell.Application, и в то же время&nbsp; для меня оказалось пара небольших проблем:<br />1. Метод .CopyHere игнорируют все эти опции типа <em>&quot;Do not display a user interface if an error occur&quot; </em> при извлечении файлов из Zip архива, ну допустим это можно обойти путем извлечением сперва во временный каталог, а потом уже перемещением в нужный каталог...<br />2. Функция (как и проводник) может работать с&nbsp; архивом, только если расширение у файла ZIP <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" /> - вот с этим уже сложней (для меня), можно конечно скопировать файл и поменять расширение, опять же при условии, если&nbsp; архив небольшой по размеру</p><p>Короче я для себя решил - проще использовать внешние утилиты unzip.exe/WinRar через Shell.Run</p><p>PS: <strong>alexii</strong> у меня не получилось заставить работать примеры г-на <strong>Rumata</strong>, а поскольку я не силен в JavaScript, то мне было проще найти примеры на VBS</p>]]></content>
			<author>
				<name><![CDATA[yuriy2000]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25753</uri>
			</author>
			<updated>2013-07-23T13:47:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=74003#p74003</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBScript: Извлечь файл из zip-архива средствами Win.Explorer]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=73997#p73997" />
			<content type="html"><![CDATA[<p><strong>yuriy2000</strong>, формат *.wsf (<a href="http://forum.script-coding.com/viewtopic.php?id=1149">WSH: пишем сценарии в формате WSF</a>) с лёгкостью позволяет совмещать VBScript и JScript. По поводу <em>общего</em> непонимания ничем помочь не могу. По поводу <em>конкретного</em> — не ранее, чем увижу конкретизацию непонятого.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2013-07-23T00:24:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=73997#p73997</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VBScript: Извлечь файл из zip-архива средствами Win.Explorer]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=73992#p73992" />
			<content type="html"><![CDATA[<p>Коллеги!</p><p>Подскажите как, средствами VBScript проверить содержимое zip-архива (получить список файлов),&nbsp; и извлечь файл без привлечения внешних утилит типа WinRar, 7-zip и прочие...</p><p>Прочитал тему <a href="http://script-coding.com/forum/viewtopic.php?id=7124">здесь</a>, но не понял, к тому же там JScript.</p>]]></content>
			<author>
				<name><![CDATA[yuriy2000]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25753</uri>
			</author>
			<updated>2013-07-22T15:53:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=73992#p73992</id>
		</entry>
</feed>
