我想使用dxl脚本在现有对象文本中添加剪贴板内容。
我进行了搜索,包括dxl_reference_manual,但没有帮助。
所选对象中有一些文本,例如“该对象中已有文本”,剪贴板内容(例如“我的剪贴板文本”)应在开头并添加为单个对象。
(输出应该类似于下面的单个对象。)
我的剪贴板文本 该对象中已有文字
我的代码:
Skip fGetSelectedObjects(Module in_mod)
{
Skip skpObjects = create() // Return KEY and DATA both 'Object'
if (null in_mod) return(skpObjects)
Object oCurr = current,
o
for o in entire (in_mod) do
{ if (isSelected(o) or
o == oCurr) put(skpObjects, o, o)
}
return(skpObjects)
} // end fGetSelectedObjects()
Skip skpObjects = fGetSelectedObjects(current Module)
Object o
for o in skpObjects do
{ // deal with the selected o
string s = o."Object text"
// I don't know the way to activate the object text attribute instead of manual click. Thus it loops through selection and pastes the clipboard contents.
pasteToEditbox
//For Single Indentation use 360 points, double indentation 720 points and so on...
o."Object text" = richText (applyTextFormattingToParagraph(richText s,false,360,0))
}
delete(skpObjects)
答案 0 :(得分:0)
不确定为什么要为此使用“跳过”。我希望执行以下操作:
// Create Variables
Module mod = current
Object obj = null
Buffer buf = create
string str = stringOf ( richClip )
// Loop through Module
for obj in entire ( mod ) do {
// Grab the rich text from the clip and reset the buffer
buf = str
// Check if it's selected and object heading is empty
if ( ( isSelected ( obj ) ) && ( obj."Object Heading" "" == "" ) ) {
// If it is, add the text to the buffer
buf += " " richText ( obj."Object Text" )
// Set the object text with the clip stuff in front
obj."Object Text" = richText ( buf )
}
}
delete buf
值得注意的是,这仅适用于专门选择的项目。
编辑-添加具有对象标题的对象的排除。不幸的是,据我所知,DOORS不允许进行非连续的对象选择(相当于Windows中的ctrl左键单击),这可能会非常令人沮丧。