通过 Applescript 在 Xcode 4 中添加文件断点 [英] Add file breakpoint in Xcode 4 via Applescript
本文介绍了通过 Applescript 在 Xcode 4 中添加文件断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 AppleScript 向当前 XCode 项目中选定的 .m 文件添加断点.
I'm trying to add a breakpoint to the selected .m file in my current XCode project using AppleScript.
现在我被卡住了,因为 AppleScript 在尝试添加文件断点时不断返回缺失值".
Right now I'm stuck since AppleScript keeps returning 'missing value' when trying to add a file breakpoint.
我当前的 AppleScript 看起来像这样(其中 PROJECTNAME 显然是我当前项目的名称):
My current AppleScript looks like this (where PROJECTNAME obviously is the name of my current project) :
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
推荐答案
我认为 id 和 name 是只读属性,建议您尝试删除它们然后执行.
I believe that id and name are read only properties, I suggest you try to remove those and then execute.
这篇关于通过 Applescript 在 Xcode 4 中添加文件断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文