<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; JS -> VBS: HEX картинки --> BinaryData]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=8281&amp;type=atom" />
	<updated>2013-05-05T19:33:13Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=8281</id>
		<entry>
			<title type="html"><![CDATA[Re: JS -> VBS: HEX картинки --> BinaryData]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=71921#p71921" />
			<content type="html"><![CDATA[<p>Большое спасибо!</p>]]></content>
			<author>
				<name><![CDATA[malikov84]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30097</uri>
			</author>
			<updated>2013-05-05T19:33:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=71921#p71921</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS -> VBS: HEX картинки --> BinaryData]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=71920#p71920" />
			<content type="html"><![CDATA[<p><strong>malikov84</strong>, попробуйте так:<br /></p><div class="codebox"><pre><code>Option Explicit

Const adTypeBinary = 1

Dim strString
Dim objUtilities

strString = _
    &quot;89504E470D0A1A0A0000000D4948445200000027000000420803000000E3443FEE0000000C504C5445F0EEEEF95353F59393&quot; &amp; _
    &quot;FF04047F58B0FF000000097048597300002E2300002E230178A53F760000014249444154789CED955902C42008434DB8FF9D&quot; &amp; _
    &quot;A7AD4BD9AC1C60FCAA363E10115AF38361251D404D27520242A40414290171EB0A409112F0F6AEE2E1C33A033BEA0C1CA413&quot; &amp; _
    &quot;900374022ECE37900BF30D5494EBB380FB061AA7F6401AC41EE8CEB803D20176C007C76B1C8000D0930A5D4A208D35658D61&quot; &amp; _
    &quot;9069D28A3821E6CC60FB5E1013A2B679AB7CB7749B026F1A7ADB74157362EE49B9417D1C1349172D636DAF83F1DE7EEB3889&quot; &amp; _
    &quot;F729E7B943EE7434B762CFA1269C81EBF74B1BC035E3B80215671DB267E14AABF523E6C57B46F3E315B6960BA16DC4B49E89&quot; &amp; _
    &quot;A4F3282F0BD4897F1A2C7606D43BC35F57D7857A1375CF0DF9C297E87A6AF9040B3A2E9DAF48C11134575A32DD0439A0D7AD&quot; &amp; _
    &quot;A70857846C00D4DF50349D4C55A45D5B31B2F104231269D95D2DA12F317D96ABBA0BDE5692B9A3EA847AF1794654544EBAE9&quot; &amp; _
    &quot;5AC7F103F62B06FEC580AB3F0000000049454E44AE426082&quot;

With WScript.CreateObject(&quot;ADODB.Stream&quot;)
    .Type = adTypeBinary
    .Open()
    
    Set objUtilities = WScript.CreateObject(&quot;CAPICOM.Utilities&quot;)
    
    .Write(objUtilities.BinaryStringToByteArray(objUtilities.HexToBinary(strString)))
    .SaveToFile(&quot;test2.png&quot;)
    
    Set objUtilities = Nothing
End With

WScript.Quit 0
</code></pre></div><p><img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" />.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2013-05-05T19:30:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=71920#p71920</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[JS -> VBS: HEX картинки --> BinaryData]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=71913#p71913" />
			<content type="html"><![CDATA[<p>Здравствуйте.<br />Скрипт содержит HEX картинку, кодирует её обратно в Byte Array массив и записывает на диск в виде test.png</p><div class="codebox"><pre><code>var outStreamW = new ActiveXObject(&quot;ADODB.Stream&quot;); // Text stream in Unicode    charset
var outStreamA = new ActiveXObject(&quot;ADODB.Stream&quot;); // Text stream in ISO-8859-1 charset
var binStr = &#039;&#039;;

outStreamW.Type = 2;
outStreamW.Open();
                                 // couples of HEX values
outStreamW.WriteText( hex2text( &#039;89504E470D0A1A0A0000000D4948445200000027000000420803000000E3443FEE0000000C504C5445F0EEEEF95353F59393&#039; ) );
outStreamW.WriteText( hex2text( &#039;FF04047F58B0FF000000097048597300002E2300002E230178A53F760000014249444154789CED955902C42008434DB8FF9D&#039; ) );
outStreamW.WriteText( hex2text( &#039;A7AD4BD9AC1C60FCAA363E10115AF38361251D404D27520242A40414290171EB0A409112F0F6AEE2E1C33A033BEA0C1CA413&#039; ) );
outStreamW.WriteText( hex2text( &#039;900374022ECE37900BF30D5494EBB380FB061AA7F6401AC41EE8CEB803D20176C007C76B1C8000D0930A5D4A208D35658D61&#039; ) );
outStreamW.WriteText( hex2text( &#039;9069D28A3821E6CC60FB5E1013A2B679AB7CB7749B026F1A7ADB74157362EE49B9417D1C1349172D636DAF83F1DE7EEB3889&#039; ) );
outStreamW.WriteText( hex2text( &#039;F729E7B943EE7434B762CFA1269C81EBF74B1BC035E3B80215671DB267E14AABF523E6C57B46F3E315B6960BA16DC4B49E89&#039; ) );
outStreamW.WriteText( hex2text( &#039;A4F3282F0BD4897F1A2C7606D43BC35F57D7857A1375CF0DF9C297E87A6AF9040B3A2E9DAF48C11134575A32DD0439A0D7AD&#039; ) );
outStreamW.WriteText( hex2text( &#039;A70857846C00D4DF50349D4C55A45D5B31B2F104231269D95D2DA12F317D96ABBA0BDE5692B9A3EA847AF1794654544EBAE9&#039; ) );
outStreamW.WriteText( hex2text( &#039;5AC7F103F62B06FEC580AB3F0000000049454E44AE426082&#039; ) );
outStreamW.Position = 0; //don&#039;t forget it or .Read will return 0 bytes

outStreamA.Type = 2;
outStreamA.Charset = &#039;ISO-8859-1&#039;; // to avoid character conversion upper 127 ascii code
outStreamA.Open();
outStreamW.CopyTo( outStreamA ); // Copy unicoded stream to ISO-8859-1 stream
outStreamA.SaveToFile( &#039;test.png&#039;, 2 ); // save file as...

outStreamW.Close();
outStreamA.Close();

// converts couples of HEX values to a string of chars
function hex2text( inHexStr ){
  binStr = &#039;&#039;; //using global variable will be faster, I think.
  for ( i = 0; i &lt; ( inHexStr.length / 2 ); i++ ){
      binStr += String.fromCharCode( &#039;0x&#039; + inHexStr.substr( i * 2, 2 ) );
      }
      return binStr;
  }</code></pre></div><p>Помогите переписать на VBS</p>]]></content>
			<author>
				<name><![CDATA[malikov84]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30097</uri>
			</author>
			<updated>2013-05-05T17:20:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=71913#p71913</id>
		</entry>
</feed>
