当kofax版本的OpenScript()
被调用时,我从Indexfields
对象读取了所有BatchFields
,BatchVariables
和ReleaseData
并将它们存储到字典中。
Dictionary<string, string> indexFields = new Dictionary<string, string>();
Dictionary<string, string> batchFields = new Dictionary<string, string>();
Dictionary<string, string> batchVariables = new Dictionary<string, string>();
foreach (Value val in documentData.Values)
{
if (val.TableName.IsEmpty())
{
string sourceName = val.SourceName;
string sourceValue = val.Value;
switch (val.SourceType)
{
case KfxLinkSourceType.KFX_REL_INDEXFIELD:
indexFields.Add(sourceName, sourceValue);
break;
case KfxLinkSourceType.KFX_REL_VARIABLE:
batchVariables.Add(sourceName, sourceValue);
break;
case KfxLinkSourceType.KFX_REL_BATCHFIELD:
batchFields.Add(sourceName, sourceValue);
break;
}
}
}
documentData.Values
为空。循环调试时
documentData.LogError("-------- SAVED VALUES --------");
foreach (Value val in documentData.Values)
{
documentData.LogError("######");
documentData.LogError(val.SourceName);
documentData.LogError(val.Value);
documentData.LogError("######");
}
我没有记录任何条目。在调用setup Apply
方法之前,我将要访问的所有数据保存在发行版中。
releaseSetupData.CustomProperties.RemoveAll();
releaseSetupData.CustomProperties.Add("username", cobraService.Username);
releaseSetupData.CustomProperties.Add("password", cobraService.Password);
releaseSetupData.CustomProperties.Add("webserviceRootUrl", cobraService.WebserviceRootUrl);
releaseSetupData.CustomProperties.Add("templateId", selectedTemplateID.ToString());
releaseSetupData.Links.RemoveAll();
foreach (IndexField indexField in releaseSetupData.IndexFields)
{
releaseSetupData.Links.Add(indexField.Name, KfxLinkSourceType.KFX_REL_INDEXFIELD, indexField.Name);
}
foreach (BatchField batchField in releaseSetupData.BatchFields)
{
releaseSetupData.Links.Add(batchField.Name, KfxLinkSourceType.KFX_REL_BATCHFIELD, batchField.Name);
}
foreach (dynamic batchVariable in releaseSetupData.BatchVariableNames)
{
releaseSetupData.Links.Add(batchVariable, KfxLinkSourceType.KFX_REL_VARIABLE, batchVariable);
}
重要提示:
在安装过程中会保存数据,因为第二次打开配置时,我可以访问以前的配置中的数据。加载表格时我可以做到
CustomProperties props = releaseSetupData.CustomProperties;
if (props.TryGetValue("username", out string username))
{
edtUsername.Text = username;
}
并获取先前的配置值。
2018-12-21 08:54:20,0x00000018,0,0x00000000,0x00000000, 0x00000000,C:\ Program Files(x86)\ Kofax \ CaptureSS \ ServLib \ Bin,Admin, WINPQQ02E45HKM:Sess 2、11.0.0.0.0.397、130,SetupData对象 关闭脚本时无法释放。 ScriptName =自定义 导出脚本,版本= 10.2,引用计数= 3 ,,
有什么地方不对吗?