Mac-Automator,如何将 shell 脚本的输出通过管道传输到 GUI 文本框
我面临的问题是这样的:
我想在上下文菜单中(当我右键单击文件夹时)执行一个操作并向用户显示输出,在一个带有垂直滚动条。假设该操作只是一个 shell 脚本,它在给定目录中执行“find”命令,搜索指定的模式。
到目前为止,我已经使用 Automator 成功实现了它。我不能做的就是以同步方式通过管道传输输出(“同步”的意思是在“find”命令生成时将输出打印给用户,而不是在命令完成后)图形用户界面。
我花了一些时间搜索这个,我得出的结论是 XCode 和 Interface Builder 必须投入使用?我走在正确的轨道上吗?有没有一种直接、简单的方法可以成功实现这一目标,而无需深入研究这个框架?
非常感谢,
巴比斯
The problem I face is this:
I would like to have in a context menu (when i right-click on a folder) an action to be executed and display the output to the user, inside, let's say, a text area window with a vertical scrolling bar. Suppose, that the action is just a shell script that executes a "find" command inside the given directory, searching for a specified pattern.
I have managed to implement it, up to this point, using Automator. What I cannot do is to pipe the output in a synchronous fashion (what is meant by "synchronous" is to have the output print to the user when is produced by the "find" command, and not after the command has finished) in a GUI.
I have spent sometime searching on this and I have come to the conclusion that XCode and Interface Builder have to be put into the play? Am I on the right track? Is there a straightforward and simple way in succeeding in this without having to dig into this framework?
Thank you very much,
Babis
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以让 shell 脚本在使用 http://cocoadialog.sourceforge.net/
You can have the shell script throw a dialog when it gets the result using http://cocoadialog.sourceforge.net/