在Mac上像云应用程序一样自动上传屏幕截图 [英] Automatic screenshot uploading on Mac like Cloud App

查看:333
本文介绍了在Mac上像云应用程序一样自动上传屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Cloud App 具有这个整洁的功能,它会在新的屏幕截图添加时自动上传到桌面。任何想法如何做?

解决方案

你可以自己做类似的事情,而不需要太多的编程方式。在OSX中,您可以配置文件夹操作运行脚本,以便例如,当一个新项目出现在包括桌面的文件夹中时。然后,您可以使用脚本对新文件执行任何操作。



这篇文章在TUAW 包括上传文件到Web服务器的示例命中一个特定的文件夹。



因此,基本上,答案是文件夹操作,或某事正在关注文件夹和发送通知,云应用程序是使用文件夹操作还是使用FSEvents / NSWorkspace或kqueue机制(其中有一个很好的包装类称为 UKKQueue ,如果我记得正确 - 不知道当前我的知识是在那一个!)是另一回事...



你可以在几个不同的层次实现这一点,这取决于你想要的结果,你想要设计什么是你实际做什么,甚至什么样的文件系统的目标。从根本上说,在Cocoa / Objective C中,我想你可能想开始查看 FSEvents 。 / p>

一旦您收到文件更改的通知,我可能会使用 ConnectionKit 做上传 - 任何库,真的,这意味着你不必烦恼套接字级别自己 - 但再次,有很多不同的方式。



取决于你想要解决的问题的水平,以及你是想为别人构建一些东西还是为自己工作。如果我只是想为自己敲击某物,我可能有一些使用Coda的传输应用程序,文件夹操作,或者可能是Hazel,和一个最小的苹果脚本,在最多半小时内,工作对我来说很好...


Cloud App has this neat feature wherein it automatically uploads new screenshots as they are added to the Desktop. Any ideas how this is done?

解决方案

You can do similar things yourself without much in the way of programming. In OSX, you can configure "Folder Actions" to run a script, for example, when a new item appears in a folder, including the Desktop. You can then use the script to do whatever you want with the new files.

This article at TUAW includes an example of uploading files to a web server when they hit a particular folder.

So, basically, the answer is "Folder Actions", or "something's keeping an eye on the folder and sending notifications", at some level. Whether Cloud App uses Folder Actions or watches the folder itself at a lower level, using FSEvents/NSWorkspace, or the kqueue mechanisms (for which there's a nice wrapper class called UKKQueue, if I remember correctly -- don't know how current my knowledge is on that one though!) is another matter...

You could implement this at several different levels, depending on the outcome you want, how you want to design whatever it is you're actually doing, and even what kind of filesystem you're targeting. Fundamentally, in Cocoa/Objective C, I think you probably want to start looking at FSEvents.

Once you've got notifications of the file changes, I'd probably use something like ConnectionKit to do the uploading -- any library at all, really, that means you don't have to bother with the sockets level yourself -- but again, there's a lot of different ways.

Depends, really, what level you're looking to solve the problem at, and whether you want to build something for other people or get something working for yourself. If I just wanted to bash something together for myself, I could probably have something cobbled together using Coda's Transmit app, and Folder Actions, or maybe Hazel, and a minimal bit of Applescript, in a half-hour at most, that would do the job well enough for me...

这篇关于在Mac上像云应用程序一样自动上传屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆