<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: имя переменной из ini файла]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=12973&amp;type=atom" />
	<updated>2017-09-08T17:31:28Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=12973</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: имя переменной из ini файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119176#p119176" />
			<content type="html"><![CDATA[<p>А с велосипедами так всегда, проще новый придумать.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2017-09-08T17:31:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119176#p119176</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: имя переменной из ini файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119175#p119175" />
			<content type="html"><![CDATA[<p>Мда... Осталось научиться на нем кататься.</p>]]></content>
			<author>
				<name><![CDATA[shahlik002]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=37352</uri>
			</author>
			<updated>2017-09-08T17:21:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119175#p119175</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: имя переменной из ini файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119143#p119143" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Raven пишет:</cite><blockquote><p>Вообще это нужно мне для того что бы объекты считывали все свои данные из ini файла</p></blockquote></div><p><a href="http://forum.script-coding.com/viewtopic.php?pid=113730#p113730">Велосипед вроде есть уже</a>.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2017-09-05T16:32:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119143#p119143</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: имя переменной из ini файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119142#p119142" />
			<content type="html"><![CDATA[<p>Вот поиск всех секций, переменных, значений переменных и совпадений имен переменных скрипта с значениями переменных в файле.<br /></p><div class="codebox"><pre><code>file=tatata.ini
tra:=1111
ra:=2222
try:=3333
ty:=4444

IniRead,x1,%file%
Loop,parse,x1, `n, `r
{
Section:=a_loopfield
iniread,x2,%file%,%a_loopfield%,,
Loop,parse,x2, `n, `r
{
peremenaua:=RegExReplace(a_loopfield,&quot;=.*&quot;,&quot;&quot;)
znachenie:=RegExReplace(a_loopfield,&quot;.*=&quot;,&quot;&quot;)
znachenieVscripte:=%znachenie%
if znachenieVscripte=
    znachenieVscripte=Не найдено
    MsgBox,4,,Секция:`t`t%Section%`t`nПеременная: `t%peremenaua%`t`nЗначение: `t%znachenie%`t`n`nЗначение в скрипте: %znachenieVscripte%
    IfMsgBox, No, return
}
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[shahlik002]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=37352</uri>
			</author>
			<updated>2017-09-05T16:01:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119142#p119142</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: имя переменной из ini файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119141#p119141" />
			<content type="html"><![CDATA[<p>Вот так вот:<br /></p><div class="codebox"><pre><code>peremenaua1:=123
peremenaua2=peremenaua1
peremenaua3:=%peremenaua2%
MsgBox %peremenaua3%</code></pre></div><p>Нужно присвоить (:=) присвоенное значение (%%).<br />Все просто! <img src="//forum.script-coding.com/img/smilies/big_smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[shahlik002]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=37352</uri>
			</author>
			<updated>2017-09-05T15:28:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119141#p119141</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: имя переменной из ini файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119140#p119140" />
			<content type="html"><![CDATA[<p>DB.110[720] — такого имени переменной быть не может из-за присутствия недопустимых символов. Так может выглядеть обращение к элементу двумерного массива, что не является переменной, а является выражением. Но из строки &quot;DB.110[720]&quot; получить выражение DB.110[720] в рамках одного скрипта невозможно, так что придумывайте что-то попроще.</p><p>UPD. На самом деле при некоторых усилиях возможно (путём парсинга через RegEx), но такая замысловатость вряд ли может быть чем-то оправдвна.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-09-05T14:59:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119140#p119140</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: имя переменной из ini файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119139#p119139" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Raven пишет:</cite><blockquote><p>Чет не запускается правильно.</p></blockquote></div><p>Это я демонстрировал как скрипт воспримет имя переменной в переменной. Простое имя типа res работает, сложный объект (объект объектов) вида DB.110[720] не воспримет - нужно как-то приводить к простому виду.<br />Возможно я ошибаюсь.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2017-09-05T14:55:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119139#p119139</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: имя переменной из ini файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119135#p119135" />
			<content type="html"><![CDATA[<p><strong>Alectric</strong> Чет не запускается правильно. &quot;the following variable name contains an illegal character&quot;<br />Переменная DB.110[720] в программе меняется каждую секунду. Там значение каждый раз новое. Вот объект и должен считывать это значение с переменной.</p>]]></content>
			<author>
				<name><![CDATA[Raven]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30150</uri>
			</author>
			<updated>2017-09-05T13:32:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119135#p119135</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: имя переменной из ini файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119134#p119134" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Raven пишет:</cite><blockquote><p>зачем мне файл перечитывать постоянно то?</p></blockquote></div><p>Я написал не постоянно а только при старте программы.</p><p>...</p><p>Зачем в ини хранить названия переменных? В них обычно значения хранят.</p><p>Думаю, со сложными именами переменных не получится, нужно их раскладывать на более простые.<br /></p><div class="codebox"><pre><code>DB=[]
DB.110[720]=4
res=5

name1=res
name2=DB.110[720]

v:=%name1%
msgbox,% name1 &quot;=&quot; v

v:=%name2%
msgbox,% name2 &quot;=&quot; v

</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2017-09-05T13:09:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119134#p119134</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: имя переменной из ini файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119131#p119131" />
			<content type="html"><![CDATA[<p><strong>Alectric</strong> Не, зачем мне файл перечитывать постоянно то? Я хотел просто хранить имена переменных в файле дабы прочитать их один раз в начале программы.</p>]]></content>
			<author>
				<name><![CDATA[Raven]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30150</uri>
			</author>
			<updated>2017-09-05T13:00:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119131#p119131</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: имя переменной из ini файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119130#p119130" />
			<content type="html"><![CDATA[<p>Чего-то ты замудрил... В ини файл сохраняй последнее значение при чтении этой ДБ, при перезапуске скрипта читай это значение в ту же ДБ.</p><p>Образно:<br /></p><div class="codebox"><pre><code>
start:
iniread,DB.110[720],file.ini,Oxygen,analog

...
...

readingdb:
DB.110[720]:=readdb()
iniwrite,DB.110[720],file.ini,Oxygen,analog
</code></pre></div><p>...</p><p>Или при выходе из программы лучше сохранять в ини, чтобы жесткий диск не мучить.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2017-09-05T12:56:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119130#p119130</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: имя переменной из ini файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119129#p119129" />
			<content type="html"><![CDATA[<p>Как читая ini файл, прочитать с него имя переменной и потом считать именно эту переменную?<br />Ну примерно так (ini файл):<br /></p><div class="quotebox"><blockquote><p>[Oxygen]<br />x=850<br />y=70<br />analog=DB.110[720]</p></blockquote></div><p>Вот нужно взять и вывести значение переменной DB.110[720]. Вот никак не могу вкурить как это нужно сделать? <br />Прочитать файл я могу iniRead, но я получу в переменной строку DB.110[720]. А в самой переменной числовое значение. <br />Вообще это нужно мне для того что бы объекты считывали все свои данные из ini файла, и потом периодически опрашивали свои переменные имена которых они возьмут из этого ini. Может есть более простой способ?</p>]]></content>
			<author>
				<name><![CDATA[Raven]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30150</uri>
			</author>
			<updated>2017-09-05T12:47:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119129#p119129</id>
		</entry>
</feed>
