0

I'm relatively new to OSX (running Mavericks), but my goal is to create a script that reminds me to take notes on the day's work. The script will ideally: run upon the user clicking 'Login window' (i.e. lock screen) and prompt the user for whether or not they want to record notes (ok/cancel). If the user answers OK, then the script will ask for a multiline input, then append the date and time, plus that input, to a text file before locking the screen. If the user clicks cancel or 15 seconds pass without interaction, the dialog should be dismissed and the screen will lock.

I'm:

1) unsure about how to prompt the user for multiline input

2) unclear how to trigger the script on the user requesting a return to the login window (lock screen?)

If this can be accomplished through a third-party program/interface, I'm open to that as well. Thanks!

2 Answers 2

1

Keyboard Maestro.

What you want to achieve requires a daemon that runs in the background, launches with the system, and executes customized commands/scripts after detecting a trigger. It's no a small feat if you want to write one that has good stability.

Apart from the keys, Keyboard Maestro has triggers like Startup, System Wake, Login, While Logged In, etc. With some tweaking and compromise, this is the best shot I know.

0

how to prompt the user for multiline input

You can use the following AppleScript:

display dialog "" default answer linefeed

Source: How Can I Create a Multi-Line Input Dialog using Applescript?

how to trigger the script on the user requesting a return to the login window

This depends entirely on how the user is requesting this. You could use an AppleScript Application wrapper to lock after running the aforementioned prompt, or wait for the file to be updated then lock using a Folder Action. There are a number of possibilities here, but that should be a starting point.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .