我正在使用名为“arRsync”的rsync的开源GUI前端。它工作得很好,但没有办法让它自动化。
我要做的是使用Applescript运行预设(您在应用程序中定义)使用以下简单脚本:
tell application "arRsync" to runPreset "presetTest1"
问题是Applescript认为“runPreset”是一个变量,而不是一个命令。我也试过上面的告诉/结束 - 告诉变种,没有骰子。 'runPreset'命令是arRsync.sdef
的一部分您可以找到arRsync项目here
我尝试打开应用程序内的两个Info.plist文件并打勾'Scriptable'框(或者为没有属性列表编辑器的人设置为'true')但我仍然卡住了。
对于Cocoa,我是一个脚本菜鸟:非常感谢p帮助
答案 0 :(得分:1)
arRsync二进制文件缺少脚本字典。从源代码构建,首先进行以下更改:
修复项目的脚本字典arRsync.sdef。 runPreset
命令的代码只有一个字母太少(command代码必须是两个FourCC,或八个字符,长)。在runPreset
的代码属性中添加一个字符;几乎任何角色都会奏效。如果需要,可以通过使用include替换Standard和Text套件来缩短和简化文件。备份orignal文件并创建一个包含以下内容的新arRsync.sdef:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
<dictionary title="arRsync Terminology"
xmlns:xi="http://www.w3.org/2003/XInclude">
<xi:include href="file:///System/Library/ScriptingDefinitions/CocoaStandard.sdef"
xpointer="xpointer(/dictionary/suite)"/>
<suite name="arRsync Suite" code="arRs">
<command name="runPreset" code="runPPrst">
<cocoa name="runPreset" class="scriptController"/>
<direct-parameter type="any"/>
</command>
</suite>
</dictionary>
或者,您可以将runPreset
命令元素替换为上面的命令元素。
这应该产生一个可编写脚本的arRsync版本。正如您已经想到的那样,您可能还需要使用目标SDK。