<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Выполнение переменного кода]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=13300</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=13300&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Выполнение переменного кода».]]></description>
		<lastBuildDate>Sun, 14 Apr 2019 17:29:58 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Выполнение переменного кода]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=133605#p133605</link>
			<description><![CDATA[<p>Нет.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sun, 14 Apr 2019 17:29:58 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=133605#p133605</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выполнение переменного кода]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=133603#p133603</link>
			<description><![CDATA[<p><strong>Malcev</strong><br />Что нибудь ответили?</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sun, 14 Apr 2019 14:01:03 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=133603#p133603</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выполнение переменного кода]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=124986#p124986</link>
			<description><![CDATA[<p>Написал, посмотрим, что ответит.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sat, 28 Apr 2018 23:09:59 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=124986#p124986</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выполнение переменного кода]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=124980#p124980</link>
			<description><![CDATA[<p>Пиши lexikos&#039;у. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sat, 28 Apr 2018 20:30:13 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=124980#p124980</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выполнение переменного кода]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=124978#p124978</link>
			<description><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>я просто хотел сказать, что данный код из хелпа не всегда годится.</p></blockquote></div><p>Наверное стоило бы на этот момент в хелпе заострить внимание (сделать пометку).</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sat, 28 Apr 2018 20:26:50 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=124978#p124978</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выполнение переменного кода]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=124975#p124975</link>
			<description><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>Можно конвертировать</p></blockquote></div><p>В этом нет смысла, код, как правило, заранее неизвестен.<br /></p><div class="quotebox"><blockquote><p>Или через именованные каналы</p></blockquote></div><p>Так это понятно, я просто хотел сказать, что данный код из хелпа не всегда годится.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sat, 28 Apr 2018 20:15:16 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=124975#p124975</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выполнение переменного кода]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=124973#p124973</link>
			<description><![CDATA[<p>Да, такие символы wscript похоже не понимает.<br />Можно конвертировать:<br /></p><div class="codebox"><pre><code>code := &quot;msgbox % Chr(10003)&quot;
ExecScript(code, false)

ExecScript(Script, Wait:=true)
{
    shell := ComObjCreate(&quot;WScript.Shell&quot;)
    exec := shell.Exec(&quot;AutoHotkey.exe /ErrorStdOut *&quot;)
    exec.StdIn.Write(script)
    exec.StdIn.Close()
    if Wait
        return exec.StdOut.ReadAll()
}</code></pre></div><p>Или через именованные каналы:<br /></p><div class="codebox"><pre><code>code := &quot;msgbox ✓&quot;
DynaRun(code)

DynaRun(TempScript, pipename=&quot;&quot;)
{
   static _:=&quot;uint&quot;,@:=&quot;Ptr&quot;
   If pipename =
      name := &quot;AHK&quot; A_TickCount
   Else
      name := pipename
   __PIPE_GA_ := DllCall(&quot;CreateNamedPipe&quot;,&quot;str&quot;,&quot;\\.\pipe\&quot; name,_,2,_,0,_,255,_,0,_,0,@,0,@,0)
   __PIPE_    := DllCall(&quot;CreateNamedPipe&quot;,&quot;str&quot;,&quot;\\.\pipe\&quot; name,_,2,_,0,_,255,_,0,_,0,@,0,@,0)
   if (__PIPE_=-1 or __PIPE_GA_=-1)
      Return 0
   Run, %A_AhkPath% &quot;\\.\pipe\%name%&quot;,,UseErrorLevel HIDE, PID
   If ErrorLevel
      MsgBox, 262144, ERROR,% &quot;Could not open file:`n&quot; __AHK_EXE_ &quot;&quot;&quot;\\.\pipe\&quot; name &quot;&quot;&quot;&quot;
   DllCall(&quot;ConnectNamedPipe&quot;,@,__PIPE_GA_,@,0)
   DllCall(&quot;CloseHandle&quot;,@,__PIPE_GA_)
   DllCall(&quot;ConnectNamedPipe&quot;,@,__PIPE_,@,0)
   script := (A_IsUnicode ? chr(0xfeff) : (chr(239) . chr(187) . chr(191))) TempScript
   if !DllCall(&quot;WriteFile&quot;,@,__PIPE_,&quot;str&quot;,script,_,(StrLen(script)+1)*(A_IsUnicode ? 2 : 1),_ &quot;*&quot;,0,@,0)
        Return A_LastError,DllCall(&quot;CloseHandle&quot;,@,__PIPE_)
   DllCall(&quot;CloseHandle&quot;,@,__PIPE_)
   Return PID
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sat, 28 Apr 2018 19:39:20 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=124973#p124973</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выполнение переменного кода]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=124971#p124971</link>
			<description><![CDATA[<p>Кстати, такой код не всегда годится:</p><div class="codebox"><pre><code>code := &quot;msgbox ✓&quot;
ExecScript(code, false)

ExecScript(Script, Wait:=true)
{
    shell := ComObjCreate(&quot;WScript.Shell&quot;)
    exec := shell.Exec(&quot;AutoHotkey.exe /ErrorStdOut *&quot;)
    exec.StdIn.Write(script)
    exec.StdIn.Close()
    if Wait
        return exec.StdOut.ReadAll()
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sat, 28 Apr 2018 14:21:04 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=124971#p124971</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выполнение переменного кода]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=124968#p124968</link>
			<description><![CDATA[<p>В справке всё написано:<br /><a href="https://autohotkey.com/docs/commands/Run.htm">https://autohotkey.com/docs/commands/Run.htm</a><br /></p><div class="codebox"><pre><code>code := &quot;msgbox 1`nmsgbox 2&quot;
ExecScript(code, false)

ExecScript(Script, Wait:=true)
{
    shell := ComObjCreate(&quot;WScript.Shell&quot;)
    exec := shell.Exec(&quot;AutoHotkey.exe /ErrorStdOut *&quot;)
    exec.StdIn.Write(script)
    exec.StdIn.Close()
    if Wait
        return exec.StdOut.ReadAll()
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sat, 28 Apr 2018 09:16:32 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=124968#p124968</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выполнение переменного кода]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=124966#p124966</link>
			<description><![CDATA[<div class="quotebox"><cite>Diman_Express пишет:</cite><blockquote><p>что если скачивать файл с сервера (текстовик), где будет код. Далее скрипт должен прочитать его и выполнить</p></blockquote></div><p>Подозреваю, на форуме есть примеры этой процедуры, но не знаю, как правильно искать. Есть действенный вариант такого метода чтения кода онлайн из Google Docs, например? Ткните, пожалуйста. Гугл выдал пару примеров некоторой давности - у меня не сработали.</p>]]></description>
			<author><![CDATA[null@example.com (becauseim)]]></author>
			<pubDate>Sat, 28 Apr 2018 02:17:57 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=124966#p124966</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выполнение переменного кода]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=124948#p124948</link>
			<description><![CDATA[<p>Тоже заинтересовался данной темой. Пришел к тому, что ahk все же должен быть установлен. Вот так, например, можно выполнить любой код в блокноте, не создавая никаких файлов:<br /></p><div class="codebox"><pre><code>F1::
		ControlGetFocus, ControlName, ahk_exe notepad.exe
		if (InStr(ControlName, &quot;Edit1&quot;))
		{
			ControlGetText, ScriptText, %ControlName%, ahk_exe notepad.exe
			RunTempScript(ScriptText, &quot;Unsaved Script - &quot; A_TickCount)
		}
return

RunTempScript(TempScript, name=&quot;&quot;)
{
	If name =
	pipe_name := A_TickCount
	Else
	pipe_name := name
	pipe_ga := CreateNamedPipe(pipe_name, 2)
	pipe    := CreateNamedPipe(pipe_name, 2)
	if (pipe=-1 or pipe_ga=-1)
	{
		MsgBox CreateNamedPipe failed.
		ExitApp
	}
	Run, %A_AhkPath% &quot;\\.\pipe\%pipe_name%&quot;,,,PID
	DllCall(&quot;ConnectNamedPipe&quot;,&quot;uint&quot;,pipe_ga,&quot;uint&quot;,0)
	DllCall(&quot;CloseHandle&quot;,&quot;uint&quot;,pipe_ga)
	DllCall(&quot;ConnectNamedPipe&quot;,&quot;uint&quot;,pipe,&quot;uint&quot;,0)
	Script := chr(0xfeff) TempScript
	if !DllCall(&quot;WriteFile&quot;,&quot;uint&quot;,pipe,&quot;str&quot;,Script,&quot;uint&quot;,(StrLen(Script)+1)*2,&quot;uint*&quot;,0,&quot;uint&quot;,0)
		MsgBox WriteFile failed: %ErrorLevel%/%A_LastError%
	DllCall(&quot;CloseHandle&quot;,&quot;uint&quot;,pipe)
	Return PID
}

CreateNamedPipe(Name, OpenMode=3, PipeMode=0, MaxInstances=255)
{
    return DllCall(&quot;CreateNamedPipe&quot;,&quot;str&quot;,&quot;\\.\pipe\&quot; Name,&quot;uint&quot;,OpenMode
        ,&quot;uint&quot;,PipeMode,&quot;uint&quot;,MaxInstances,&quot;uint&quot;,0,&quot;uint&quot;,0,&quot;uint&quot;,0,&quot;uint&quot;,0)
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (svoboden)]]></author>
			<pubDate>Fri, 27 Apr 2018 07:49:21 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=124948#p124948</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выполнение переменного кода]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=122366#p122366</link>
			<description><![CDATA[<p><strong>ypppu</strong>, у меня тот же вопрос возник, когда я прочитал эту тему. Видимо зачарованное название темы, вдумайтесь только &quot;Выполнение переменного кода&quot;. Это как обсуждать переменный ток (если есть электрики), можно обсуждать бесконечно.</p>]]></description>
			<author><![CDATA[null@example.com (Alectric)]]></author>
			<pubDate>Fri, 15 Dec 2017 14:02:23 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=122366#p122366</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выполнение переменного кода]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=122365#p122365</link>
			<description><![CDATA[<p>Что происходит? <span class="postimg"><img src="http://i.smiles2k.net/icq_smiles/5.gif" alt="http://i.smiles2k.net/icq_smiles/5.gif" /></span></p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Fri, 15 Dec 2017 14:00:41 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=122365#p122365</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выполнение переменного кода]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=122364#p122364</link>
			<description><![CDATA[<p>Я не про последствия, я про рутину.</p>]]></description>
			<author><![CDATA[null@example.com (Alectric)]]></author>
			<pubDate>Fri, 15 Dec 2017 13:52:07 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=122364#p122364</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выполнение переменного кода]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=122363#p122363</link>
			<description><![CDATA[<p>Мне это ни о чем не говорит.<br />Но я только что запустил 1000 скомпилированных скриптов с кодом tooltip - никаких негативных последствий от </p><div class="quotebox"><blockquote><p>плодить ссылки на области памяти</p></blockquote></div><p> не обнаружил.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Fri, 15 Dec 2017 13:49:17 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=122363#p122363</guid>
		</item>
	</channel>
</rss>
