如何根据一天中打开计算机的时间将程序设置为 运行 启动?
How to set a program to run on startup depending on the time of day when the computer is turned on?
我希望我的电脑在我开机时向我致意。很简单,如果你使用这个:
Dim speaks, speech
speaks=”Good morning, sir”
Set speech=CreateObject(“sapi.spvoice”)
speech.Speak speaks
但这在一天中的任何时候都有效。例如,每当我在晚上 7 点打开我的电脑时,它会说,"Good morning, sir"。
是否可以制作一个启动时 运行 的脚本,它根据一天中的时间问候我(例如,"Good afternoon, sir" 之后 12:00 下午)?
如果不是,是否可以运行启动时根据时间不同的脚本文件?比如早上 "goodmorning.vbs",下午 "goodafternoon.vbs",晚上 "goodevening.vbs"?
Dim speaks, speech
DateInfo = Time
if Time() <= TimeValue("12:00am") then speaks="Good morning, sir" else speaks="Good afternoon, sir"
Set speech=CreateObject("sapi.spvoice")
speech.Speak speaks
终于成功了。只需制作一个扩展名为 .vbs 的文件并将其放入您的启动文件夹中,以便您的计算机在启动时向您致意。我还必须转到控制面板,将文本更改为语音设置,以将我电脑的默认语音更改为女性。
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
dim str
if hour(time) < 12 then
Sapi.speak "Good Morning sir. All systems operational. Welcome back."
else
if hour(time) > 12 then
if hour(time) > 16 then
Sapi.speak "Good evening sir. All systems operational. Welcome back."
else
Sapi.speak "Good afternoon sir. All systems operational. Welcome back."
end if
end if
end if
来源:http://www.howtogeek.com/197719/stupid-geek-tricks-how-to-make-your-computer-talk-to-you/
我希望我的电脑在我开机时向我致意。很简单,如果你使用这个:
Dim speaks, speech
speaks=”Good morning, sir”
Set speech=CreateObject(“sapi.spvoice”)
speech.Speak speaks
但这在一天中的任何时候都有效。例如,每当我在晚上 7 点打开我的电脑时,它会说,"Good morning, sir"。
是否可以制作一个启动时 运行 的脚本,它根据一天中的时间问候我(例如,"Good afternoon, sir" 之后 12:00 下午)?
如果不是,是否可以运行启动时根据时间不同的脚本文件?比如早上 "goodmorning.vbs",下午 "goodafternoon.vbs",晚上 "goodevening.vbs"?
Dim speaks, speech
DateInfo = Time
if Time() <= TimeValue("12:00am") then speaks="Good morning, sir" else speaks="Good afternoon, sir"
Set speech=CreateObject("sapi.spvoice")
speech.Speak speaks
终于成功了。只需制作一个扩展名为 .vbs 的文件并将其放入您的启动文件夹中,以便您的计算机在启动时向您致意。我还必须转到控制面板,将文本更改为语音设置,以将我电脑的默认语音更改为女性。
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
dim str
if hour(time) < 12 then
Sapi.speak "Good Morning sir. All systems operational. Welcome back."
else
if hour(time) > 12 then
if hour(time) > 16 then
Sapi.speak "Good evening sir. All systems operational. Welcome back."
else
Sapi.speak "Good afternoon sir. All systems operational. Welcome back."
end if
end if
end if
来源:http://www.howtogeek.com/197719/stupid-geek-tricks-how-to-make-your-computer-talk-to-you/