Applescript 不接受 arRsync sdef 命令?

发布于 2024-10-05 12:15:21 字数 510 浏览 0 评论 0原文

我正在使用名为“arRsync”的开源 GUI 前端进行 rsync。它工作得很好,但没有办法自动化它。

我想做的是使用 Applescript 使用以下简单脚本运行预设(您在应用程序中定义):

tell application "arRsync" to runPreset "presetTest1"

问题是 Applescript 认为“runPreset”是一个变量,而不是命令。我还尝试了上述的告诉/结束告诉变体,没有骰子。 “runPreset”命令是 arRsync.sdef 的一部分

您可以在此处找到 arRsync 项目

我尝试打开应用程序内的两个 Info.plist 文件并勾选“可编写脚本”框(或者对于那些没有属性列表编辑器的人将其设置为“true”),但我仍然陷入困境。

当涉及到 Cocoa 时,我是一个脚本新手:p 帮助将不胜感激

I'm using the opensource GUI frontend for rsync called "arRsync". It works great, but there's no way to automate it.

What I'm trying to do is use Applescript to run a preset (which you define in the Application) using the following simple script:

tell application "arRsync" to runPreset "presetTest1"

The problem is Applescript thinks "runPreset" is a variable, not a command. I've also tried a tell/end-tell variation of the above, no dice. The 'runPreset' command is part of arRsync.sdef

You can find the arRsync project here

I've tried opening up both Info.plist files inside the app and ticking the 'Scriptable' box (or setting it to 'true' for those of you without Property List Editor) but I'm still stuck.

I'm a scripting noob when it comes to Cocoa :p help would be greatly appreciated

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

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

发布评论

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

评论(1

小嗷兮 2024-10-12 12:15:21

arRsync 二进制文件缺少脚本字典。从源代码构建,首先进行以​​下更改:

  1. 编辑项目中的 Info.plist,将“Scriptable”选项设置为 true。
  2. 修复项目的脚本字典 arRsync.sdef。 runPreset 命令的代码中的一个字母太少 (命令代码必须是两个 FourCC,或八个字符长)。在runPreset的code属性中添加一个字符;几乎任何角色都可以。如果需要,可以通过用包含替换标准和文本套件来缩短和简化该文件。备份原始文件并创建一个新的arRsync.sdef,其中包含:

    
    
    
      
      <套件名称=“arRsync Suite”代码=“arRs”>
          <命令名称=“runPreset”代码=“runPPrst”>
              <可可名称=“runPreset”类=“scriptController”/>
              <直接参数类型=“任意”/>
          
      
    
    

    或者,您可以将 runPreset 命令元素替换为上面的命令元素。

  3. 添加 arRsync.sdef到“复制捆绑资源”arRsync 目标的阶段
  4. 切换到某个版本 build (“Blackbeard”是调试版本的名称)。
  5. 建造它。

这应该会生成 arRsync 的可编写脚本的版本。正如您已经发现的,您可能还需要使用目标 SDK。

The arRsync binary is missing a scripting dictionary. Build from source, first making the following changes:

  1. Edit Info.plist in the project, setting the "Scriptable" option to true.
  2. Fix the project's script dictionary, arRsync.sdef. The code for the runPreset command has one letter too few (command codes must be two FourCCs, or eight characters, long). Add a character to runPreset's code attribute; just about any character will work. If you want, the file can be shortened and simplified by replacing the Standard and Text suites with an include. Back up the orignal file and make a new arRsync.sdef containing:

    <?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>
    

    Alternatively, you could just replace the runPreset command element with the one from above.

  3. Add arRsync.sdef to the "Copy Bundle Resources" phase of the arRsync target
  4. Switch to a Release build ("Blackbeard" is the name for the debug build).
  5. Build it.

That should produce a scriptable version of arRsync. As you've already figured out, you also might need to play with the target SDK.

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