Last active
January 27, 2016 08:06
-
-
Save fvdm/36d4bdf47aab502d5a3a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Only copy new images to another folder: | |
| require ('osx-photostream') ('~/Pictures/iCloud'); | |
| // Do more stuff with them: | |
| var ps = require ('osx-photostream') (); | |
| ps.on ('update', function (file) { | |
| console.log ('New image added: ' + file.filename); | |
| };) | |
| // Or do both and first copy to another folder, | |
| // then tell another app a new image is ready using AppleScript. | |
| var ps = require ('osx-photostream') ('~/Pictures/iCloud'); | |
| var exec = require ('child_process').exec; | |
| ps.on ('copy', function (file) { | |
| // Forward image to friend | |
| exec ('osascript -e "tell application \"Messages\" to send POSIX file \"' + file.copypath + '\" to buddy \"friend@email.tld\" of service \"E:my@email.tld\""'); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment