AppleScript 传输脚本用于上传文件以在 Web 服务器上替换自身

发布于 2024-09-18 08:29:26 字数 283 浏览 6 评论 0原文

因此,我有一个想法,即创建一个方便的小 AppleScript,在我看来,它对于加快将本地文件上传到服务器上同一位置的过程非常方便。

换句话说,您必须在服务器和本地指定主文件夹,但是一旦完成,最好只按“Command”+“Shift”“U”进行上传或其他不在其中的热键组合OS X 用于上传 Finder 中当前选定的文件。

我发现自己经常需要这样做,这会节省很多时间!

有人请告诉我是否有更简单的方法来做到这一点,但我认为这将是一次很好的学习经历。

不过,我需要一些关于如何开始的帮助。

So I have this idea for a handy little AppleScript which in my opinion would be very handy in speeding up the process of uploading a local file, to its same location on the server.

In other words, you have to specify the home folder on the server and locally, but once that's finished, it would be nice to just press like "Command" + "Shift" "U" for upload or some other hot key combination not in use by OS X for uploading the currently selected file in the Finder.

I find myself needing to do this a lot, and it will save a lot of time!

Someone please tell me if there is an easier way to do this, but I think this will be a good learning experience on top of it all.

I need some help on how I should get started however..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

┈┾☆殇 2024-09-25 08:29:26

1)命令行程序curl可以上传文件。 2) 如果您在 Finder 窗口中选择了一个文件,applescript 可以获得选择。使用这两个想法,您可以自动化您的任务。我不知道确切的curl命令,但使用谷歌应该很容易找到。因此,您在 Finder 中选择一个文件,然后运行该脚本。该脚本可以使用您提到的键盘快捷键运行,或者只是将其放在“脚本”菜单中并从那里运行。

tell application "Finder"
    set selectedFile to item 1 of (get selection)
    set selectedFile to selectedFile as text
end tell

do shell script "curl -switchesToUpload " & quoted form of POSIX path of selectedFile

1) the command line program curl can upload files. 2) if you have a file selected in a Finder window applescript can get the selection. Using those 2 ideas you can automate your task. I don't know the exact curl command but that should be easy to find using google. So you select a file in the Finder and then run the script. The script can be run with a keyboard shortcut as you mentioned or just put it in the Script menu and run it from there.

tell application "Finder"
    set selectedFile to item 1 of (get selection)
    set selectedFile to selectedFile as text
end tell

do shell script "curl -switchesToUpload " & quoted form of POSIX path of selectedFile
把人绕傻吧 2024-09-25 08:29:26

我使用 Cyber​​duck 这是一个 ftp 客户端,您可以对其进行设置,以便当您双击服务器上的文件时它会打开在您最喜欢的编辑器中进行编辑。(textmate 是我的最爱。)当您保存时,它会自动下载和上传。

这似乎是解决问题的更好方法

I use Cyberduck which is an ftp client you can set it up so when you double click a file on the server it opens it up in your favorite editor.( textmate is my favorite.) it atuomagiclly downloads and uploads when you save.

this seems like a much better solution to the problem

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文