AuthorizationMBS pmset error

I try to wake up a sleeping Mac on a certain time.
I does not, and when manually awaken it says access denied with error code -60005.
What should I do differently?
Here is the code:

var a as new AuthorizationMBS
var d,t,s(2) as string
var e as integer

s(0) = “schedule”
s(1) = “wake”
d = right(zeros+str(dt.Month),2)+“/”+right(zeros+str(dt.Day),2)+“/”+right(str(dt.Year),4)
t = right(zeros+str(pHour),2)+“:”+right(zeros+str(pMinute),2)+“:”+right(zeros+str(pSecond),2)
s(2) = gf+d+" "+t+gf

if a.SimpleNewAuthorization then ’ create

a.Execute(“/usr/bin/pmset”,s,true) ’ and run it

if a.LastError <> 0 then
MsgBox "Lasterror on Execute: "+str(a.LastError)
else
e = a.Wait ’ wait for process to terminate. Returns PID
if a.LastError <> 0 then
MsgBox "Lasterror on Wait: "+str(a.LastError)
end
end
msgbox a.ReadStream(1024)
end

So I start with a basic snippet to run

dim s() as String
dim p,t as String
dim a as AuthorizationMBS
dim e as integer

p = "/usr/bin/whoami"

a=new AuthorizationMBS

if a.SimpleNewAuthorization then // create
  System.DebugLog "SimpleNewAuthorization "+a.LastError.ToString
  
  a.Execute(p,s,true) // and run it
  System.DebugLog "Execute "+a.LastError.ToString
  
  if a.LastError<>0 then
    MsgBox "Lasterror on Execute: "+str(a.LastError)
  else
    e=a.Wait // wait for process to terminate. Returns PID
    System.DebugLog "Wait "+a.LastError.ToString
    
  end if
  EditField3.text=a.ReadStream(1024)
end if

and I modify it to run pmset:

dim s() as String
dim p,t as String
dim a as AuthorizationMBS
dim e as integer

p = "/usr/bin/pmset"
s.Append "schedule"
s.Append "wake"
s.Append "06/12/2025 09:00:00"

a=new AuthorizationMBS

if a.SimpleNewAuthorization then // create
  System.DebugLog "SimpleNewAuthorization "+a.LastError.ToString
  
  a.Execute(p,s,true) // and run it
  System.DebugLog "Execute "+a.LastError.ToString
  
  if a.LastError<>0 then
    MsgBox "Lasterror on Execute: "+str(a.LastError)
  else
    e=a.Wait // wait for process to terminate. Returns PID
    System.DebugLog "Wait "+a.LastError.ToString
    
  end if
  EditField3.text=a.ReadStream(1024)
end if

Seems to work as “pmset -g sched” lists it on the Terminal now.

Maybe it’s just the gf you add for extra quotes, which prevents it from working?

I tried with gf = “” (hence no Gänsefüsschen) as in the example I read somewhere.
Nevertheless, same problem occurs: it does not trigger, and when manually awaken it presents error code -60005… And a.readstream is empty.

If I try it in Terminal:
sudo pmset schedule wake “06/12/25 17:01:00”
it works.
Under Xojo there is still this password? problem…