I wrote an Applescript within Automator for use in Sequoia to set wake and shutdown times every day.
I attach the code or if you prefer copy it from the screen shot.
____________________________________
on run {input, parameters}
set {Wake_hour, Wake_minute} to words of text returned of (display dialog "Enter Wake time in form hh:mm " default answer "")
set {Shutdown_hour, Shutdown_minute} to words of text returned of (display dialog "Enter Shutdown time in form hh:mm " default answer "")
set Wake_time to Wake_hour & ":" & Wake_minute
set Shutdown_time to Shutdown_hour & ":" & Shutdown_minute
display dialog "Wake time:" & Wake_time & return & "Shutdown: " & Shutdown_time
set User_name to "Add your admin user name" --- If don't put the administrator's name here then it asks for it on run
set pass_word to " Add in the admin password" --- also need this if you don't want to have to enter it at run time
global User_name
do shell script "pmset repeat wakeorpoweron MTWRFSU " & Wake_time & ":00 shutdown MTWRFSU " & Shutdown_time & ":00" user name User_name password pass_word with administrator privileges
return input
end run
__________________________
This avoids “sudo” command by appending “with administrator privileges”.
For this to work you have to enter your admin account name for “user_name” and its password for “pass_word” in the Applescript before compiling/running it.
With these amendments you can then change the workflow to an application.
When run it asks for the startup time in the form HH:MM then shutdown in same HH:MM.
Having set the times it runs terminal so you can confirm it has worked.
