Prevent Client from Sleeping

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Prevent Client from Sleeping

4D Tech mailing list


To:     [hidden email]
From:   Jim Medlen
Company:        Functional Devices, Inc.
Subject:        Prevent Client from Sleeping
Date:   Wednesday, August 7, 2019


 Looking for ideas or thoughts on generating an event that will prevent the client machine from sleeping?

I am trying to prevent clients from Sleeping when connected to a 4D server.

The POST KEY and POST EVENT both say "Its effect is as if the user actually entered a character on the keyboard.”

but these events do not prevent the screen saver from activating.

It appears that the OS does not see this as a user event.


Thanks,

Jim Medlen

Computer & Information Systems
Functional Devices, Inc.
[hidden email]<mailto:[hidden email]>

Main:   (765) 883-5538 x 5735
Direct: (765) 416-6835
FAX:    (765) 883-7505

http://www.functionaldevices.com

This email was transmitted on 100 percent recycled electrons

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Prevent Client from Sleeping

4D Tech mailing list
Some ideas - none of these tested or tried :)

LEP - and use commands to bring the desktop to the fore and then 4D?
Move mouse to the menu bar, and post a click?

On launch of 4D use LEP to reset screen saver timeout, reset on quit
On launch of 4D use LEP to reset power timeout, reset on quit

LEP to open and then close a desktop window
open an off screen window (in 4D, with a web area), launch a connection
to a safe url (apple or microsoft).

maybe even just touch the disk... pick a folder (desktop, or your
database) and Get Document list
write an empty file to some safe location, and delete it.

Chip

On Wed, 7 Aug 2019 17:59:46 +0000, Jim Medlen via 4D_Tech wrote:

>
>
> To:     [hidden email]
> From:   Jim Medlen
> Company:        Functional Devices, Inc.
> Subject:        Prevent Client from Sleeping
> Date:   Wednesday, August 7, 2019
>
>
>  Looking for ideas or thoughts on generating an event that will
> prevent the client machine from sleeping?
>
> I am trying to prevent clients from Sleeping when connected to a 4D server.
>
> The POST KEY and POST EVENT both say "Its effect is as if the user
> actually entered a character on the keyboard.”
>
> but these events do not prevent the screen saver from activating.
>
> It appears that the OS does not see this as a user event.
>
>
> Thanks,
>
> Jim Medlen
>
> Computer & Information Systems
> Functional Devices, Inc.
> [hidden email]<mailto:[hidden email]>
>
> Main:   (765) 883-5538 x 5735
> Direct: (765) 416-6835
> FAX:    (765) 883-7505
>
> http://www.functionaldevices.com
>
> This email was transmitted on 100 percent recycled electrons
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[hidden email]
> **********************************************************************
---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

RE: Prevent Client from Sleeping

4D Tech mailing list
Hi Jim,

I am not sure that you will be able to effectively prevent the computer from sleeping.

Here are some examples that you will be unable to intercept:

- the user closes their laptop lid (the machine will most likely go to sleep - this is adjusted in power settings on Windows)

- the user selects SLEEP or STANDBY from the power/shutdown options (the machine will certainly go to sleep)

- the user uses the Windows Key + L key combination to lock the computer (moving the mouse or pasting keys will be ineffective if the machine is locked)

There may be others too.

-Tim



**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Prevent Client from Sleeping

4D Tech mailing list
In reply to this post by 4D Tech mailing list
On the Mac you can use "caffeinate" via LEP.


NAME
     caffeinate -- prevent the system from sleeping on behalf of a utility

SYNOPSIS
     caffeinate [-disu] [-t timeout] [-w pid] [utility arguments...]

DESCRIPTION
     caffeinate creates assertions to alter system sleep behavior.  If no assertion flags are specified, caffeinate creates an assertion to prevent idle sleep.
     If a utility is specified, caffeinate creates the assertions on the utility's behalf, and those assertions will persist for the duration of the utility's
     execution. Otherwise, caffeinate creates the assertions directly, and those assertions will persist until caffeinate exits.

     Available options:

     -d      Create an assertion to prevent the display from sleeping.

     -i      Create an assertion to prevent the system from idle sleeping.

     -m      Create an assertion to prevent the disk from idle sleeping.

     -s      Create an assertion to prevent the system from sleeping. This assertion is valid only when system is running on AC power.

     -u      Create an assertion to declare that user is active. If the display is off, this option turns the display on and prevents the display from going into
             idle sleep. If a timeout is not specified with '-t' option, then this assertion is taken with a default of 5 second timeout.

     -t      Specifies the timeout value in seconds for which this assertion has to be valid. The assertion is dropped after the specified timeout. Timeout value
             is not used when an utility is invoked with this command.

     -w      Waits for the process with the specified pid to exit. Once the the process exits, the assertion is also released.  This option is ignored when used
             with utility option.



John DeSoi, Ph.D.


> On Aug 7, 2019, at 12:59 PM, Jim Medlen via 4D_Tech <[hidden email]> wrote:
>
> Looking for ideas or thoughts on generating an event that will prevent the client machine from sleeping?

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Prevent Client from Sleeping

4D Tech mailing list
In reply to this post by 4D Tech mailing list
The question is to why. I would think you just want to stop the drive from spinning down. Most companies hate when you do that as they want computer to lock after as short period of inactivity

On Mac there is a setting to stop drive from spinning down. I bet there is on windows as well

Regards

Chuck
------------------------------------------------------------------------------------------------
 Chuck Miller Voice: (617) 739-0306
 Informed Solutions, Inc. Fax: (617) 232-1064      
 mailto:cjmiller<AT SIGN>informed-solutions.com
 Brookline, MA 02446 USA Registered 4D Developer                
       Providers of 4D and Sybase connectivity
          http://www.informed-solutions.com 
------------------------------------------------------------------------------------------------
This message and any attached documents contain information which may be confidential, subject to privilege or exempt from disclosure under applicable law.  These materials are intended only for the use of the intended recipient. If you are not the intended recipient of this transmission, you are hereby notified that any distribution, disclosure, printing, copying, storage, modification or the taking of any action in reliance upon this transmission is strictly prohibited.  Delivery of this message to any person other than the intended recipient shall not compromise or waive such confidentiality, privilege or exemption from disclosure as to this communication.

> On Aug 7, 2019, at 1:59 PM, Jim Medlen via 4D_Tech <[hidden email]> wrote:
>
> I am trying to prevent clients from Sleeping when connected to a 4D server.

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Prevent Client from Sleeping

4D Tech mailing list
In reply to this post by 4D Tech mailing list
does not 4D already provide sleep detection with v16 and new network layer?

https://blog.4d.com/application-sleep-notification/

solutions such as this:

https://github.com/miyako/4d-plugin-system-notification/

should no longer be necessary.

---

c.f.

https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setthreadexecutionstate
https://developer.apple.com/documentation/foundation/nsactivityoptions?language=objc

---

also POST KEY is internal to 4D.

you need other means to post a system keydown event

https://github.com/miyako/4d-plugin-virtual-key

> 2019/08/08 2:59、Jim Medlen via 4D_Tech <[hidden email]>のメール:
> I am trying to prevent clients from Sleeping when connected to a 4D server.




**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************