XCode 4 用户脚本 [英] XCode 4 User Script

查看:25
本文介绍了XCode 4 用户脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 XCode 一年,我用 Python 制作了一个用户脚本.此脚本获取所有文档,通过 %%%{PBXSelectionStart}%%% 获取光标位置,执行一些非常有用的操作,并替换所有当前文档,无需移动光标.

I use XCode for one year, and I made a user script in Python. This script gets the all document, gets the cursor position thanks to %%%{PBXSelectionStart}%%%, does some very useful stuff, and replaces all the current document, without moving the cursor.

效果很好.

但我升级到 XCode 4,似乎不支持用户脚本!我怎样才能继续使用我的脚本?

But I upgraded to XCode 4 and it's seems that the user scripts are not supported! How can I continue to use my script ?

(我尝试使用 automator,但我不能使用 %%%{PBXSelectionStart}%%% 变量作为光标位置,我必须选择 XCode 中的所有文档...)

(I try with automator but I can't use the %%%{PBXSelectionStart}%%% variable for the cursor position and I must select all the document in XCode...)

提前致谢!

推荐答案

是的,Apple 似乎放弃了用户脚本支持 :-( 你唯一能做的就是(来自 Apple 开发者论坛):

Yes, it seems like Apple dropped user script support :-( The only thing you can do is (from the Apple Developer Forum):

你唯一的选择就是把它放进去~/Library/Scripts 然后转到文件 > 服务 > 服务首选项...并设置键盘快捷键.

Your only option is to drop it in ~/Library/Scripts and then go to File > Services > Service Preferences... and set a keyboard shortcut.

这有效,但只是一个劣质的替代品,因为您将无法使用 Xcode 3 中的 Xcode 用户脚本:-(

This works, but is only an inferior replacement, since you won't have all the possibilities you used to have with Xcode user scripts in Xcode 3 :-(

这是一篇帖子您如何创建一个 Automator Action,您可以将其用作 Xcode 中的服务(通过服务菜单并分配如上所述的快捷方式).我也这样做了(修改我的一个脚本以从标准输入读取输入并将输出写入标准输出)并且它有效......正如我上面所说,它相当有限并且比以前慢十倍,但更好总比没有.

Here is a post showing you how to create an Automator Action which you can use as a service in Xcode (via the service menu and assign a shortcut as mentioned above). I did that as well (modifying one of my scripts to read input from stdin and write output to stdout) and it works... as I said above, it is rather limited and it is ten times slower than it used to, but better than nothing.

这篇关于XCode 4 用户脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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