通过Applescript在Xcode 4中添加文件断点

4
我正在尝试使用AppleScript向当前XCode项目中的选定.m文件添加断点。目前我卡住了,因为当尝试添加文件断点时,AppleScript一直返回“missing value”。我的现有AppleScript如下(其中PROJECTNAME显然是我当前项目的名称):
tell application "Xcode"
-- Get the name of the selected document
set selectedFile to text document 1 whose name ends with (word -1 of (get name of window 1))
set nameOfSelectedFile to name of selectedFile

set fileReference to missing value
set activeProject to project "PROJECTNAME"

-- Iterate over the main groups of the project
tell activeProject
    repeat with currentGroup in groups
        set nameOfGroup to name of currentGroup
        -- Iterate over the file within the main groups
        repeat with currentFile in file references of currentGroup
            set nameOfFile to name of currentFile
            -- If the current iterated file's name equals the file of the nameOfSelectedFile we've got the fileReference
            if nameOfFile is equal to nameOfSelectedFile then
                set fileReference to currentFile
            end if

        end repeat
    end repeat
end tell

if fileReference is equal to missing value then
    return "No match found"
else
    -- Try to add file breakpoint to the active workspace document
    set awd to active workspace document
    tell awd
        make new file breakpoint with properties {line number:21, file reference:fileReference, automatically continue:true, enabled:true, name:"test", condition:"none", id:"test"}
    end tell
end if
end tell

补充讨论,我尝试了以下操作并得到了相同的错误:make new file breakpoint with properties (properties of item 1 of breakpoints of awd) - atommclain
1个回答

0

我相信id和name是只读属性,建议您尝试删除它们然后执行。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接