Skip to main content

Actr_Sleep (function reference)

By January 1, 2024January 25th, 2024Online Help, Troi Activator Plug-in
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

switches determines the behavior of this command
datetimestamp (optional) the timestamp indicating the date and time the computer must wake up

Switches

switches can be one of this:

-SleepNow sleep now, the computer will not wake automatically
-TillDateTime sleep 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:

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

Other errors may be returned.

Originated in

Activator Plug-in 3.5

Compatibility

FileMaker Pro 17 to 2023

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/2019" ; "12:22:45 PM" ) ]

This last command puts the computer into sleep and will wake it up on December 16, 2019, at 12:22:45 PM. Note that this example is somewhat simplified, normally you should not use hard coded 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”.

Used in example file

Sleep.fmp12

Related functionFunction badge

Actr_Shutdown

Related script stepScript step badge

Put Computer to Sleep

Related topics

Activator Plug-in online help (overview)


Online Help Page for Activator Plug-in for 17 to 2023 –> Actr_Sleep (actrp4617) 2024-0125 14:54:10