<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Работа с текстом]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6939&amp;type=atom" />
	<updated>2012-03-18T09:59:16Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6939</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Работа с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=58010#p58010" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong> <br />Большое Спасибо за помощь новичку.</p>]]></content>
			<author>
				<name><![CDATA[shveicar]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27736</uri>
			</author>
			<updated>2012-03-18T09:59:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=58010#p58010</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Работа с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=58005#p58005" />
			<content type="html"><![CDATA[<p>С буфером обмена как-раз таки работает.<br />Просто в конце скрипта надо добавить комманду рефреша Тотал Командера - Reread Source - Ctrl+R</p><div class="codebox"><pre><code>f11::
clipboard =
Send, ^{vk43}   ; Ctrl + C
ClipWait, 2
if ErrorLevel
{
   MsgBox, Буфер обмена пуст!
   Return
}
Loop, parse, clipboard, `n, `r
{
   FileRead, Text, %clipboard%
   Sort, Text, U
   FileAppend, %Text%, %clipboard%_Target.txt
   Send, ^{vk52}     ; Ctrl + R
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2012-03-17T22:37:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=58005#p58005</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Работа с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=58004#p58004" />
			<content type="html"><![CDATA[<p>Спасибо - <strong>Malcev</strong> <br />С буфером обмена, Мне идея больше нравиться, жаль только не работает, ну буду читать и изучать темы.:rolleyes: Спасибо.</p>]]></content>
			<author>
				<name><![CDATA[shveicar]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27736</uri>
			</author>
			<updated>2012-03-17T22:13:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=58004#p58004</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Работа с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=58002#p58002" />
			<content type="html"><![CDATA[<p><strong>shveicar</strong><br />То, что за основу вы желаете взять код обсуждавшийся в этой теме, не делает ваш вопрос соответствующим заголовку темы.</p><p>Все «недостающие части кода» разобраны в коллекции, очень рекомендую <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2012-03-17T20:47:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=58002#p58002</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Работа с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=58001#p58001" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>f11::
sel := Explorer_GetSelected()
Loop, parse, sel, `n, `r
{
   FileRead, Text, %A_LoopField%
   Sort, Text, U
   FileAppend, %Text%, %A_LoopField%_Target.txt
}
return
 
Explorer_GetPath(hwnd=&quot;&quot;)
{
   if !(window := Explorer_GetWindow(hwnd))
      return ErrorLevel := &quot;ERROR&quot;
   if (window=&quot;desktop&quot;)
      return A_Desktop
   path := window.LocationURL
   path := RegExReplace(path, &quot;ftp://.*@&quot;,&quot;ftp://&quot;)
   StringReplace, path, path, file:///
   StringReplace, path, path, /, \, All
 
   ; thanks to polyethene
   Loop
      If RegExMatch(path, &quot;i)(?&lt;=%)[\da-f]{1,2}&quot;, hex)
         StringReplace, path, path, `%%hex%, % Chr(&quot;0x&quot; . hex), All
      Else Break
   return path
}
Explorer_GetAll(hwnd=&quot;&quot;)
{
   return Explorer_Get(hwnd)
}
Explorer_GetSelected(hwnd=&quot;&quot;)
{
   return Explorer_Get(hwnd,true)
}
 
Explorer_GetWindow(hwnd=&quot;&quot;)
{
   ; thanks to jethrow for some pointers here
    WinGet, process, processName, % &quot;ahk_id&quot; hwnd := hwnd? hwnd:WinExist(&quot;A&quot;)
    WinGetClass class, ahk_id %hwnd%
 
   if (process!=&quot;explorer.exe&quot;)
      return
   if (class ~= &quot;(Cabinet|Explore)WClass&quot;)
   {
      for window in ComObjCreate(&quot;Shell.Application&quot;).Windows
         if (window.hwnd==hwnd)
            return window
   }
   else if (class ~= &quot;Progman|WorkerW&quot;)
      return &quot;desktop&quot; ; desktop found
}
Explorer_Get(hwnd=&quot;&quot;,selection=false)
{
   if !(window := Explorer_GetWindow(hwnd))
      return ErrorLevel := &quot;ERROR&quot;
   if (window=&quot;desktop&quot;)
   {
      ControlGet, hwWindow, HWND,, SysListView321, ahk_class Progman
      if !hwWindow ; #D mode
         ControlGet, hwWindow, HWND,, SysListView321, A
      ControlGet, files, List, % ( selection ? &quot;Selected&quot;:&quot;&quot;) &quot;Col1&quot;,,ahk_id %hwWindow%
      base := SubStr(A_Desktop,0,1)==&quot;\&quot; ? SubStr(A_Desktop,1,-1) : A_Desktop
      Loop, Parse, files, `n, `r
      {
         path := base &quot;\&quot; A_LoopField
         IfExist %path% ; ignore special icons like Computer (at least for now)
            ret .= path &quot;`n&quot;
      }
   }
   else
   {
      if selection
         collection := window.document.SelectedItems
      else
         collection := window.document.Folder.Items
      for item in collection
         ret .= item.path &quot;`n&quot;
   }
   return Trim(ret,&quot;`n&quot;)
}</code></pre></div><p>Или используя буфер обмена</p><div class="codebox"><pre><code>f11::
clipboard =
Send, ^{vk43}   ; Ctrl + C
ClipWait, 2
if ErrorLevel
{
   MsgBox, Буфер обмена пуст!
   Return
}
Loop, parse, clipboard, `n, `r
{
   FileRead, Text, %clipboard%
   Sort, Text, U
   FileAppend, %Text%, %clipboard%_Target.txt
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2012-03-17T20:44:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=58001#p58001</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Работа с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=57998#p57998" />
			<content type="html"><![CDATA[<p>Здравствуйте.<br />Буквально на днях открыл для себя этот замечательный язык. для сравнения - данное действие на vbs занимает целых 22 строчки!!<br />но вот ведь проблема,&nbsp; - после компиляции - мини программа с таким кодом (добавил в скрипт горячую клавишу) обрабатывает только текстовой файл с именем Source.txt и только при условии, что он лежит в той-же папке. Пользуюсь total comander, - подскажите как сделать, чтобы обрабатывался любой выделенный текстовой файл под курсором, и результат сохранялся в ту-же панель (имя готового файла -значения не имеет). Заранее благодарен. Спасибо.</p>]]></content>
			<author>
				<name><![CDATA[shveicar]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27736</uri>
			</author>
			<updated>2012-03-17T20:11:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=57998#p57998</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Работа с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=57859#p57859" />
			<content type="html"><![CDATA[<p>В точку!<br />а то я уже на 70 строк надумал... <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[ilya20069]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26683</uri>
			</author>
			<updated>2012-03-15T06:45:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=57859#p57859</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Работа с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=57854#p57854" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>FileRead, Text, Source.txt
Sort, Text, U
FileAppend, %Text%, Target.txt</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2012-03-15T01:35:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=57854#p57854</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Работа с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=57852#p57852" />
			<content type="html"><![CDATA[<p>Приветствую, понадобилось найти и удалить в текстовом файле все одиинаковые строки.<br />Но я решил не изобретать велосипед, наверняка с этим уже кто-то сталкивался.<br />Поиском по форуму подобных тем не нашел, прошу подсказать куда копать.<br />Благодарю.</p>]]></content>
			<author>
				<name><![CDATA[ilya20069]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26683</uri>
			</author>
			<updated>2012-03-14T20:21:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=57852#p57852</id>
		</entry>
</feed>
