My own productivity app
tvogelaar at de-mare.nl
Wed Nov 30 09:17:50 CET 2016
Thank you, Jacqueline and Mike, for your responses.
Jacqueline wrote that LC provides no feedback when it isn't the frontmost app. But is there a way to use MacOS's Notification Center from within LiveCode to tell me things like that?
Mike's solution using a timed loop seems to do the trick to add the MacBreakZ functionality. So the app and site blocking functionality is the only thing that is hard to implement. But for that, I could use (hey)Focus; this app is the least intrusive of the three I mentioned. So I could make my own Pomodoro-timer with a ToDo-list and the MacBreakZ-functionality, and let (hey)Focus do the site/app blocking.
Heck, key logging, site blocking, disabling of other apps… It sounds like I'm brewing up something evil. (But I'm not.)
Thanks for the help.
With kind regards,
> The only way I know of to monitor keystrokes/mouse events is with a loop. Check to see if keysdown() is empty, and "if the mouse is down.” Certain things won't trigger the mouse is down such as grabbing a title bar and dragging it around (on windows) but most other clicks will work fine.
> For a simple test, I made a stack with a field and a button. the following code is in the button.
> local sRunning
> on mouseUp
> if sRunning is empty then put false into sRunning
> put not sRunning into sRunning
> end mouseUp
> command loopit
> if sRunning then
> if the keysdown is not empty then
> put keysdown() into field 1
> put empty into field 1
> end if
> if the mouse is down then
> set the backgroundcolor of field 1 to red
> set the backgroundcolor of field 1 to empty
> end if
> send loopit to me in 100 millisec
> end if
> end loopit
> Placing the window where its visible but not focused and work with another program. Every click the field turns red, every keypress and the keys that are down show up in the field. With a delay of 100 seconds its possible to miss an event, but if a person were actually working actively most keypresses and clicks will be caught. It should be possible to use either applescript or vbscript to note what window is focused, though im not sure how to tell if one is working in a facebook tab or not.
>> The problem I see here is that LC has no knowledge of what other apps are in use, and provides no feedback when it isn't the frontmost app. There may be shell calls you could use to get some of the information, but I kind of doubt there's a way to monitor keystrokes and that sort of thing.
More information about the use-livecode