- Code: Select all
set value of variable "Month" to (month of (current date)) as text
- Code: Select all
set value of variable "DayofWeek" to (weekday of (current date)) as text
These are being used as Conditions in Schedules
Thanks
set value of variable "Month" to (month of (current date)) as text
set value of variable "DayofWeek" to (weekday of (current date)) as text
import datetime
now = datetime.datetime.now()
Month = now.strftime('%B')
DayofWeek = now.strftime('%A')
kwijibo007 wrote:I'm assuming you want the variables to be the name of the day e.g 'Monday' and the name of the month e.g June.
- Code: Select all
import datetime
now = datetime.datetime.now()
Month = now.strftime('%B')
DayofWeek = now.strftime('%A')
import datetime
now = datetime.datetime.now()
Month = now.strftime('%B')
DayofWeek = now.strftime('%A')
indigo.variable.updateValue(314742858, Month)
indigo.variable.updateValue(1928699259, DayofWeek)
import datetime
now = datetime.datetime.now()
DayofWeek = now.strftime('%A')
indigo.variable.updateValue(314742858, DayofWeek)
import datetime
now = datetime.datetime.now()
Month = now.strftime('%B')
indigo.variable.updateValue(314742858, Month)
set value of variable "DayofWeek" to (weekday of (current date)) as text
import datetime
now = datetime.datetime.now()
DayofWeek = now.strftime('%A')
indigo.variable.updateValue(123456789, DayofWeek)
CraigM wrote:Thanks to everyone for getting this to work BUT:
Can someone explain why the Applescript code went in the Schedule/Condition/if script returns true screen:
- Code: Select all
set value of variable "DayofWeek" to (weekday of (current date)) as text
And the Python code goes in as a Server Action
- Code: Select all
import datetime
now = datetime.datetime.now()
DayofWeek = now.strftime('%A')
indigo.variable.updateValue(123456789, DayofWeek)
import datetime
tomorrowWeekday = indigo.server.getTime().date() + datetime.timedelta(days=1)
indigo.variable.updateValue(421598678, str(tomorrowWeekday))
tomorrowWeekday.strftime("%A")
Users browsing this forum: No registered users and 11 guests