<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Распаковка запароленного zip-архива]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13275&amp;type=atom" />
	<updated>2017-12-07T12:10:59Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=13275</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Распаковка запароленного zip-архива]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=122027#p122027" />
			<content type="html"><![CDATA[<p>Проблема не только в мелькании, а еще в том, что активное в данный момент окно на какое-то время теряет активность. В общем, не очень красивое решение.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-12-07T12:10:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=122027#p122027</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Распаковка запароленного zip-архива]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=122024#p122024" />
			<content type="html"><![CDATA[<p>Почему жуть?</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-12-07T08:35:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=122024#p122024</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Распаковка запароленного zip-архива]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=122020#p122020" />
			<content type="html"><![CDATA[<p>Title ведь зависит от локали. Если класса и активации недостаточно, чтобы выделить конкретное окно, лучше использовать стили.<br />Через хук окно ловится быстрее, чем WinWait, плюс можно сразу делать окно прозрачным, но все это не избавит полностью от мелькания. Впрочем, я на совсем другом окне испытывал.<br /></p><div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>вставлять снимок экрана</p></blockquote></div><p>Жуть какая-то.</p>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2017-12-07T08:25:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=122020#p122020</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Распаковка запароленного zip-архива]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=122018#p122018" />
			<content type="html"><![CDATA[<p>Чтобы окно не мелькало можно попробовать отлавливать его создание через хук (не пробовал).<br />Либо вставлять снимок экрана и уже под ним посылать пароль.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-12-07T07:27:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=122018#p122018</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Распаковка запароленного zip-архива]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=122017#p122017" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Это ж нужно заранее название и путь файла в архиве знать.</p></blockquote></div><p>Хм, а вот так не нужно, и проще:<br /></p><div class="codebox"><pre><code>UnZip(A_ScriptDir . &quot;\test.zip&quot;, A_ScriptDir . &quot;\Files&quot;, &quot;1234&quot;)

UnZip(zipFile, targetFolder, password := &quot;&quot;, dialogTitle := &quot;Ввод пароля&quot;)  {
   static info := {}
   if password  {
      info.timerID := DllCall(&quot;SetTimer&quot;, Ptr, 0, Ptr, 0, UInt, 50
                                        , Ptr, RegisterCallback( &quot;EnterPassword&quot;, &quot;F&quot;,, ptr := Object(info) ))
      info.password := password, info.dialogTitle := dialogTitle
      info.myPID := DllCall(&quot;GetCurrentProcessId&quot;)
      ObjRelease(ptr)
   }
   if !InStr( FileExist(targetFolder), &quot;D&quot; )
      FileCreateDir, % targetFolder
   oShell := ComObjCreate(&quot;Shell.Application&quot;)
   items := oShell.NameSpace(zipFile).Items
   oShell.NameSpace(targetFolder).CopyHere(items)
}

EnterPassword()  {
   info := Object(A_EventInfo)
   IfWinExist, % info.dialogTitle . &quot; ahk_class #32770 ahk_pid &quot; . info.myPID
   {
      DllCall(&quot;KillTimer&quot;, Ptr, 0, Ptr, info.timerID)
      ControlSetText, Edit1, % info.password
      ControlClick, Button1
   }
}</code></pre></div><div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Без использования сторонних приложений не получится.</p></blockquote></div><p>Сначала так же пробовал, но, видимо, вместо zip в rar запаковал.<br />Но всё равно костыль — окно ввода пароля мелькает!</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-12-07T04:57:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=122017#p122017</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Распаковка запароленного zip-архива]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=122016#p122016" />
			<content type="html"><![CDATA[<p>Работает, можно без запуска второго скрипта:<br /></p><div class="codebox"><pre><code>UnZip(A_ScriptDir . &quot;\test.zip\test.txt&quot;, A_ScriptDir . &quot;\Files&quot;, &quot;1234&quot;)

UnZip(zippedFile, targetFolder, password, dialogTitle := &quot;Ввод пароля&quot;)  {
   static info := {}
   
   info.timerID := DllCall(&quot;SetTimer&quot;, Ptr, 0, Ptr, 0, UInt, 50
                                     , Ptr, RegisterCallback( &quot;EnterPassword&quot;, &quot;F&quot;,, ptr := Object(info) ))
   info.password := password, info.dialogTitle := dialogTitle
   info.myPID := DllCall(&quot;GetCurrentProcessId&quot;)
   ObjRelease(ptr)

   oShell := ComObjCreate(&quot;Shell.Application&quot;)
   oFSO := ComObjCreate(&quot;Scripting.FileSystemObject&quot;)
   oSourceFolder := oShell.NameSpace( oFSO.GetParentFolderName(zippedFile) )
   oSourceFolderItem := oSourceFolder.ParseName( oFSO.GetFileName(zippedFile) )
   oTargetFolder := oShell.NameSpace(targetFolder)
   oTargetFolder.CopyHere(oSourceFolderItem)
}

EnterPassword()  {
   info := Object(A_EventInfo)
   IfWinExist, % info.dialogTitle . &quot; ahk_class #32770 ahk_pid &quot; . info.myPID
   {
      DllCall(&quot;KillTimer&quot;, Ptr, 0, Ptr, info.timerID)
      ControlSetText, Edit1, % info.password
      ControlClick, Button1
   }
}</code></pre></div><p>Но костыль, конечно! <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> Это ж нужно заранее название и путь файла в архиве знать. А если их там сотня?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-12-07T04:29:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=122016#p122016</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Распаковка запароленного zip-архива]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=122013#p122013" />
			<content type="html"><![CDATA[<p><a href="http://forum.script-coding.com/viewtopic.php?id=12451">AHK: Распаковка Zip-архива</a><br /><a href="http://forum.script-coding.com/viewtopic.php?id=296">WSH: архивация файлов средствами операционной системы (WinXP)</a></p><p>Пароль можно ввести средствами AHK:<br /></p><div class="codebox"><pre><code>DIALOG_TITLE = Ввод пароля
SourceFullPath = %1% ; Путь к извлекаемому файлу в архиве
	; (например, &quot;D:\test.zip\test\1.pdf&quot; означает, что
	; в архиве D:\test.zip находится каталог test c файлом 1.pdf)
TargetDirPath = %2% ; Путь к целевому каталогу
	; (предполагается, что он уже существует).
	; Пути не должны завершаться на &quot;\&quot;.
Password = %3% ; Пароль (если нужен).

if (Password)
	goto 2

FSO := ComObjCreate(&quot;Scripting.FileSystemObject&quot;)
Shell := ComObjCreate(&quot;Shell.Application&quot;)
SourceFolder := Shell.NameSpace(FSO.GetParentFolderName(SourceFullPath))
SourceFolderItem := SourceFolder.ParseName(FSO.GetFileName(SourceFullPath))
TargetFolder := Shell.NameSpace(TargetDirPath)
TargetFolder.CopyHere(SourceFolderItem)
Exit

2:
Run % (A_IsCompiled ? &quot;&quot; : (&quot;&quot;&quot;&quot; A_AhkPath &quot;&quot;&quot; &quot;)) &quot;&quot;&quot;&quot; A_ScriptFullPath &quot;&quot;&quot;&quot;
		. &quot; &quot;&quot;&quot; SourceFullPath &quot;&quot;&quot; &quot;&quot;&quot; TargetDirPath &quot;&quot;&quot;&quot;
	,,, PID
WinWait %DIALOG_TITLE% ahk_pid %PID%
ControlSetText Edit1, %Password%
ControlClick Button1
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[wisgest]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=3850</uri>
			</author>
			<updated>2017-12-07T00:41:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=122013#p122013</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Распаковка запароленного zip-архива]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=121994#p121994" />
			<content type="html"><![CDATA[<p>Без использования сторонних приложений не получится. Если установлен какой-либо архиватор, можно использовать его через AHK командой </p><div class="codebox"><pre><code>Run, [командная строка]</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-12-06T07:36:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=121994#p121994</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Распаковка запароленного zip-архива]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=121993#p121993" />
			<content type="html"><![CDATA[<p>Доброго времени суток, товарищи!<br />Есть такой вопрос, к знающим товарищам на ура AutoHotkey<br />Можно ли средствами AutoHotkey распаковать запароленный zip архив?</p>]]></content>
			<author>
				<name><![CDATA[korolev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38919</uri>
			</author>
			<updated>2017-12-06T07:08:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=121993#p121993</id>
		</entry>
</feed>
