<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; HTA,VBS: Автообновление приложения и скриптов]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11334&amp;type=atom" />
	<updated>2016-02-19T07:16:36Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=11334</id>
		<entry>
			<title type="html"><![CDATA[Re: HTA,VBS: Автообновление приложения и скриптов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101222#p101222" />
			<content type="html"><![CDATA[<p>Разумеется. Shell.Open я вставил для демонстрации. Вообще hta можно запускать прямо этим vbs, ничего не меняя в самом hta, если такой вариант устроит.</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2016-02-19T07:16:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101222#p101222</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: HTA,VBS: Автообновление приложения и скриптов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101221#p101221" />
			<content type="html"><![CDATA[<p>Создал две папки на диске С, local и server. Запускаю скрипт с следующим кодом, и начинают постоянно открываться окна программы.</p><div class="codebox"><pre><code>&lt;HTML&gt;
&lt;HEAD&gt;
&lt;TITLE&gt;Update&lt;/TITLE&gt;
&lt;HTA:APPLICATION
    ID=&quot;HtaUpdate&quot;
    VERSION=&quot;4.00&quot; &#039;local
    APPLICATIONNAME=&quot;HtaUpdate&quot;
    SYSMENU=&quot;yes&quot;
    MAXIMIZEBUTTON=&quot;yes&quot;
    MINIMIZEBUTTON=&quot;yes&quot;
    BORDER=&quot;thin&quot;
    INNERBORDER=&quot;thin&quot;
    SCROLL=&quot;auto&quot;
    SINGLEINSTANCE=&quot;yes&quot;
    WINDOWSTATE=&quot;maximize&quot;
&gt;

&lt;SCRIPT TYPE=&quot;text/vbscript&quot; LANGUAGE=&quot;VBScript&quot;&gt;
	ServerPath = &quot;C:\server\&quot;
	LocalPath = &quot;C:\local\&quot;
	FileName  = &quot;Test.hta&quot;

Sub Window_OnLoad()
    CheckForUpdates
End Sub

Sub CheckForUpdates
		Set Shell  = CreateObject(&quot;Shell.Application&quot;)
		If Shell.NameSpace(ServerPath).ParseName(FileName).ModifyDate &gt; Shell.NameSpace(LocalPath).ParseName(FileName).ModifyDate Then _
		Folder.CopyHere ServerPath &amp; FileName, 20
		Shell.Open(LocalPath &amp; FileName)
		Update.innerhtml = HtaUpdate.version
end sub

&lt;/script&gt;
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;H1&gt;Update&lt;/H1&gt;
&lt;P&gt; &lt;/P&gt;
&lt;SPAN ID=&quot;Update&quot;&gt; HtaUpdate.version&lt;/SPAN&gt;
&lt;P&gt; &lt;/P&gt;
&lt;/SPAN&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P id=footer&gt;
&lt;span id=&quot;AppName&quot;&gt;Application Name&lt;/SPAN&gt;, Version &lt;SPAN ID=&quot;AppVersion&quot;&gt;&lt;/SPAN&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[shade45]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33296</uri>
			</author>
			<updated>2016-02-19T07:02:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101221#p101221</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: HTA,VBS: Автообновление приложения и скриптов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101206#p101206" />
			<content type="html"><![CDATA[<p>Проще сравнивать по дате модификации:<br /></p><div class="codebox"><pre><code>SharePath = &quot;\\10.2.10.93\c$\2\&quot;
LocalPath = &quot;C:\TestFolder\&quot;
FileName  = &quot;Test.hta&quot;

Set Shell  = CreateObject(&quot;Shell.Application&quot;)
Set Folder = Shell.NameSpace(LocalPath)

If Shell.NameSpace(SharePath).ParseName(FileName).ModifyDate &gt; Folder.ParseName(FileName).ModifyDate Then _
Folder.CopyHere SharePath &amp; FileName, 20
Shell.Open(LocalPath &amp; FileName)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2016-02-18T09:12:56Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101206#p101206</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: HTA,VBS: Автообновление приложения и скриптов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101204#p101204" />
			<content type="html"><![CDATA[<p>Вот так отслеживает изменение, по текстовому файлу version в папке с программой, а ваш способ, можете поподробнее описать?, тоже сделать проверку подобную и в если текущая версия &lt; версии на сервере, то начинается копирование?, не получилось запустить.</p><div class="codebox"><pre><code>&lt;HTML xmlns:IE&gt;
&lt;HEAD&gt;
&lt;TITLE&gt;Update&lt;/TITLE&gt;
&lt;HTA:APPLICATION
    ID=&quot;Update&quot;
    VERSION=&quot;2.11&quot;
    APPLICATIONNAME=&quot;Update&quot;
    SYSMENU=&quot;yes&quot;
    MAXIMIZEBUTTON=&quot;yes&quot;
    MINIMIZEBUTTON=&quot;yes&quot;
    BORDER=&quot;thin&quot;
    INNERBORDER=&quot;thin&quot;
    SCROLL=&quot;auto&quot;
    SINGLEINSTANCE=&quot;yes&quot;
&gt;

&lt;SCRIPT TYPE=&quot;text/vbscript&quot; LANGUAGE=&quot;VBScript&quot;&gt;
Option Explicit
Dim strAppId, strAppName, strAppVer
Const ROOT_URL  = &quot;\\10.2.10.93\c$\2\&quot;
Const FILE_NAME = &quot;version&quot;
strAppId        = Update.ID
strAppName      = Update.ApplicationName
strAppVer       = Update.Version


Sub Window_OnLoad()
    CheckForUpdates
    AppName.InnerHTML   = strAppName
    AppVersion.InnerHTML    = strAppVer
End Sub

Sub CheckForUpdates()
    Dim strFullUrlWithoutExtension, strCurrentVer, strLatestVer,Path
    strFullUrlWithoutExtension = ROOT_URL &amp; strAppId &amp; &quot;/&quot; &amp; FILE_NAME
    &#039; Change cursor to hourglass while checking for update
    Document.Body.Style.Cursor = &quot;wait&quot;
	strCurrentVer = strAppVer
    strLatestVer  = ParseTextFromHTML( strFullUrlWithoutExtension &amp; &quot;.txt&quot;)
    If Err.Number = 0 Then
        If strCurrentVer &lt; strLatestVer then 
		 Update1.InnerHTML = &quot;&lt;p&gt; You are using an invalid version (&quot; &amp; strCurrentVer _
                             &amp; &quot;) of the &quot; &amp; strAppName _
                             &amp; &quot;.&lt;br/&gt;The latest valid version is &quot;    _
                             &amp; strLatestVer &amp; &quot; and it is available &quot; _
                             &amp; &quot;&lt;a href=&quot;&quot; strfullurlwithoutextension=&quot;&quot;&gt;here&lt;/a&gt;.&lt;p/&gt;&lt;p/&gt;&lt;p/&gt;&quot;
	 else
     
            Update1.InnerHTML = &quot;&lt;p&gt;You are using version &quot; &amp; strCurrentVer _
                             &amp; &quot; of the &quot; &amp; strAppName _
                             &amp; &quot;.&lt;br/&gt;An update to version &quot; _
                             &amp; strLatestVer &amp; &quot; is available &quot; _
                             &amp; &quot;&lt;a href=&quot;&quot; strfullurlwithoutextension=&quot;&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;p/&gt;&lt;p/&gt;&lt;p/&gt;&quot;
        End If
    Else
        &#039;error.
        Update1.InnerHTML = &quot;&lt;p&gt;The version number could not be retrieved from:&lt;br/&gt;&quot; &amp; strFullUrlWithoutExtension &amp; &quot;.txt.&lt;/p&gt;&lt;p/&gt;&lt;p/&gt;&lt;p/&gt;&quot;
        &#039; Release the object and return to default error handling
        On Error Goto 0
    End If
    &#039; Change cursor back to default
    Document.Body.Style.Cursor = &quot;default&quot;
End Sub


Function ParseTextFromHTML( ROOT_URL )
    Dim objIE
    &#039; Set the default value
    ParseTextFromHTML = &quot;&quot;
    &#039; Temporarily disable error handling
    On Error Resume Next
    &#039; Create an IE object
    Set objIE = CreateObject( &quot;InternetExplorer.Application&quot; )
    &#039; Load the requested URL
    objIE.Navigate ROOT_URL
    &#039; Wait for the requested URL to become available
    While objIE.Busy
    Wend
    &#039; Retrieve the body text
    ParseTextFromHTML = objIE.Document.Body.InnerText
    &#039; Release the object and return to default error handling
    On Error Goto 0
    objIE.Quit
    Set objIE = Nothing
End Function
&lt;/SCRIPT&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;DIV ALIGN=&quot;center&quot;&gt;
&lt;H1&gt;HTA Update Demo&lt;/H1&gt;
&lt;P&gt; &lt;/P&gt;
&lt;SPAN ID=&quot;Update1&quot;&gt; &lt;/SPAN&gt;
&lt;P&gt; &lt;/P&gt;
&lt;/SPAN&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P id=footer&gt;
&lt;SPAN ID=&quot;AppName&quot;&gt;Application Name&lt;/SPAN&gt;, Version &lt;SPAN ID=&quot;AppVersion&quot;&gt;0.01&lt;/SPAN&gt;,  © 2009
&lt;/P&gt;
&lt;/DIV&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[shade45]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33296</uri>
			</author>
			<updated>2016-02-18T08:33:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101204#p101204</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: HTA,VBS: Автообновление приложения и скриптов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101200#p101200" />
			<content type="html"><![CDATA[<p>Покажу на примере VBS:<br /></p><div class="codebox"><pre><code>Path = &quot;\\10.2.10.93\c$\2\&quot;
CreateObject(&quot;Shell.Application&quot;).NameSpace(CreateObject(&quot;Scripting.FileSystemObject&quot;)._
GetParentFolderName(WScript.ScriptFullName)).CopyHere Path &amp; WScript.ScriptName, 20</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2016-02-18T06:24:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101200#p101200</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[HTA,VBS: Автообновление приложения и скриптов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101196#p101196" />
			<content type="html"><![CDATA[<p>Здравствуйте, есть приложение на .hta, появилась необходимость его обновления, чтобы не выкачивать весь клиент, а обновить только, сами скрипты.</p><p>Начал писать обработчик, проверку понятно как выполнить, но как выкачивать сам файл и заменить его...<br /></p><div class="codebox"><pre><code>&lt;HTML&gt;
&lt;HEAD&gt;
&lt;TITLE&gt;Update&lt;/TITLE&gt;
&lt;HTA:APPLICATION
    ID=&quot;HtaUpdate&quot;
    VERSION=&quot;0.00&quot;
    APPLICATIONNAME=&quot;HtaUpdate&quot;
    SYSMENU=&quot;yes&quot;
    MAXIMIZEBUTTON=&quot;yes&quot;
    MINIMIZEBUTTON=&quot;yes&quot;
    BORDER=&quot;thin&quot;
    INNERBORDER=&quot;thin&quot;
    SCROLL=&quot;auto&quot;
    SINGLEINSTANCE=&quot;yes&quot;
    WINDOWSTATE=&quot;maximize&quot;
&gt;


&lt;SCRIPT TYPE=&quot;text/vbscript&quot; LANGUAGE=&quot;VBScript&quot;&gt;

Option Explicit
Dim strAppId, strAppName, strAppVer
Const ROOT_URL  = &quot;\\10.2.10.93\c$\2\&quot; &#039;путь для загрузки
Const FILE_NAME = &quot;version&quot;				&#039; имя файла
strAppId        = HtaUpdate.ID			&#039; название файла - ID
strAppName      = HtaUpdate.ApplicationName 	&#039;имя приложение в титле
strAppVer       = HtaUpdate.Version			&#039;версия приложения - текущая


Sub Window_OnLoad()
    CheckForUpdates
    AppName.InnerHTML   = strAppName
    AppVersion.InnerHTML    = strAppVer
End Sub

Sub CheckForUpdates
	strCurrentVer = strAppVer 	&#039; текущая версия = версии приложения
	strLatestVer  =  &#039; последняя версия = лежит на сервере

	If strLatestVer &gt; strCurrentVer Then
	Update.InnerHTML = &quot;&lt;p&gt; Вы используете версию (&quot; &amp; strCurrentVer _
                             &amp; &quot;) приложения - &quot; &amp; strAppName _
							 &amp; &quot;.&lt;br/&gt;Последняя версия приложения&quot;    _
                             &amp; strLatestVer &amp; &quot; доступа &quot; _
                             &amp; &quot;&lt;a href=&quot;&quot; strfullurlwithoutextension=&quot;&quot;&gt;здесь&lt;/a&gt;.&lt;p/&gt;&lt;p/&gt;&lt;p/&gt;&quot;
	end if
	
	If strLatestVer &lt; strCurrentVer Then
            Update.InnerHTML = &quot;&lt;p&gt;Вы используете последнию версию &quot; &amp; strCurrentVer _
                             &amp; &quot; приложения - &quot; &amp; strAppName &quot;&lt;/p&gt;&quot;
        End If
end sub

&lt;/SCRIPT&gt;

&lt;/SCRIPT&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;DIV ALIGN=&quot;center&quot;&gt;
&lt;H1&gt;Update&lt;/H1&gt;
&lt;P&gt; &lt;/P&gt;
&lt;SPAN ID=&quot;Update&quot;&gt; &lt;/SPAN&gt;
&lt;P&gt; &lt;/P&gt;
&lt;/SPAN&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P id=footer&gt;
&lt;SPAN ID=&quot;AppName&quot;&gt;Application Name&lt;/SPAN&gt;, Version &lt;SPAN ID=&quot;AppVersion&quot;&gt;&lt;/SPAN&gt;
&lt;/P&gt;
&lt;/DIV&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[shade45]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33296</uri>
			</author>
			<updated>2016-02-18T04:17:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101196#p101196</id>
		</entry>
</feed>
