<?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>https://forum.script-coding.com/viewtopic.php?id=14560</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=14560&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Создание скринов».]]></description>
		<lastBuildDate>Sat, 09 Feb 2019 15:46:36 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Создание скринов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=132084#p132084</link>
			<description><![CDATA[<p><strong>Phoenixxx_Czar</strong>, огромное спасибо. Если бы не вы скорее всего бы все данные сохранял бы ручками</p>]]></description>
			<author><![CDATA[null@example.com (ArtiOnMoon)]]></author>
			<pubDate>Sat, 09 Feb 2019 15:46:36 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=132084#p132084</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Создание скринов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=132083#p132083</link>
			<description><![CDATA[<div class="codebox"><pre><code>SendPlay {%A_Index%} </code></pre></div><p>--&gt;<br /></p><div class="codebox"><pre><code>SendPlay %A_Index%</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Phoenixxx_Czar)]]></author>
			<pubDate>Sat, 09 Feb 2019 15:35:20 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=132083#p132083</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Создание скринов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=132082#p132082</link>
			<description><![CDATA[<div class="codebox"><pre><code>!1::
{
loop 11
{
SendPlay {%A_Index%} 
Sleep 400
SendPlay {Enter}
SleepPlay 250

SaveScreenshotToFile(0, 0, A_ScreenWidth, A_ScreenHeight, A_ScriptDir . &quot;\screenexp\userid_&quot; A_Index &quot;.png&quot;)
;Run, % A_ScriptDir . &quot;\screenexp\userid_&quot; A_Index &quot;.png&quot;


SaveScreenshotToFile(x, y, w, h, filePath)  {
   hBitmap := GetHBitmapFromScreen(x, y, w, h)
   gdip := new GDIplus
   pBitmap := gdip.BitmapFromHBitmap(hBitmap)
   DllCall(&quot;DeleteObject&quot;, Ptr, hBitmap)
   gdip.SaveBitmapToFile(pBitmap, filePath)
   gdip.DisposeImage(pBitmap)
}

GetHBitmapFromScreen(x, y, w, h)  {
   hDC := DllCall(&quot;GetDC&quot;, Ptr, 0, Ptr)
   hBM := DllCall(&quot;CreateCompatibleBitmap&quot;, Ptr, hDC, Int, w, Int, h, Ptr)
   pDC := DllCall(&quot;CreateCompatibleDC&quot;, Ptr, hDC, Ptr)
   oBM := DllCall(&quot;SelectObject&quot;, Ptr, pDC, Ptr, hBM, Ptr)
   DllCall(&quot;BitBlt&quot;, Ptr, pDC, Int, 0, Int, 0, Int, w, Int, h, Ptr, hDC, Int, x, Int, y, UInt, 0x00CC0020)
   DllCall(&quot;SelectObject&quot;, Ptr, pDC, Ptr, oBM)
   DllCall(&quot;DeleteDC&quot;, Ptr, pDC)
   DllCall(&quot;ReleaseDC&quot;, Ptr, 0, Ptr, hDC)
   Return hBM  ; should be deleted with DllCall(&quot;DeleteObject&quot;, Ptr, hBM)
}

class GDIplus   {
   __New()  {
      if !DllCall(&quot;GetModuleHandle&quot;, Str, &quot;gdiplus&quot;, Ptr)
         DllCall(&quot;LoadLibrary&quot;, Str, &quot;gdiplus&quot;)
      VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
      DllCall(&quot;gdiplus\GdiplusStartup&quot;, PtrP, pToken, Ptr, &amp;si, Ptr, 0)
      this.token := pToken
   }
   
   __Delete()  {
      DllCall(&quot;gdiplus\GdiplusShutdown&quot;, Ptr, this.token)
      if hModule := DllCall(&quot;GetModuleHandle&quot;, Str, &quot;gdiplus&quot;, Ptr)
         DllCall(&quot;FreeLibrary&quot;, Ptr, hModule)
   }
   
   BitmapFromHBitmap(hBitmap, Palette := 0)  {
      DllCall(&quot;gdiplus\GdipCreateBitmapFromHBITMAP&quot;, Ptr, hBitmap, Ptr, Palette, PtrP, pBitmap)
      return pBitmap  ; should be deleted with this.DisposeImage(pBitmap)
   }
   
   SaveBitmapToFile(pBitmap, sOutput, Quality=75)  {
      SplitPath, sOutput,,, Extension
      if Extension not in BMP,DIB,RLE,JPG,JPEG,JPE,JFIF,GIF,TIF,TIFF,PNG
         return -1

      DllCall(&quot;gdiplus\GdipGetImageEncodersSize&quot;, UIntP, nCount, UIntP, nSize)
      VarSetCapacity(ci, nSize)
      DllCall(&quot;gdiplus\GdipGetImageEncoders&quot;, UInt, nCount, UInt, nSize, Ptr, &amp;ci)
      if !(nCount &amp;&amp; nSize)
         return -2
      
      Loop, % nCount  {
         sString := StrGet(NumGet(ci, (idx := (48+7*A_PtrSize)*(A_Index-1))+32+3*A_PtrSize), &quot;UTF-16&quot;)
         if !InStr(sString, &quot;*.&quot; Extension)
            continue
         
         pCodec := &amp;ci+idx
         break
      }
      
      if !pCodec
         return -3

      if RegExMatch(Extension, &quot;i)^J(PG|PEG|PE|FIF)$&quot;) &amp;&amp; Quality != 75  {
         DllCall(&quot;gdiplus\GdipGetEncoderParameterListSize&quot;, Ptr, pBitmap, Ptr, pCodec, UintP, nSize)
         VarSetCapacity(EncoderParameters, nSize, 0)
         DllCall(&quot;gdiplus\GdipGetEncoderParameterList&quot;, Ptr, pBitmap, Ptr, pCodec, UInt, nSize, Ptr, &amp;EncoderParameters)
         Loop, % NumGet(EncoderParameters, &quot;UInt&quot;)  {
            elem := (24+A_PtrSize)*(A_Index-1) + 4 + (pad := A_PtrSize = 8 ? 4 : 0)
            if (NumGet(EncoderParameters, elem+16, &quot;UInt&quot;) = 1) &amp;&amp; (NumGet(EncoderParameters, elem+20, &quot;UInt&quot;) = 6)  {
               p := elem+&amp;EncoderParameters-pad-4
               NumPut(Quality, NumGet(NumPut(4, NumPut(1, p+0)+20, &quot;UInt&quot;)), &quot;UInt&quot;)
               break
            }
         }      
      }
      
      if A_IsUnicode
         pOutput := &amp;sOutput
      else  {
         VarSetCapacity(wOutput, StrPut(sOutput, &quot;UTF-16&quot;)*2, 0)
         StrPut(sOutput, &amp;wOutput, &quot;UTF-16&quot;)
         pOutput := &amp;wOutput
      }
      E := DllCall(&quot;gdiplus\GdipSaveImageToFile&quot;, Ptr, pBitmap, Ptr, pOutput, Ptr, pCodec, UInt, p ? p : 0)
      return E ? -5 : 0
   }
   
   DisposeImage(pBitmap)  {
      return DllCall(&quot;gdiplus\GdipDisposeImage&quot;, Ptr, pBitmap)
   }
}
sleep 3000
sendplay {Browser_Back}
sleep 1000
Click 212, 98
sleep 200
sendplay {backspace}
sendplay {backspace}
sendplay {backspace}
sendplay {backspace}
sleep 200
}
}

</code></pre></div><p>Подскажите пожалуйста, как заставить скрипт забивать числа. То есть проблема в том, что сейчас он не отправлять числа дальшее чем 9 в консоль.</p>]]></description>
			<author><![CDATA[null@example.com (ArtiOnMoon)]]></author>
			<pubDate>Sat, 09 Feb 2019 15:24:26 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=132082#p132082</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Создание скринов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=132068#p132068</link>
			<description><![CDATA[<div class="quotebox"><cite>ArtiOnMoon пишет:</cite><blockquote><p>A_ScriptDir . &quot;\screenexp\screen%A_YYYY%.png&quot;</p></blockquote></div><p>--&gt;<br /></p><div class="codebox"><pre><code>A_ScriptDir . &quot;\screenexp\screen&quot; A_YYYY &quot;-&quot; A_MM &quot;-&quot; A_DD &quot; &quot; A_Hour &quot;:&quot; A_Min &quot;:&quot; A_Sec &quot;.png&quot;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Phoenixxx_Czar)]]></author>
			<pubDate>Sat, 09 Feb 2019 00:40:08 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=132068#p132068</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Создание скринов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=132054#p132054</link>
			<description><![CDATA[<p>Нашел рабочий скрипт по созданию скринов. Перед мной возникла надобность запустить это в цикл, но возникла проблема в том что скрин перезаписывается каждый раз. То есть мне необходимо сделать название переменным значением. Как это осуществить?</p><div class="codebox"><pre><code>SaveScreenshotToFile(0, 0, A_ScreenWidth, A_ScreenHeight, A_ScriptDir . &quot;\screenexp\screen%A_YYYY%.png&quot;)
;Run, % A_ScriptDir . &quot;\screenexp\screen%A_YYYY%.png&quot;


SaveScreenshotToFile(x, y, w, h, filePath)  {
   hBitmap := GetHBitmapFromScreen(x, y, w, h)
   gdip := new GDIplus
   pBitmap := gdip.BitmapFromHBitmap(hBitmap)
   DllCall(&quot;DeleteObject&quot;, Ptr, hBitmap)
   gdip.SaveBitmapToFile(pBitmap, filePath)
   gdip.DisposeImage(pBitmap)
}

GetHBitmapFromScreen(x, y, w, h)  {
   hDC := DllCall(&quot;GetDC&quot;, Ptr, 0, Ptr)
   hBM := DllCall(&quot;CreateCompatibleBitmap&quot;, Ptr, hDC, Int, w, Int, h, Ptr)
   pDC := DllCall(&quot;CreateCompatibleDC&quot;, Ptr, hDC, Ptr)
   oBM := DllCall(&quot;SelectObject&quot;, Ptr, pDC, Ptr, hBM, Ptr)
   DllCall(&quot;BitBlt&quot;, Ptr, pDC, Int, 0, Int, 0, Int, w, Int, h, Ptr, hDC, Int, x, Int, y, UInt, 0x00CC0020)
   DllCall(&quot;SelectObject&quot;, Ptr, pDC, Ptr, oBM)
   DllCall(&quot;DeleteDC&quot;, Ptr, pDC)
   DllCall(&quot;ReleaseDC&quot;, Ptr, 0, Ptr, hDC)
   Return hBM  ; should be deleted with DllCall(&quot;DeleteObject&quot;, Ptr, hBM)
}

class GDIplus   {
   __New()  {
      if !DllCall(&quot;GetModuleHandle&quot;, Str, &quot;gdiplus&quot;, Ptr)
         DllCall(&quot;LoadLibrary&quot;, Str, &quot;gdiplus&quot;)
      VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
      DllCall(&quot;gdiplus\GdiplusStartup&quot;, PtrP, pToken, Ptr, &amp;si, Ptr, 0)
      this.token := pToken
   }
   
   __Delete()  {
      DllCall(&quot;gdiplus\GdiplusShutdown&quot;, Ptr, this.token)
      if hModule := DllCall(&quot;GetModuleHandle&quot;, Str, &quot;gdiplus&quot;, Ptr)
         DllCall(&quot;FreeLibrary&quot;, Ptr, hModule)
   }
   
   BitmapFromHBitmap(hBitmap, Palette := 0)  {
      DllCall(&quot;gdiplus\GdipCreateBitmapFromHBITMAP&quot;, Ptr, hBitmap, Ptr, Palette, PtrP, pBitmap)
      return pBitmap  ; should be deleted with this.DisposeImage(pBitmap)
   }
   
   SaveBitmapToFile(pBitmap, sOutput, Quality=75)  {
      SplitPath, sOutput,,, Extension
      if Extension not in BMP,DIB,RLE,JPG,JPEG,JPE,JFIF,GIF,TIF,TIFF,PNG
         return -1

      DllCall(&quot;gdiplus\GdipGetImageEncodersSize&quot;, UIntP, nCount, UIntP, nSize)
      VarSetCapacity(ci, nSize)
      DllCall(&quot;gdiplus\GdipGetImageEncoders&quot;, UInt, nCount, UInt, nSize, Ptr, &amp;ci)
      if !(nCount &amp;&amp; nSize)
         return -2
      
      Loop, % nCount  {
         sString := StrGet(NumGet(ci, (idx := (48+7*A_PtrSize)*(A_Index-1))+32+3*A_PtrSize), &quot;UTF-16&quot;)
         if !InStr(sString, &quot;*.&quot; Extension)
            continue
         
         pCodec := &amp;ci+idx
         break
      }
      
      if !pCodec
         return -3

      if RegExMatch(Extension, &quot;i)^J(PG|PEG|PE|FIF)$&quot;) &amp;&amp; Quality != 75  {
         DllCall(&quot;gdiplus\GdipGetEncoderParameterListSize&quot;, Ptr, pBitmap, Ptr, pCodec, UintP, nSize)
         VarSetCapacity(EncoderParameters, nSize, 0)
         DllCall(&quot;gdiplus\GdipGetEncoderParameterList&quot;, Ptr, pBitmap, Ptr, pCodec, UInt, nSize, Ptr, &amp;EncoderParameters)
         Loop, % NumGet(EncoderParameters, &quot;UInt&quot;)  {
            elem := (24+A_PtrSize)*(A_Index-1) + 4 + (pad := A_PtrSize = 8 ? 4 : 0)
            if (NumGet(EncoderParameters, elem+16, &quot;UInt&quot;) = 1) &amp;&amp; (NumGet(EncoderParameters, elem+20, &quot;UInt&quot;) = 6)  {
               p := elem+&amp;EncoderParameters-pad-4
               NumPut(Quality, NumGet(NumPut(4, NumPut(1, p+0)+20, &quot;UInt&quot;)), &quot;UInt&quot;)
               break
            }
         }      
      }
      
      if A_IsUnicode
         pOutput := &amp;sOutput
      else  {
         VarSetCapacity(wOutput, StrPut(sOutput, &quot;UTF-16&quot;)*2, 0)
         StrPut(sOutput, &amp;wOutput, &quot;UTF-16&quot;)
         pOutput := &amp;wOutput
      }
      E := DllCall(&quot;gdiplus\GdipSaveImageToFile&quot;, Ptr, pBitmap, Ptr, pOutput, Ptr, pCodec, UInt, p ? p : 0)
      return E ? -5 : 0
   }
   
   DisposeImage(pBitmap)  {
      return DllCall(&quot;gdiplus\GdipDisposeImage&quot;, Ptr, pBitmap)
   }
}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (ArtiOnMoon)]]></author>
			<pubDate>Fri, 08 Feb 2019 20:43:24 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=132054#p132054</guid>
		</item>
	</channel>
</rss>
