Actr_Sleep (function reference)

Activator Plug-in for FileMaker Pro

Actr_Sleep

Put the computer into sleep mode (if present). You can optionally specify when to wake up again.

SyntaxFunction badge

Actr_Sleep ( switches ; datetimestamp )

Parameters

switchesdetermines the behaviour of this command
datetimestamp(optional) the timestamp indicating the date and time the computer must wake up

Switches

switches can be one of this:

-SleepNowsleep now, the computer will not wake automatically
-TillDateTimesleep until the specified date/time

Returned Result

Data type returned

Error code

Result

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:

0no error
$$-50parameter error, check if your parameters are correct
$$-4126the date specified should be in the future (kErrDateInPast)
$$-4131this computer does not have suitable hardware to do this

Other errors may be returned.

Originated in

Activator Plug-in 3.5

Compatibility

FileMaker Pro 12 to 16

Considerations

– 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.

Example

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.

Example 2

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”.

Related functionFunction badge

Actr_Shutdown

Related topics

Activator Plug-in online help (overview)


Online Help Page for Activator Plug-in for 12 to 16 –> Actr_Sleep (actrp4617) 2017-0822 18:01:44