<?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=14557&amp;type=atom" />
	<updated>2019-02-08T09:04:45Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=14557</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Счетчик-накопитель с учетом даты]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=132029#p132029" />
			<content type="html"><![CDATA[<p>Все работает.<br />Спасибо большое.</p>]]></content>
			<author>
				<name><![CDATA[ОсиповаТатьяна]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39847</uri>
			</author>
			<updated>2019-02-08T09:04:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=132029#p132029</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Счетчик-накопитель с учетом даты]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=132011#p132011" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>storage := A_ScriptDir . &quot;\1.txt&quot;
template := &quot;Счетчик: &quot;
LaunchCount(storage, template)
Return

LaunchCount(filePath, template)  {
   date := A_DD . &quot;.&quot; . A_MM . &quot;.&quot; . A_YEAR
   oFile := FileOpen(filePath, &quot;rw&quot;, &quot;cp0&quot;)
   content := oFile.Read()
   RegExMatch(content, &quot;s)(.*\R)?\K.*?(?&lt;PressCount&gt;\d+)\s(?&lt;Date&gt;\d\d\.\d\d\.\d{4})$&quot;, lastStr)
   dateFit := date = lastStrDate
   newLastStr := ( (lastStr &amp;&amp; !dateFit) ? &quot;`r`n&quot; : &quot;&quot; ) . template . (dateFit ? ++lastStrPressCount : &quot;1&quot; ) . &quot; &quot; . date
   if dateFit
      oFile.Pos -= StrLen(lastStr), oFile.Length := oFile.Pos
   oFile.Write(newLastStr)
   oFile.Close()
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2019-02-07T18:41:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=132011#p132011</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Счетчик-накопитель с учетом даты]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=132009#p132009" />
			<content type="html"><![CDATA[<p>Здравствуйте.<br />Помогите изменить скрипт.</p><p>Скрипт считает нажатия клавиш и записывает их число в txt с учетом текущей даты. <br /></p><div class="codebox"><pre><code>storage := A_ScriptDir . &quot;\1.txt&quot;
template := &quot;Счетчик: &quot;

WatchPress := Func(&quot;WatchPress&quot;).Bind(storage, template)
Loop 248
   Hotkey, % &quot;~&quot; . Format(&quot;vk{:X}&quot;, A_Index + 7), % WatchPress, On
Return

WatchPress(filePath, template)  {
   Critical
   date := A_DD . &quot;.&quot; . A_MM . &quot;.&quot; . A_YEAR
   oFile := FileOpen(filePath, &quot;rw&quot;, &quot;cp0&quot;)
   content := oFile.Read()
   RegExMatch(content, &quot;s)(.*\R)?\K.*?(?&lt;PressCount&gt;\d+)\s(?&lt;Date&gt;\d\d\.\d\d\.\d{4})$&quot;, lastStr)
   dateFit := date = lastStrDate
   newLastStr := ( (lastStr &amp;&amp; !dateFit) ? &quot;`r`n&quot; : &quot;&quot; ) . template . (dateFit ? ++lastStrPressCount : &quot;1&quot; ) . &quot; &quot; . date
   if dateFit
      oFile.Pos -= StrLen(lastStr), oFile.Length := oFile.Pos
   oFile.Write(newLastStr)
   oFile.Close()
}</code></pre></div><p>Подскажите - как этим скриптом добавлять единицу не при нажатии клавиш, а&nbsp; один раз - при запуске скрипта ?</p><p>Чтобы 1 добавлялась не при нажатии на клавишу, а просто при запуске скрипта (который бы тут же закрывался)</p>]]></content>
			<author>
				<name><![CDATA[ОсиповаТатьяна]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39847</uri>
			</author>
			<updated>2019-02-07T17:54:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=132009#p132009</id>
		</entry>
</feed>
