在 layoutDXL 比较模块脚本中对 diff(buffres, buff1, buff2, rich text bits) 的空缓冲区调用
Null buffer calls for diff(buffres, buff1, buff2, rich text bits) in layoutDXL compare module script
我正在编写一个脚本,最终应该是 运行 来自下拉菜单的脚本。
这个脚本的部分是:
- 采用当前模块名称并在数据库中梳理同名模块的搜索(有效)
- 创建列并调用 (3.) 中描述的布局 dxl 的脚本(可行,但不是我的主要问题)
- 比较模块对象的布局 DXL。
以下是我目前的资料。我没有声明问题,只是有人告诉我我正试图在 diff() 函数
的位置 1、2 和 3 中传递空缓冲区
//===Relevant declarations===
Object thiso, thato
Module thismod, thatmod // these have been assigned using my search function
Buffer diffResult = create
Buffer thisotext = create
Buffer thatotext = create
//===The problem child===
for thiso in thismod do {
for that o in thatmod do {
if(thiso."Reqid" "" == thato."Reqid" "") {
thisotext = thiso."Object Text"
thatotext = thato."Object Text"
diff(diffResult, thatotext, thisotext, "\cf1\strike","\cf3\u1") // here lies issue number 1
displayRichWithColor(stringOf(diffResult)) // commented out atm
delete thatotext
delete thisotext
delete diffResult
}
}
}
我检查过的东西:
- thiso."Object Text" 和 thato."Object Text" 生成非空字符串。 DXL手册告诉我我的分配方法是正确的。
我三周前开始学习DXL,所以还是有点新。这让我感到难过,但我会继续尝试不同的事情,因为我会等着看是否有人有建议。
提前感谢任何有时间提供帮助的人。
好的,所以我找到了一个解决方案,虽然为什么它是一个解决方案:我不能说。
本质上,我将过程放入一个函数中,我为 thismod 中的每个对象调用该函数。
void CompareMod(Object o, Module thismod, Module thatmod) {
Object thato
Buffer diffResult = create
Buffer thisotext = create
Buffer thatotext = create
for thato in thatmod do {
if(o."Reqid" "" == thato."Reqid" "") {
thisotext = o."Object Text"
thatotext = thato."Object Text"
diff(diffResult, thatotext, thisotext, "\cf1\strike", "\cf3\u1")
displayRichWithColor(stringOf(diffResult))
delete thatotext
delete thisotext
delete diffResult
}
}
}
for thiso in thismod do {
CompareMod(thiso, thismod, thatmod)
}
除此之外,我还有一个新问题要解决。而不是 post 我所期望的显示相似文本框之间的差异,我只是打印出与 thismod 中的每个对象重复的那个 mod 中的所有对象相同的部分。
所以这是我要解决的新项目,我也会接受这方面的帮助,或者我以后会post一个新问题。
好的!花了我一秒钟,但我想我明白了为什么你的第一部分代码失败了。
//===Relevant declarations===
Object thiso, thato
Module thismod, thatmod // these have been assigned using my search function
Buffer diffResult = create
Buffer thisotext = create
Buffer thatotext = create
//===The problem child===
for thiso in thismod do {
for that o in thatmod do {
if(thiso."Reqid" "" == thato."Reqid" "") {
thisotext = thiso."Object Text"
thatotext = thato."Object Text"
diff(diffResult, thatotext, thisotext, "\cf1\strike","\cf3\u1") // here lies issue number 1
displayRichWithColor(stringOf(diffResult)) // commented out atm
delete thatotext
delete thisotext
delete diffResult
}
}
}
这里的问题出在那些 'delete' 调用中。这是第一次 运行,第一个符合所有条件的对象 ( thiso."Reqid" "" == thato."Reqid" "" ) 将导致缓冲区被删除并清空出去。下一次成功的匹配只会抛出一个错误。
//===Relevant declarations===
Object thiso, thato
Module thismod, thatmod // these have been assigned using my search function
Buffer diffResult = create
Buffer thisotext = create
Buffer thatotext = create
//===The problem child===
for thiso in thismod do {
for thato in thatmod do {
if(thiso."Reqid" "" == thato."Reqid" "") {
thisotext = thiso."Object Text"
thatotext = thato."Object Text"
diff(diffResult, thatotext, thisotext, "\cf1\strike","\cf3\u1") // here lies issue number 1
displayRichWithColor(stringOf(diffResult)) // commented out atm
thatotext = ""
thisotext = ""
diffResult = ""
}
}
}
delete thatotext
delete thisotext
delete diffResult
这将清除比较之间的缓冲区但不会破坏它们。我认为这种行为也会导致您的功能化示例出现问题 - 您重复创建和销毁缓冲区,而不是重复使用相同的缓冲区 space.
让我知道这是怎么回事!
编辑:查看您的问题,如果您将其嵌入到布局 dxl 中,您可能希望使用 ( obj."Reqid" "" ) 而不是 'thiso in thismod' 循环。为每个对象评估布局 dxl,并且 'obj' 被有效地分配为调用布局 dxl 的对象的句柄。现在每个对象都在循环遍历每个对象。
编辑 2:示例代码
//===Relevant declarations===
Object thato
Module thatmod // these have been assigned using my search function
Buffer diffResult = create
Buffer thisotext = create
Buffer thatotext = create
//===The problem child===
for thato in thatmod do {
if(thiso."Reqid" "" == thato."Reqid" "") {
thisotext = obj."Object Text"
thatotext = thato."Object Text"
diff(diffResult, thatotext, thisotext, "\cf1\strike","\cf3\u1") // here lies issue number 1
displayRichWithColor(stringOf(diffResult)) // commented out atm
thatotext = ""
thisotext = ""
diffResult = ""
}
}
delete thatotext
delete thisotext
delete diffResult
我正在编写一个脚本,最终应该是 运行 来自下拉菜单的脚本。
这个脚本的部分是:
- 采用当前模块名称并在数据库中梳理同名模块的搜索(有效)
- 创建列并调用 (3.) 中描述的布局 dxl 的脚本(可行,但不是我的主要问题)
- 比较模块对象的布局 DXL。
以下是我目前的资料。我没有声明问题,只是有人告诉我我正试图在 diff() 函数
的位置 1、2 和 3 中传递空缓冲区//===Relevant declarations===
Object thiso, thato
Module thismod, thatmod // these have been assigned using my search function
Buffer diffResult = create
Buffer thisotext = create
Buffer thatotext = create
//===The problem child===
for thiso in thismod do {
for that o in thatmod do {
if(thiso."Reqid" "" == thato."Reqid" "") {
thisotext = thiso."Object Text"
thatotext = thato."Object Text"
diff(diffResult, thatotext, thisotext, "\cf1\strike","\cf3\u1") // here lies issue number 1
displayRichWithColor(stringOf(diffResult)) // commented out atm
delete thatotext
delete thisotext
delete diffResult
}
}
}
我检查过的东西:
- thiso."Object Text" 和 thato."Object Text" 生成非空字符串。 DXL手册告诉我我的分配方法是正确的。
我三周前开始学习DXL,所以还是有点新。这让我感到难过,但我会继续尝试不同的事情,因为我会等着看是否有人有建议。
提前感谢任何有时间提供帮助的人。
好的,所以我找到了一个解决方案,虽然为什么它是一个解决方案:我不能说。
本质上,我将过程放入一个函数中,我为 thismod 中的每个对象调用该函数。
void CompareMod(Object o, Module thismod, Module thatmod) {
Object thato
Buffer diffResult = create
Buffer thisotext = create
Buffer thatotext = create
for thato in thatmod do {
if(o."Reqid" "" == thato."Reqid" "") {
thisotext = o."Object Text"
thatotext = thato."Object Text"
diff(diffResult, thatotext, thisotext, "\cf1\strike", "\cf3\u1")
displayRichWithColor(stringOf(diffResult))
delete thatotext
delete thisotext
delete diffResult
}
}
}
for thiso in thismod do {
CompareMod(thiso, thismod, thatmod)
}
除此之外,我还有一个新问题要解决。而不是 post 我所期望的显示相似文本框之间的差异,我只是打印出与 thismod 中的每个对象重复的那个 mod 中的所有对象相同的部分。
所以这是我要解决的新项目,我也会接受这方面的帮助,或者我以后会post一个新问题。
好的!花了我一秒钟,但我想我明白了为什么你的第一部分代码失败了。
//===Relevant declarations===
Object thiso, thato
Module thismod, thatmod // these have been assigned using my search function
Buffer diffResult = create
Buffer thisotext = create
Buffer thatotext = create
//===The problem child===
for thiso in thismod do {
for that o in thatmod do {
if(thiso."Reqid" "" == thato."Reqid" "") {
thisotext = thiso."Object Text"
thatotext = thato."Object Text"
diff(diffResult, thatotext, thisotext, "\cf1\strike","\cf3\u1") // here lies issue number 1
displayRichWithColor(stringOf(diffResult)) // commented out atm
delete thatotext
delete thisotext
delete diffResult
}
}
}
这里的问题出在那些 'delete' 调用中。这是第一次 运行,第一个符合所有条件的对象 ( thiso."Reqid" "" == thato."Reqid" "" ) 将导致缓冲区被删除并清空出去。下一次成功的匹配只会抛出一个错误。
//===Relevant declarations===
Object thiso, thato
Module thismod, thatmod // these have been assigned using my search function
Buffer diffResult = create
Buffer thisotext = create
Buffer thatotext = create
//===The problem child===
for thiso in thismod do {
for thato in thatmod do {
if(thiso."Reqid" "" == thato."Reqid" "") {
thisotext = thiso."Object Text"
thatotext = thato."Object Text"
diff(diffResult, thatotext, thisotext, "\cf1\strike","\cf3\u1") // here lies issue number 1
displayRichWithColor(stringOf(diffResult)) // commented out atm
thatotext = ""
thisotext = ""
diffResult = ""
}
}
}
delete thatotext
delete thisotext
delete diffResult
这将清除比较之间的缓冲区但不会破坏它们。我认为这种行为也会导致您的功能化示例出现问题 - 您重复创建和销毁缓冲区,而不是重复使用相同的缓冲区 space.
让我知道这是怎么回事!
编辑:查看您的问题,如果您将其嵌入到布局 dxl 中,您可能希望使用 ( obj."Reqid" "" ) 而不是 'thiso in thismod' 循环。为每个对象评估布局 dxl,并且 'obj' 被有效地分配为调用布局 dxl 的对象的句柄。现在每个对象都在循环遍历每个对象。
编辑 2:示例代码
//===Relevant declarations===
Object thato
Module thatmod // these have been assigned using my search function
Buffer diffResult = create
Buffer thisotext = create
Buffer thatotext = create
//===The problem child===
for thato in thatmod do {
if(thiso."Reqid" "" == thato."Reqid" "") {
thisotext = obj."Object Text"
thatotext = thato."Object Text"
diff(diffResult, thatotext, thisotext, "\cf1\strike","\cf3\u1") // here lies issue number 1
displayRichWithColor(stringOf(diffResult)) // commented out atm
thatotext = ""
thisotext = ""
diffResult = ""
}
}
delete thatotext
delete thisotext
delete diffResult