<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBS:как сохранить данные с txt файла?]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10179&amp;type=atom" />
	<updated>2014-11-24T14:22:03Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10179</id>
		<entry>
			<title type="html"><![CDATA[Re: VBS:как сохранить данные с txt файла?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88644#p88644" />
			<content type="html"><![CDATA[<p><strong>DarkJoker1992</strong>, я никак не смогу помочь Вам, пока Вы будете продолжать отделываться общими фразами.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2014-11-24T14:22:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88644#p88644</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:как сохранить данные с txt файла?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88641#p88641" />
			<content type="html"><![CDATA[<p>О_о всмысле, есть начало кода есть определённая строка до которой мне нужен код, остальное не нужно.</p>]]></content>
			<author>
				<name><![CDATA[DarkJoker1992]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32574</uri>
			</author>
			<updated>2014-11-24T13:50:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88641#p88641</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:как сохранить данные с txt файла?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88639#p88639" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>DarkJoker1992 пишет:</cite><blockquote><p>нужную мне часть</p></blockquote></div><p>В который раз повторяю: опишите принципы, по которым Вы определяете нужную Вам часть.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2014-11-24T13:38:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88639#p88639</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:как сохранить данные с txt файла?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88627#p88627" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>alexii пишет:</cite><blockquote><p><strong>DarkJoker1992</strong>, великолепно. Теперь дело осталось за малым:<br /></p><div class="quotebox"><blockquote><p>2. Указали принципы — в деталях — по которым будет происходить поиск и отбор информации.</p></blockquote></div><p>рассказать-таки — по каким принципам мы выбираем один определённый «npsa=4000213» среди прочих.</p></blockquote></div><p>имеется сервер где расположены файлы и html файл, который в определённое время,генерирует данные и меняет часть кода, мне нужно забирать нужную мне часть.</p>]]></content>
			<author>
				<name><![CDATA[DarkJoker1992]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32574</uri>
			</author>
			<updated>2014-11-24T09:29:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88627#p88627</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:как сохранить данные с txt файла?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88611#p88611" />
			<content type="html"><![CDATA[<p><strong>DarkJoker1992</strong>, великолепно. Теперь дело осталось за малым:<br /></p><div class="quotebox"><blockquote><p>2. Указали принципы — в деталях — по которым будет происходить поиск и отбор информации.</p></blockquote></div><p>рассказать-таки — по каким принципам мы выбираем один определённый «npsa=4000213» среди прочих.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2014-11-24T01:17:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88611#p88611</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:как сохранить данные с txt файла?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88610#p88610" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>alexii пишет:</cite><blockquote><p>Чтобы «подсказать код» надо, чтобы:</p><p>1. Вы упаковали в архив и выложили на RGhost образец реального файла.<br />2. Указали принципы — в деталях — по которым будет происходить поиск и отбор информации.</p><p>Пока мы вертимся всё вокруг да около непонятно чего.</p></blockquote></div><p>реальный образец не могу показать, так как он служит для работы и абсолютно анонимный мы его купили.<br />Вот пример </p><div class="codebox"><pre><code>
&lt;html class=&quot;no-js&quot; 
&lt;!--
&lt;globe-environment environment=&quot;prod&quot; application=&quot;globe&quot; dataCenter=&quot;ny&quot; serverName=&quot;nyglobe1&quot; /&gt;
&lt;globe-server version=&quot;1.14.0&quot; vendor=&quot;&quot; title=&quot;Globe Server&quot; /&gt;
&lt;globe-resources version=&quot;1.14.0&quot; loadStartTime=&quot;1416353282307&quot; loadTimeTaken=&quot;1659&quot; /&gt;
npsa=4000213
--&gt;
=============================================
дальше идёт код который мне не нужен и там тоже есть
npsa=4000213
&lt;head&gt;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DarkJoker1992]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32574</uri>
			</author>
			<updated>2014-11-23T22:39:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88610#p88610</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:как сохранить данные с txt файла?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88608#p88608" />
			<content type="html"><![CDATA[<p>Чтобы «подсказать код» надо, чтобы:</p><p>1. Вы упаковали в архив и выложили на RGhost образец реального файла.<br />2. Указали принципы — в деталях — по которым будет происходить поиск и отбор информации.</p><p>Пока мы вертимся всё вокруг да около непонятно чего.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2014-11-23T22:09:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88608#p88608</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:как сохранить данные с txt файла?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88602#p88602" />
			<content type="html"><![CDATA[<p>Извиняюсь ещё раз, подскажите пожалуйста код,для удаления определённых строк, а то в файле есть несколько окончаний 4000213 и он захватывает то что не нужно. хотелось бы сразу прописать в vbs что бы и удаляла.</p>]]></content>
			<author>
				<name><![CDATA[DarkJoker1992]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32574</uri>
			</author>
			<updated>2014-11-23T20:46:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88602#p88602</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:как сохранить данные с txt файла?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88599#p88599" />
			<content type="html"><![CDATA[<p>Замените в приведённом мною выше коде «.Write strContent» на «.Write Replace(strContent, &quot;@&quot;, &quot;&quot;)».</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2014-11-23T16:42:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88599#p88599</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:как сохранить данные с txt файла?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88591#p88591" />
			<content type="html"><![CDATA[<p>Подскажите пожалуйста, можно&nbsp; добавить удаление определённых символов из выходного файла? допустим удалить все @ символы в файле.<br />Спасибо большое за внимание.<br />этот код у меня ошибку выдаёт <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" /><br /></p><div class="codebox"><pre><code> With CreateObject(&quot;Scripting.FileSystemObject&quot;) :
  .OpenTextFile(&quot;C:\index.htm&quot;, 2, True).Write Replace(.OpenTextFile(&quot;C:\code.txt&quot;,,,-1).ReadAll, &quot;@&quot;, &quot;&quot;) :
  End With  :</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DarkJoker1992]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32574</uri>
			</author>
			<updated>2014-11-23T13:33:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88591#p88591</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:как сохранить данные с txt файла?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88586#p88586" />
			<content type="html"><![CDATA[<p>Спасибо большое.</p>]]></content>
			<author>
				<name><![CDATA[DarkJoker1992]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32574</uri>
			</author>
			<updated>2014-11-23T11:37:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88586#p88586</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:как сохранить данные с txt файла?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88575#p88575" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Option Explicit

Dim strSourceFile
Dim strDestFile

Dim strContent


strSourceFile = &quot;E:\Песочница\0409\0001.txt&quot;
strDestFile   = &quot;E:\Песочница\0409\0002.txt&quot;

With WScript.CreateObject(&quot;Scripting.FileSystemObject&quot;)
    If .FileExists(strSourceFile) Then
        If .FolderExists(.GetParentFolderName(strDestFile)) Then
            With .OpenTextFile(strSourceFile)
                strContent = .ReadAll()
                .Close
            End With
            
            With WScript.CreateObject(&quot;VBScript.RegExp&quot;)
                .Pattern = &quot;.*?(&lt;html&gt;[\s\S]*4000213).*&quot;
                .IgnoreCase = True
                
                If .Test(strContent) Then
                    strContent = .Execute(strContent).Item(0).Submatches.Item(0)
                End If
            End With
            
            With .CreateTextFile(strDestFile, True)
                .Write strContent
                .Close
            End With
        Else
            WScript.Echo &quot;Destination folder [&quot; &amp; .GetParentFolderName(strDestFile) &amp; &quot;] not exists.&quot;
            WScript.Quit 2
        End If
    Else
        WScript.Echo &quot;Source file [&quot; &amp; strSourceFile &amp; &quot;] not found.&quot;
        WScript.Quit 1
    End If
End With

WScript.Quit 0
</code></pre></div><p>Если нужен не «жадный» поиск (например, не последний найдённый «4000213», а первый), используйте «.Pattern = &quot;.*?(&lt;html&gt;[\s\S]*<strong><span style="color: red">?</span></strong>4000213).*&quot;».</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2014-11-22T20:54:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88575#p88575</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VBS:как сохранить данные с txt файла?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=88571#p88571" />
			<content type="html"><![CDATA[<p>Здравствуйте, подскажите как сохранить текст из стороннего файл начиная с &lt;html&gt; заканчивая 4000213.<br />разумеется нужно что бы &lt;html&gt; и 4000213 тоже были в out файле.<br />Спасибо за внимание.</p>]]></content>
			<author>
				<name><![CDATA[DarkJoker1992]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32574</uri>
			</author>
			<updated>2014-11-22T18:35:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=88571#p88571</id>
		</entry>
</feed>
