<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: RegFile2Ahk Converter помощь]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=12060</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=12060&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: RegFile2Ahk Converter помощь».]]></description>
		<lastBuildDate>Tue, 04 Oct 2016 19:14:47 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: RegFile2Ahk Converter помощь]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=108214#p108214</link>
			<description><![CDATA[<div class="quotebox"><cite>freeZer0K пишет:</cite><blockquote><p>AHK: RegFile2Ahk Converter помощь</p></blockquote></div><p><span style="color: green"><strong>freeZer0K</strong>, <a href="http://forum.script-coding.com/viewtopic.php?id=5421">обратите внимание</a> на список слов, которые не следует употреблять в заголовках, приведите в порядок.</span></p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Tue, 04 Oct 2016 19:14:47 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=108214#p108214</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: RegFile2Ahk Converter помощь]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=108209#p108209</link>
			<description><![CDATA[<div class="quotebox"><cite>freeZer0K пишет:</cite><blockquote><p>Единственное что, этот шаблон бреет напрочь все</p></blockquote></div><p>А я спецом так сделал. Не понял, какой смысл в кавычках в первом пути, если их нет во втором.</p>]]></description>
			<author><![CDATA[null@example.com (Flasher)]]></author>
			<pubDate>Tue, 04 Oct 2016 15:35:34 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=108209#p108209</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: RegFile2Ahk Converter помощь]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=108208#p108208</link>
			<description><![CDATA[<p><strong>Malcev</strong> !!! СПАСИБЫ !!! - ВОТ ТАКОЙ!</p><p>Немного не додумал шаблон .... теперь все намана!</p>]]></description>
			<author><![CDATA[null@example.com (freeZer0K)]]></author>
			<pubDate>Tue, 04 Oct 2016 12:26:31 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=108208#p108208</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: RegFile2Ahk Converter помощь]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=108207#p108207</link>
			<description><![CDATA[<div class="codebox"><pre><code>msgbox % VType := RegExReplace(VType, &quot;`a)&quot;&quot;(.*)&quot;&quot;=&quot;&quot;\\?(.+?)\\?&quot;&quot;&quot;, &quot;RegWrite REG_SZ, RegPath, $1, $2&quot;)</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 04 Oct 2016 12:22:13 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=108207#p108207</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: RegFile2Ahk Converter помощь]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=108206#p108206</link>
			<description><![CDATA[<p><strong>Malcev</strong>, благодарю, я так уже тестил - тоже оставляет последний \ , затем нужная &quot; ...</p><p>Думаю, не плавить мозги, все-равно пути потом менять на переменные в формат ahk, а в них добавить везде двойные кавычки , т.к. без &quot; винда обычно всегда лягается.</p>]]></description>
			<author><![CDATA[null@example.com (freeZer0K)]]></author>
			<pubDate>Tue, 04 Oct 2016 12:01:50 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=108206#p108206</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: RegFile2Ahk Converter помощь]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=108205#p108205</link>
			<description><![CDATA[<div class="codebox"><pre><code>msgbox % VType := RegExReplace(VType, &quot;`a)&quot;&quot;(.*)&quot;&quot;=&quot;&quot;\\?(.+)\\?&quot;&quot;&quot;, &quot;RegWrite REG_SZ, RegPath, $1, $2&quot;)</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 04 Oct 2016 11:53:51 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=108205#p108205</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: RegFile2Ahk Converter помощь]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=108204#p108204</link>
			<description><![CDATA[<p>Блоагодарю, <strong>Flasher</strong>!<br />Единственное что, этот шаблон бреет напрочь все &quot;, а хотелось бы их оставить там, где путь указан с двойными кавычками, типа:<br />&quot;C:\\Program Files\\Notepad++\\notepad++.exe&quot;</p><p>В оригинале это строка 1 в переменной VType.</p><p>В строке 2 путь указан без &quot;<br />C:\\Program Files\\Registry Workshop\\RegWorkshop.exe</p><p>Благодарю за помощь!</p>]]></description>
			<author><![CDATA[null@example.com (freeZer0K)]]></author>
			<pubDate>Tue, 04 Oct 2016 11:43:32 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=108204#p108204</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: RegFile2Ahk Converter помощь]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=108201#p108201</link>
			<description><![CDATA[<p><strong>freeZer0K</strong><br />Такое выражение: <strong>&quot;`amU)&quot;&quot;(.*)&quot;&quot;=&quot;&quot;[&quot;&quot;\\]*?(.+)\\?&quot;&quot;*$&quot;</strong></p>]]></description>
			<author><![CDATA[null@example.com (Flasher)]]></author>
			<pubDate>Tue, 04 Oct 2016 10:54:48 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=108201#p108201</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: RegFile2Ahk Converter помощь]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=108200#p108200</link>
			<description><![CDATA[<p>1) Почитать как добавляются по-дефалту новые строки в continuation section.<br />2) Почитать про опцию s) в регулярных выражениях.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 04 Oct 2016 09:55:47 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=108200#p108200</guid>
		</item>
		<item>
			<title><![CDATA[AHK: RegFile2Ahk Converter помощь]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=108199#p108199</link>
			<description><![CDATA[<p>Добрый день!</p><p>Начал скрипт - конвертер регфайлов (*.reg) в *.ahk и столкнулся с некоторыми проблемами.</p><p>Код скрипта:</p><div class="codebox"><pre><code>
#NoEnv
#NoTrayIcon
#SingleInstance force
SendMode Input
SetBatchLines -1

If !A_IsAdmin
	{
	Run % &quot;*RunAs &quot;&quot;&quot; A_ScriptFullPath &quot;&quot;&quot;&quot;
	ExitApp
	}
	
ProgramName := &quot;RegFile2Ahk Converter&quot;
/*
; SourceDir изменить

GetRegFile:
Title := &quot;Выбор файла реестра для конвертирования&quot;
FileSelectFile RegFile, 3, % SourceDir, % Title, Файлы реестра (*.reg)
If !RegFile
	{
	MsgBox 0x34, % ProgramName, Файл реестра не выбран!`n`nПовторить?
	IfMsgBox Yes
		{
		GoTo GetRegFile
		}
	IfMsgBox No
		{
		ExitApp
		}
	}
*/	
RegFile := A_ScriptDir &quot;\REGISTRY-TEST.reg&quot; ; строка к финальному удалению!

FileRead VType, % RegFile

; удаление Windows Registry Editor Version 5.00
VType := RegExReplace(VType, &quot;i)Windows Registry Editor Version.*?(\R+|$)&quot;)

; удаление пустых значений (по-умолчанию)
VType := RegExReplace(VType, &quot;@=&quot;&quot;&quot;&quot;(\R+|$)&quot;)

; @=&quot;бубль гум&quot; по-умолчанию (marker @=&quot;&quot; &gt; REG_SZ)
VType := RegExReplace(VType, &quot;@=&quot;&quot;(.*)&quot;&quot;&quot;, &quot;RegWrite REG_SZ, RegPath,, $1&quot;)

; &quot;this_is_REG_SZ&quot;=&quot;C:\\Program Files\\Registry Workshop\\RegWorkshop.exe&quot; (marker   =&quot; &gt; REG_SZ)
VType := RegExReplace(VType, &quot;&quot;&quot;(.*)&quot;&quot;=&quot;&quot;(.*)&quot;&quot;&quot;, &quot;RegWrite REG_SZ, RegPath, $1, $2&quot;)

; &quot;this_is_REG_DWORD&quot;=dword:00477579 (marker   =dword: &gt; REG_DWORD)
VType := RegExReplace(VType, &quot;&quot;&quot;(.*)&quot;&quot;=dword:(\d+)&quot;, &quot;RegWrite REG_DWORD, RegPath, $1, $2&quot;)

; &quot;this_is_REG_BINARY&quot;=hex:34,37,37,35,\ (marker   =hex: &gt; REG_BINARY)   !!!!!!!!!!
VType := RegExReplace(VType, &quot;&quot;&quot;(.*)&quot;&quot;=hex:(.*)\\(\R\s+|$)&quot;, &quot;RegWrite REG_BINARY, RegPath, $1, $2&quot;)

; &quot;this_is_REG_MULTI_SZ&quot;=hex(7):33,00,38,00,\ (marker   =hex(7): &gt; REG_MULTI_SZ)
VType := RegExReplace(VType, &quot;&quot;&quot;(.*)&quot;&quot;=hex\(7\):(.*)\\&quot;, &quot;RegWrite REG_MULTI_SZ, RegPath, $1, $2&quot;)

; &quot;this_is_REG_EXPAND_SZ&quot;=hex(2):22,00,43,00,\ (marker   =hex(2): &gt; REG_EXPAND_SZ)
VType := RegExReplace(VType, &quot;&quot;&quot;(.*)&quot;&quot;=hex\(2\):(.*)\\&quot;, &quot;RegWrite REG_EXPAND_SZ, RegPath, $1, $2&quot;)

; &quot;this_is_REG_QWORD&quot;=hex(b):34,37,37,35 (marker   =hex(b): &gt; REG_QWORD)
VType := RegExReplace(VType, &quot;&quot;&quot;(.*)&quot;&quot;=hex\(b\):(\d+)&quot;, &quot;RegWrite REG_QWORD, RegPath, $1, $2&quot;)

; удаляемые разделы
VType := RegExReplace(VType, &quot;i)\[-(HKEY_\w+)\\(.*)\](\R|$)&quot;, &quot;RegDelete $1, $2`n&quot;)
; удаляемые параметры
VType := RegExReplace(VType, &quot;m`a)(@=-.*)|(&quot;&quot;.*&quot;&quot;=-.*)&quot;, &quot;;$1$2`t- удаление параметров запрещено в Windows 10&quot;)


Loop parse, % VType, `n, `r
	{
	Loop
		{
		If A_LoopField contains [HKEY_
			{
			NewRegPath := RegPath(RegPathAhk) ; преобразование path реестра в формат ahk
			break
			}
			Else
				{
				RegStrAhk := A_LoopField
				If InStr(RegStrAhk, &quot;\\&quot;) ; замена double backslash на один и удаление \&quot; \&quot;  (проверить после правки шаблонов)
					{
					RegStrAhk := RegExReplace(StrReplace(RegStrAhk, &quot;\\&quot;, &quot;\&quot;, &quot;All&quot;), &quot;(.*)\\&quot;&quot;(\w:\\.*)\\&quot;&quot;&quot;, &quot;$1$2&quot;)
					}
				If InStr(RegStrAhk, &quot;Program Files&quot;) ; замена C:\Program Files на переменную
					{
					RegStrAhk := RegExReplace(RegStrAhk, &quot;(.*)\w:\\Program Files(.*)&quot;, &quot;$1 % ProgramFiles &quot;&quot;$2&quot;&quot;&quot;)
					}
				RegStrAhk := StrReplace(RegStrAhk, &quot;RegPath&quot;, NewRegPath, &quot;All&quot;) ; замена marker &quot;RegPath&quot; на реальный path AHK
				GoSub Print
				break
				}
		}
	}
	
ExitApp

Print:
SplitPath RegFile,,,, RegFileNoExt
FileAppend
	(
	% RegStrAhk &quot;`n&quot;
	), % RegFileNoExt &quot;.ahk&quot;, UTF-8
return

; functions
RegPath(RegPathAhk)
	{
	RegPathAhk := RegExReplace(A_LoopField, &quot;i)\[HKEY_CLASSES_ROOT\\(.*)\]&quot;, &quot;HKCR, $1&quot;)
	RegPathAhk := RegExReplace(RegPathAhk, &quot;i)\[HKEY_CURRENT_USER\\(.*)\]&quot;, &quot;HKCU, $1&quot;)
	RegPathAhk := RegExReplace(RegPathAhk, &quot;i)\[HKEY_LOCAL_MACHINE\\(.*)\]&quot;, &quot;HKLM, $1&quot;)
	Return RegPathAhk
	}
</code></pre></div><p>Тестовый файл реестра REGISTRY-TEST.reg:</p><div class="codebox"><pre><code>Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\TEST-1]
&quot;this_is_REG_SZ-1&quot;=&quot;\&quot;C:\\Program Files\\Notepad++\\notepad++.exe\&quot;&quot;
&quot;this_is_REG_SZ-2&quot;=&quot;C:\\Program Files\\Registry Workshop\\RegWorkshop.exe&quot;
&quot;this_is_REG_SZ-3&quot;=&quot;Shutdown;Reboot;Hibernate;LogOff&quot;</code></pre></div><br /><p>Тестовый код:</p><div class="codebox"><pre><code>VType =
(
&quot;this_is_REG_SZ-1&quot;=&quot;\&quot;C:\\Program Files\\Notepad++\\notepad++.exe\&quot;&quot;
&quot;this_is_REG_SZ-2&quot;=&quot;C:\\Program Files\\Registry Workshop\\RegWorkshop.exe&quot;
&quot;this_is_REG_SZ-3&quot;=&quot;Shutdown;Reboot;Hibernate;LogOff&quot;
)

msgbox % VType := RegExReplace(VType, &quot;`a)&quot;&quot;(.*)&quot;&quot;=&quot;&quot;\\?(.*)&quot;&quot;&quot;, &quot;RegWrite REG_SZ, RegPath, $1, $2&quot;)</code></pre></div><br /><p>Дает такой результат:</p><div class="codebox"><pre><code>
RegWrite REG_SZ, RegPath, this_is_REG_SZ-1, &quot;C:\\Program Files\\Notepad++\\notepad++.exe\&quot;
RegWrite REG_SZ, RegPath, this_is_REG_SZ-2, C:\\Program Files\\Registry Workshop\\RegWorkshop.exe
RegWrite REG_SZ, RegPath, this_is_REG_SZ-3, Shutdown;Reboot;Hibernate;LogOff
</code></pre></div><p>Задача этого шаблона преобразовать все строки переменной VType в такие:</p><div class="codebox"><pre><code>RegWrite REG_SZ, RegPath, this_is_REG_SZ-1, &quot;C:\\Program Files\\Notepad++\\notepad++.exe&quot;
RegWrite REG_SZ, RegPath, this_is_REG_SZ-2, C:\\Program Files\\Registry Workshop\\RegWorkshop.exe
RegWrite REG_SZ, RegPath, this_is_REG_SZ-3, Shutdown;Reboot;Hibernate;LogOff</code></pre></div><p>Как удалить последний \ в строке ... notepad++.exe\&quot;?</p>]]></description>
			<author><![CDATA[null@example.com (freeZer0K)]]></author>
			<pubDate>Tue, 04 Oct 2016 09:15:35 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=108199#p108199</guid>
		</item>
	</channel>
</rss>
