<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: GUI наподобие калькулятора]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=6342</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=6342&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: GUI наподобие калькулятора».]]></description>
		<lastBuildDate>Wed, 19 Oct 2011 22:27:33 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: GUI наподобие калькулятора]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=52709#p52709</link>
			<description><![CDATA[<div class="quotebox"><cite>sleep пишет:</cite><blockquote><p>чтобы к примеру A*B=AB</p></blockquote></div><p>Этой части вопроса я не понял.</p><p>Вот вариант калькулятора:<br /></p><div class="codebox"><pre><code>   oSC := ComObjCreate(&quot;ScriptControl&quot;)
   oSC.Language := &quot;VBScript&quot;
   
   Gui, Add, Edit, vEdit1 x10 y10 w150 h20
   Gui, Add, Edit, vEdit2 xp yp+30 wp hp
   Gui, Show, w170 h70, Сalculator
   Return

#If WinActive(&quot;Сalculator ahk_class AutoHotkeyGUI&quot;)
Enter::
   GuiControlGet, Edit1,, Edit1
   Result := oSC.Eval(Edit1)
   GuiControl,, Edit2, % RegExReplace(Result, &quot;(.*)\.0+$|(.*\..*?)0+$&quot;, &quot;$1$2&quot;)   ; убираем незначащие нули
   Return

GuiClose:
   ExitApp</code></pre></div><p>В первом поле пишем выражение, например 2 + 2, нажимаем Enter, результат появляется во втором.<br />Знак возведения в степень ^</p><p>Принцип работы: создаётся COM-объект <em>ScriptControl</em>, позволяющий воспользоваться методом <em>Eval</em> для вычисления динамических выражений, валидных в VBS.<br />Ещё есть <a href="http://forum.script-coding.com/viewtopic.php?id=2169">такой</a> вариант с созданием временного файла.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Wed, 19 Oct 2011 22:27:33 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=52709#p52709</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: GUI наподобие калькулятора]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=52702#p52702</link>
			<description><![CDATA[<p><span style="color: green"><strong>sleep</strong>, исправьте синтаксические и грамматические ошибки. Название темы следует сделать более информативным.</span></p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Wed, 19 Oct 2011 15:15:13 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=52702#p52702</guid>
		</item>
		<item>
			<title><![CDATA[AHK: GUI наподобие калькулятора]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=52701#p52701</link>
			<description><![CDATA[<p>Привет всем!<br />Помогите сделать окно к примеру 150X300, c двумя полями ввода A и B, и чтобы к примеру A*B=AB и выдавал ответ. А то у меня чтото не получается.&nbsp; Спасибо!</p>]]></description>
			<author><![CDATA[null@example.com (sleep)]]></author>
			<pubDate>Wed, 19 Oct 2011 14:32:02 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=52701#p52701</guid>
		</item>
	</channel>
</rss>
