kofax - 检测 Kofax 是否启动了自定义模块或用户
问题描述
当自定义模块启动时,我可以使用
if (Environment.UserInteractive)
{
// Run as WinForms app
}
else
{
// Run as service
}
在后台服务和 WinForms 应用程序之间切换。但我也可以在不启动 Kofax 的情况下运行 .exe 文件。
是否可以检查 Kofax 是否启动了该模块?我的示例代码看起来像
if (Environment.UserInteractive)
{
// Run as WinForms app
if (Application.LaunchedByKofax)
{
// Do something additional
}
}
else
{
// Run as service
}
解决方案
Kofax Capture 启动自定义模块的唯一上下文是用户尝试从 Batch Manager 处理批次,并且该批次当前在您的自定义模块的队列中。如果您指的是除此之外的其他内容,那么您需要澄清您的问题。
发生这种情况时,会使用附加参数调用为您的自定义模块注册的路径,其中最值得注意的是 -B###,其中 ### 是十进制批次 ID。有关这方面的更多详细信息,请参阅 Kofax 知识库文章1713,该文章较旧但仍适用于当前版本。
因此,您可以使用这样的函数来检查预期的参数。
public bool LaunchedFromBatchManager()
{
var args = Environment.GetCommandLineArgs();
//args[0] will contain the path to your exe, subsquent items are the actual args
if (args.Count() > 1)
{
// When a user tries to process a batch from batch manager,
// it launches the module with -B###, where ### is the decimal batch ID
// see: http://knowledgebase.kofax.com/faqsearch/results.aspx?QAID=1713
if (args[1].StartsWith("-B"))
{
return true;
}
}
return false;
}
推荐阅读
- sql - ER DIAGRAM 绘图
- c++ - 右值参数如何传递到正确的前向函数?
- ruby - ruby 不使用 TLS1.0
- firebase - 使用 Firebase 进行 Google Apps 脚本链接缩短
- asp.net - 导出的 excel 中的 gridview 数据绑定值比应有的值高 10 倍
- node.js - nodemailer:getaddrinfo ENOTFOUND in-v3.mailjet.com
- javascript - 无法更改不和谐频道名称
- java - 如何使用片段集中用户输入
- vuepress - Vuepress 构建有一些错误
- angular - Angular循环依赖:组件使用service动态创建同类型的组件