<?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=16871&amp;type=atom" />
	<updated>2022-01-08T18:04:13Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=16871</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Составление анаграмм]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151577#p151577" />
			<content type="html"><![CDATA[<p>MsgBox не предназначен для пользователя, он просто показывает, что данные получены, осталось их как-то сохранить. А вот если сделано GUI, предполагается, что оно как раз для пользователя, и должно быть удобным. Вот сейчас у вас после закрытия окна скрипт остаётся висеть в трее — тоже не очень-то удобно.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-01-08T18:04:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151577#p151577</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Составление анаграмм]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151576#p151576" />
			<content type="html"><![CDATA[<p>А что мешает подправить код? Тот же &#039;MsgBox&#039; не очень вариант как по мне. Хоть и позволит извлечь данные, но их нужно будет обрезать.</p><div class="codebox"><pre><code>Gui +AlwaysOnTop +ToolWindow
Gui Add, Edit, vText x8 y8 w200 h21
Gui Add, Edit, vTS x8 y32 w200 h21 +ReadOnly, После ввода нажать &#039;Enter&#039;
Gui Show, w214 h58, Анаграммы - Онлайн
Return

Enter::
Gui, Submit, NoHide
WinHTTP := ComObjCreate(&quot;WinHTTP.WinHttpRequest.5.1&quot;)
WinHTTP.Open(&quot;POST&quot;, &quot;https://cepia.ru/service/words/findbyanagram&quot;, 0)
WinHTTP.SetRequestHeader(&quot;User-Agent&quot;, &quot;Mozilla/5.0 (Windows NT 6.1; rv:65.0) Gecko/20100101 Firefox/65.0&quot;)
WinHTTP.SetRequestHeader(&quot;Content-Type&quot;, &quot;application/x-www-form-urlencoded&quot;)
WinHTTP.SetRequestHeader(&quot;Pragma&quot;, &quot;no-cache&quot;)
WinHTTP.SetRequestHeader(&quot;Cache-Control&quot;, &quot;no-cache, no-store&quot;)
WinHTTP.SetRequestHeader(&quot;If-Modified-Since&quot;, &quot;Sat, 1 Jan 2000 00:00:00 GMT&quot;)
WinHTTP.Send(&quot;anagram=&quot; Text)
GuiControl,,TS, % WinHTTP.ResponseText
Return

GuiEscape:
GuiClose:
ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2022-01-08T17:35:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151576#p151576</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Составление анаграмм]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151575#p151575" />
			<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>2022-01-08T17:11:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151575#p151575</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Составление анаграмм]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151574#p151574" />
			<content type="html"><![CDATA[<p>Наоборот, в окне ввёл получил варианты. Захотелось другое слово - повторил.</p>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2022-01-08T17:08:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151574#p151574</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Составление анаграмм]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151573#p151573" />
			<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>2022-01-08T17:04:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151573#p151573</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Составление анаграмм]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151571#p151571" />
			<content type="html"><![CDATA[<p>А разве это было нужно? Таких условий нет.</p>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2022-01-08T17:03:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151571#p151571</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Составление анаграмм]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151570#p151570" />
			<content type="html"><![CDATA[<p><strong>__Михаил__</strong>, а как из такого окна скопировать результат? <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>2022-01-08T15:39:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151570#p151570</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Составление анаграмм]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151566#p151566" />
			<content type="html"><![CDATA[<p>С графическим интерфейсом лучше будет.<br /></p><div class="codebox"><pre><code>Name = Анаграммы - Онлайн
Gui +AlwaysOnTop +ToolWindow
Gui Add, Edit, vText x8 y8 w200 h21
Gui Add, Text, vTS x8 y32 w200 h23, После ввода нажать &#039;Enter&#039;
Gui Show, w214 h58, % Name
Return

Enter::
Gui, Submit, NoHide
WinHTTP := ComObjCreate(&quot;WinHTTP.WinHttpRequest.5.1&quot;)
WinHTTP.Open(&quot;POST&quot;, &quot;https://cepia.ru/service/words/findbyanagram&quot;, 0)
WinHTTP.SetRequestHeader(&quot;User-Agent&quot;, &quot;Mozilla/5.0 (Windows NT 6.1; rv:65.0) Gecko/20100101 Firefox/65.0&quot;)
WinHTTP.SetRequestHeader(&quot;Content-Type&quot;, &quot;application/x-www-form-urlencoded&quot;)
WinHTTP.SetRequestHeader(&quot;Pragma&quot;, &quot;no-cache&quot;)
WinHTTP.SetRequestHeader(&quot;Cache-Control&quot;, &quot;no-cache, no-store&quot;)
WinHTTP.SetRequestHeader(&quot;If-Modified-Since&quot;, &quot;Sat, 1 Jan 2000 00:00:00 GMT&quot;)
WinHTTP.Send(&quot;anagram=&quot; Text)
GuiControl,,TS, % WinHTTP.ResponseText
Return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2022-01-08T10:35:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151566#p151566</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Составление анаграмм]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151565#p151565" />
			<content type="html"><![CDATA[<p>А зачем составлять скрипт, когда просто:</p><div class="codebox"><pre><code>WinHTTP := ComObjCreate(&quot;WinHTTP.WinHttpRequest.5.1&quot;)
WinHTTP.Open(&quot;POST&quot;, &quot;https://cepia.ru/service/words/findbyanagram&quot;, 0)
WinHTTP.SetRequestHeader(&quot;User-Agent&quot;, &quot;Mozilla/5.0 (Windows NT 6.1; rv:65.0) Gecko/20100101 Firefox/65.0&quot;)
WinHTTP.SetRequestHeader(&quot;Content-Type&quot;, &quot;application/x-www-form-urlencoded&quot;)
WinHTTP.SetRequestHeader(&quot;Pragma&quot;, &quot;no-cache&quot;)
WinHTTP.SetRequestHeader(&quot;Cache-Control&quot;, &quot;no-cache, no-store&quot;)
WinHTTP.SetRequestHeader(&quot;If-Modified-Since&quot;, &quot;Sat, 1 Jan 2000 00:00:00 GMT&quot;)
WinHTTP.Send(&quot;anagram=каприз&quot;)
MsgBox % WinHTTP.ResponseText</code></pre></div>]]></content>
			<author>
				<name><![CDATA[svoboden]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34280</uri>
			</author>
			<updated>2022-01-08T00:38:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151565#p151565</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Составление анаграмм]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151563#p151563" />
			<content type="html"><![CDATA[<p>Больно мудрёно, я бы упростил:<br /></p><div class="codebox"><pre><code>StringCaseSense, locale
word_search := &quot;каприз&quot;

Wrd_Lst =
(
скрипт
колба
бокал
форум
приказ
каприз
анаграмма
)
length := StrLen(word_search)
sorted := SortLetters(word_search)
Loop, parse, Wrd_Lst, `n, `r
{
   if StrLen(A_LoopField) != length || A_LoopField = word_search
      continue
   if SortLetters(A_LoopField) = sorted
      MsgBox, Найдена анаграмма:`n%A_LoopField%
}

SortLetters(word) {
   sorted := RegExReplace(word, &quot;.(?=.)&quot;, &quot;$0`n&quot;)
   Sort, sorted
   Return sorted
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-01-07T16:55:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151563#p151563</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Составление анаграмм]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151559#p151559" />
			<content type="html"><![CDATA[<p>Идея с сортировкой букв в слове гениальна <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />. Пока искал как их сортировать, нашелся готовый скрипт <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> —<br /></p><div class="codebox"><pre><code>setbatchlines,-1
listlines,off
#noenv
dictionary=
(
скрипт
колба
бокал
форум
приказ
каприз
анаграмма
)
dict:=[]
Loop, Parse, dictionary, `n, `r        ; Put all words in an array dict, at dict[wordLength, wordLettersSorted, entryNumber]
{
 keyword:=A_LoopField
 len:=strlen(A_LoopField)
 keyword:=Ltrim(RegExReplace(keyword,&quot;(.)&quot;,&quot;,$1&quot;),&quot;,&quot;)
 Sort,keyword,D,           ; Make a keyword, eg, Dallas -&gt; a,a,D,l,l,s
 if !IsObject(dict[len,keyword])
  dict[len,keyword]:=[]
 dict[len,keyword].push(A_LoopField)      ; Put the word in the keyword slot, all permutations will get the same keyword and end up in this slot
}
allAnagrams:=[]
for len, lengthGroup in dict {
 for keyword, anagrams in lengthGroup
  if (anagrams.length()&gt;1)       ; For each keyword which has more than entry, there is anagrams, save those
   allAnagrams.push(anagrams)
}
str:=&quot;Anagram list:`n&quot;          ; Print result
for k, anagrams in allAnagrams {
 str.= &quot;Anagram set`t&quot; k &quot;:`t&quot;
 for l, anagram in anagrams
  str.=anagram  &quot;`t&quot; 
 str.= &quot;`n&quot; 
}
gui, font,,courier new          ; Show result
gui,add,edit,w1000 r40, % str
gui,show</code></pre></div>]]></content>
			<author>
				<name><![CDATA[peterverhovensky]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41360</uri>
			</author>
			<updated>2022-01-07T16:36:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151559#p151559</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Составление анаграмм]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151554#p151554" />
			<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>2022-01-07T15:37:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151554#p151554</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Составление анаграмм]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151552#p151552" />
			<content type="html"><![CDATA[<p>Здравствуйте. Пытаюсь составить код для поиска анаграмм. Это слова, которые состоят из тех же букв, из которых состоит искомое слово-образец, например: колба — бокал, приказ — каприз. Ниже в переменной &quot;word_search&quot; выделил такое искомое слово-образец, анаграммы к которому должны быть найдены в списке &quot;Wrd_Lst&quot;, но затрудняюсь с обработкой.</p><div class="codebox"><pre><code>word_search := &quot;каприз&quot;

Wrd_Lst =
(
скрипт
колба
бокал
форум
приказ
каприз
анаграмма
)

Loop, Parse, Wrd_Lst, `n
{
   dict_word := A_LoopField

   msgbox % dict_word
}
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[peterverhovensky]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41360</uri>
			</author>
			<updated>2022-01-07T14:50:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151552#p151552</id>
		</entry>
</feed>
