<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBS: Добавить Функцию Weekday]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=14690&amp;type=atom" />
	<updated>2019-04-06T00:50:14Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=14690</id>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Добавить Функцию Weekday]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133367#p133367" />
			<content type="html"><![CDATA[<p>Например, так:<br /></p><div class="codebox"><pre><code>Option Explicit


Select Case Weekday(Now(), vbUseSystemDayOfWeek)
	Case vbMonday, vbTuesday, vbWednesday, vbThursday, vbFriday
		If DateDiff(&quot;s&quot;, TimeSerial(14, 0, 0), Time()) &gt;= 0 And _
			DateDiff(&quot;s&quot;, TimeSerial(21, 0, 0), Time()) &lt;= 0 Then
			
			WScript.CreateObject(&quot;WScript.Shell&quot;).Run &quot;&quot;&quot;%SystemRoot%\System32\notepad.exe&quot;&quot;&quot;, 1, False
		End If
	Case Else
		&#039; Nothing to do
End Select

WScript.Quit 0
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2019-04-06T00:50:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133367#p133367</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VBS: Добавить Функцию Weekday]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=133346#p133346" />
			<content type="html"><![CDATA[<p>Здравствуйте, подскажите как добавить в данный скрипт условие, при котором он выполнялся не только во временной промежуток, но и по дням недели с понедельника по пятницу.<br /></p><div class="codebox"><pre><code>Dim WshShell
Set WshShell = CreateObject(&quot;WScript.Shell&quot;)
Function InTime( startTime, endTime )
    currentTime = Time()
    InTime = CBool( ( currentTime &gt;= startTime ) And ( currentTime &lt;= endTime ) )
End Function
If InTime( CDate(&quot;14:00&quot;) , CDate(&quot;21:00&quot;) )  Then
set FSO=createobject(&quot;scripting.filesystemobject&quot;) 
WshShell.run &quot;taskkill /f /im notepad.exe&quot;,0 
End If </code></pre></div>]]></content>
			<author>
				<name><![CDATA[lapin9126]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40001</uri>
			</author>
			<updated>2019-04-04T13:47:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=133346#p133346</id>
		</entry>
</feed>
