Vb Script Cambiare Testo In Base A L'ora Follow

0
Avatar
Legacy Poster

Hi, I wonder if you can change the text with programming based on time.
example from 8:00am to 13:00am Text= Lunch;
from 13:01am to 20:00pm Text= Dinner.

Is it possible?

3 comments

0
Avatar
Legacy Poster
Comment actions Permalink

Well, it will easily work if you use a time format without colons or other text in it. For example, the 24 hour format that just comes in as "172315" rather than "17:23:15".

You could use this value to run a comparison in the text object, and print the text you need.
0
Avatar
Legacy Poster
Comment actions Permalink

[quote name='nRyder' timestamp='1329168243' post='1720']
Well, it will easily work if you use a time format without colons or other text in it. For example, the 24 hour format that just comes in as "172315" rather than "17:23:15".

You could use this value to run a comparison in the text object, and print the text you need.
[/quote]
Thanks for the reply, but I know well the program could put some sample image or a textual step by step tutorial on what to do .... thanks
0
Avatar
Shotaro Ito
Moderator
Comment actions Permalink

Hi,
Using TimeValue function would help compare time.
Create a text with time datasource ("13:00" or "6:00 PM" etc.)
On Datasource's More options > VB Script, edit "OnProcessData" script like below.
[code]
T = TimeValue(Value)
if T >= TimeValue("08:00") and T <= TimeValue("13:00") Then
Value = "Lunch"
Elseif T >= TimeValue("13:01") and T <= TimeValue("18:00") Then
Value = "Dinner"
Else
Value = "No food for ya"
End if
[/code]
Hope that helps!

Please sign in to leave a comment.