<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Parse строки]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=7148&amp;type=atom" />
	<updated>2012-04-25T10:48:23Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=7148</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Parse строки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=59723#p59723" />
			<content type="html"><![CDATA[<p>Пожалуйста. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2012-04-25T10:48:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=59723#p59723</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Parse строки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=59722#p59722" />
			<content type="html"><![CDATA[<p>Спасибо, <strong>Irbis</strong>!</p>]]></content>
			<author>
				<name><![CDATA[Bobby]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25841</uri>
			</author>
			<updated>2012-04-25T09:38:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=59722#p59722</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Parse строки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=59720#p59720" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>a := [], b := []
Str = строка25 11 22 33 44 55 66 77 88 99 12 
Loop, parse, Str, %A_Space%
   arr := Mod(A_Index,2) ? &quot;b&quot; : &quot;a&quot;, %arr%[A_Index//2] := A_LoopField
Loop % a.MaxIndex()
   MsgBox, % a[A_Index] &quot;, &quot; b[A_Index]</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2012-04-25T07:06:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=59720#p59720</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Parse строки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=59716#p59716" />
			<content type="html"><![CDATA[<p>Спасибо! Я не против AHK_L. Так тоже работает:<br /></p><div class="codebox"><pre><code>
; AHK_L 1.1.07.03
a := []
b := []
;a := Object(), b := Object() ; для AHK-basic строка не нужна
Str = строка25 11 22 33 44 55 66 77 88 99 12 
Loop, parse, Str, %A_Space%
{
    n += 1
    arr := Mod(A_Index,2) ? &quot;b&quot; : &quot;a&quot;, %arr%[A_Index//2] := A_LoopField
}
n := n/2
Loop %n%  ; в нашем случае n = 5
MsgBox, % a[A_Index] &quot;, &quot; b[A_Index]</code></pre></div><p>А как определить количество циклов кроме моего варианта?</p>]]></content>
			<author>
				<name><![CDATA[Bobby]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25841</uri>
			</author>
			<updated>2012-04-25T04:49:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=59716#p59716</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Parse строки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=59714#p59714" />
			<content type="html"><![CDATA[<p>Но ТС привел пример со скобками, значит рабочий? Пусть убирает первую строку (не комментарий), и работает с a[..] как с переменными, а не объектами.<br />Или я что-то недопонимаю <img src="//forum.script-coding.com/img/smilies/hmm.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2012-04-24T23:09:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=59714#p59714</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Parse строки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=59713#p59713" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Irbis пишет:</cite><blockquote><p><em>Не имею возможности проверить работу скрипта на AHK-basic (На всякий случай указал в скрипте используемую версию AHK)</em></p></blockquote></div><p>На AHK-basic не заработает — там объектов нет, проще от квадратных скобок было избавиться. <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>2012-04-24T21:28:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=59713#p59713</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Parse строки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=59711#p59711" />
			<content type="html"><![CDATA[<p><img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> Видимо. Несколько минут медитировал&nbsp; на пример, пока не догадался инициализировать объекты. (MsgBox упорно выдавал пустую строку)<br />Чтож, или мне придется переходить на устаревший вариант AHK, или ....<br /><em>Не имею возможности проверить работу скрипта на AHK-basic (На всякий случай указал в скрипте используемую версию AHK)</em></p>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2012-04-24T20:30:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=59711#p59711</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Parse строки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=59710#p59710" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Irbis пишет:</cite><blockquote><div class="codebox"><pre><code>a := Object(), b = Object()
...</code></pre></div></blockquote></div><p>По-видимому, коллега <strong>Bobby</strong> пользуется AHK-basic, там в переменных <a href="http://www.script-coding.com/AutoHotkey/Variables.1.0.46.07.html#1">разрешается</a> использовать символы &quot;[&quot; и &quot;]&quot;, так что объектов, скорее всего, не нужно.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2012-04-24T20:21:56Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=59710#p59710</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Parse строки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=59709#p59709" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>; AHK_L 1.1.07.03
a := Object(), b := Object() ; для AHK-basic строка не нужна
Str = строка25 11 22 33 44 55 66 77 88 99 12 
Loop, parse, Str, %A_Space%
   arr := Mod(A_Index,2) ? &quot;b&quot; : &quot;a&quot;, %arr%[A_Index//2] := A_LoopField
MsgBox, % a[2] &quot;, &quot; b[2]</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2012-04-24T20:15:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=59709#p59709</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Parse строки]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=59701#p59701" />
			<content type="html"><![CDATA[<p>Имеем<br /></p><div class="codebox"><pre><code> Str = строка25 11 22 33 44 55 66 77 88 99 12 
Loop, parse, Str, %A_Space%
;можно продолжить 
{
MsgBox, % A_LoopField
If A_Index = 2
a[1] := A_LoopField
If A_Index = 3
b[1] := A_LoopField
If A_Index = 4
a[2] := A_LoopField
If A_Index = 5
b[2] := A_LoopField
If A_Index = 6
a[3] := A_LoopField
If A_Index = 7
b[3] := A_LoopField
If A_Index = 8
a[4] := A_LoopField
If A_Index = 9
b[4] := A_LoopField
If A_Index = 10
a[5] := A_LoopField
If A_Index = 11
b[5] := A_LoopField
}
MsgBox, % a[2] &quot; ,&quot; b[2]</code></pre></div><p>Как выбрать из строки значения для переменных a[n] и b[n], чтобы получилось<br />а[1]=11 b[1]=22<br />a[2]=33 b[2]=44<br />a[3]=55 b[3]=66<br />a[4]=77 b[4]=88<br />a[5]=99 b[5]=12<br />Есть ли более компактный вариант кроме описанного?</p>]]></content>
			<author>
				<name><![CDATA[Bobby]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25841</uri>
			</author>
			<updated>2012-04-24T18:09:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=59701#p59701</id>
		</entry>
</feed>
