Put the computer into sleep mode (if present). You can optionally specify when to wake up again.
Actr_Sleep ( switches ; datetimestamp )
|switches||determines the behaviour of this command|
|datetimestamp||(optional) the timestamp indicating the date and time the computer must wake up|
switches can be one of this:
|-SleepNow||sleep now, the computer will not wake automatically|
|-TillDateTime||sleep until the specified date/time|
Data type returned
The returned result is an error code. If successful it returns 0. An error always starts with 2 dollars, followed by the error code. You should always check for errors.
Returned error codes can be:
|$$-50||parameter error, check if your parameters are correct|
|$$-4126||the date specified should be in the future (kErrDateInPast)|
|$$-4131||this computer does not have suitable hardware to do this|
Other errors may be returned.
Activator Plug-in 3.5
FileMaker Pro 12 to 16
– At the moment the time to wake does NOT work, you can only put the computer to sleep.
– This function works on computers that support sleep.
– The function returns before the computer has gone into sleep. Use a Pause/Resume step with 20 seconds pause, to be sure the next step is executed after the sleep.
– Waking up starts at the specified time. It might take a few seconds for the computer to be completely awake. If it is critical that the computer is awake at a specified time, subtract 30 seconds from the wake time.
Set Field [ result ; Actr_Sleep ( "-sleepnow" ) ]
Put the computer to sleep. It will only wake up by the user waking it.
You can also use:
Set Field [ result ; Actr_Sleep ( "-tilldatetime" ; Timestamp ( "12/16/2017" ; "12:22:45 PM" ) ]
This last command puts the computer into sleep and will wake it up on December 16th, 2017, at 12:22:45 PM. Note that this example is somewhat simplified, normally you should not use hardcoded dates like in the above example, as this will only work on a system with US dates. See also example 2, for a more robust example.
We assume that in your FileMaker file the following fields are defined:
gWakeTimeStamp Global, timestamp result Global, text
gWakeTimeStamp can be filled with the date and time the computer must wake up. Add the following script step:
Set Field [ result ; Actr_Sleep ( "-TillDateTime" ; gWakeTimeStamp ) ]
This command will put the computer to sleep and wake the computer on the day and time that are in the global field “gWakeTimeStamp”.