如何从 AppleScript 制作可执行程序
为了运行我的 AppleScript 程序,我必须打开它并选择“运行”。我希望该程序在我单击它时运行。我尝试编译它,但它似乎没有产生任何影响或创建新文件。
In order to run my AppleScript program I have to open it up and select "run." I want the program to just run when I click on it. I tried to compile it, but it didn't seem to make a difference or create a new file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
2种方式。
1)我的首选方法是激活脚本菜单。如果您使用的是 10.6,请打开 AppleScript 编辑器。打开首选项,然后在“常规”选项卡下单击“在菜单栏中显示脚本菜单”。现在,您将在屏幕右上角的菜单栏部分看到一个新图标。您可以从该菜单运行任何 applescript。 (在 10.5 中,过程有所不同,但您可以通过 google 搜索方向)。要将 applescript 放入该菜单中,只需转到文件夹 ~/Library/Scripts 并将您的 applescript 添加到其中。从“脚本”菜单中选择您的 applescript 将运行它。
2) 从 AppleScript 编辑器的文件菜单中选择“另存为...”,并将“文件格式”设置为应用程序。然后它就像任何其他应用程序一样工作......只需双击它即可运行它。
注意:如果您使用“脚本”菜单...选择一个脚本将运行它。如果您想在 AppleScript 编辑器中打开脚本进行编辑,请在选择脚本时按住 option 键。
2 ways.
1) my preferred method is to activate the Script menu. If you're using 10.6, open AppleScript Editor. Open the preferences and under the General tab click "Show Script menu in Menu Bar". Now you'll get a new icon in the menu bar section at the top-right of your screen. You can run any applescript from that menu. (in 10.5 the process is different but you can google for directions). To put an applescript in that menu just go to the folder ~/Library/Scripts and add your applescript to it. Choosing your applescript from the Script menu will run it.
2) "Save As..." from the file menu in AppleScript Editor and set the "File Format" to application. Then it works like any other application... just double-click it to run it.
NOTE: if you use the Script menu... selecting a script will run it. If you want to instead open the script in AppleScript Editor for editing then hold the option key down while choosing the script.
当您保存 AppleScript 时,您可以选择将其另存为应用程序,这将使其可执行。
When you are saving your AppleScript, you can choose to save it as an application, which will make it executable.
如果您正在考虑使用 regulus6633 提到的第一个方法,您可以使用 Quicksilver、TextExpander、osascript 等启动 AppleScripts。要制作应用程序,您只需使用方法 2。
If you were considering methods like the first one mentioned by regulus6633 you can launch AppleScripts with Quicksilver, TextExpander, osascript and some other. To make an application you just use the method 2.
如果保存正确的话,一个可点击的应用程序:
A clickable app if saved properly: