X $ C $的C 4:我可以通过AppleScript的获得路径当前活动的文件? [英] Xcode 4 : Can I get a path to the currently active file via AppleScript?

查看:467
本文介绍了X $ C $的C 4:我可以通过AppleScript的获得路径当前活动的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个自定义X code4行为检查出与Perforce公司当前的活动文件。我知道打了一个关键的时候(例如,<大骨节病> F1 )我想是自定义行为发起一个AppleScript(或任何类型的脚本为此事)的洞察,我可以写一个自定义的行为来运行目前在X code活跃源文件,得到它的路径,并尝试通过Perforce的检查出来。

I am trying to write a custom xcode4 behavior to check out the current active file with Perforce. I know I can write a custom behavior to run when hit a key (e.g., F1) I'd like that custom behavior to launch an AppleScript (or any kind of script for that matter) that discerns the currently "active" source document in Xcode, get its path, and attempt to check it out via Perforce.

据我可以告诉AppleScript的是让目标文档,因为它可以轻松地浏览在X code DOM的最佳途径。鉴于此,在DOM本身是一个迷宫。

As far as I can tell AppleScript is the best way to get to the target document as it can navigate the Xcode DOM easily. Given that, the DOM itself is a maze.

可以这样做?

推荐答案

tell application "Xcode"
    set CurrentActiveDocument to document 1 whose name ends with (word -1 of (get name of   window 1))
    set WhatYouWant to path of CurrentActiveDocument
end tell

这篇关于X $ C $的C 4:我可以通过AppleScript的获得路径当前活动的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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