kofax export script project setup - kofax

For my first export script I took the KCEC example and the APIRefExport.chm documentation to create my project by replacing the example code with my own.
I would like to create a clean export script from scratch.
I created a new class library project and called it EmptyExportScript (placeholder). The target framework is .Net 4. The platform target is x86 and the output path is .....\Program Files (x86)\Kofax\CaptureSS\ServLib\Bin\. When debugging I would like to start the administration module so I set this path .......\Program Files (x86)\Kofax\CaptureSS\ServLib\Bin\.
The option "Make assembly COM-Visible" is checked and I added the Kofax.ReleaseLib.Interop.dll to the references.
For the KfxReleaseScript.cs I added this code
[ClassInterface(ClassInterfaceType.None)]
[ProgId("KFXTS.EmptyExportScript.KfxReleaseScript")]
public class KfxReleaseScript
{
public ReleaseData documentData;
// public KfxReturnValue OpenScript()
// public KfxReturnValue ReleaseDoc()
// public KfxReturnValue CloseScript()
}
For the KfxReleaseScriptSetup.cs I added this code
[ClassInterface(ClassInterfaceType.None)]
[ProgId("KFXTS.EmptyExportScript.KfxReleaseScriptSetup")]
public class KfxReleaseScriptSetup
{
public ReleaseSetupData setupData;
// public KfxReturnValue OpenScript()
// public KfxReturnValue CloseScript()
// public KfxReturnValue RunUI()
// public KfxReturnValue ActionEvent(KfxActionValue actionID, string data1, string data2)
}
Lastly I added a Form to the project when running the UI.
For registration I added a EmptyExportScript.inf with this content
[Scripts]
Empty Export
[Empty Export]
SetupModule=EmptyExportScript.dll
SetupProgID=KFXTS.EmptyExportScript.KfxReleaseScriptSetup
SetupVersion=10.2
ReleaseModule=EmptyExportScript.dll
ReleaseProgID=KFXTS.EmptyExportScript.KfxReleaseScript
ReleaseVersion=10.2
SupportsNonImageFiles=True
SupportsKofaxPDF=True
RemainLoaded=True
SupportsOriginalFileName=False
When building the project .dll and .inf file get placed into the kofax bin directory.
I recognized that other scripts have a .pdb and .dll.config file in there too.
How do I get them?
When trying to install the custom script, I can add it to the script installation manager but I can't install it. There is nothing to install so I think I'm missing the .pdb and .dll.config file.
Is anything else missing?
Thanks for help :)

Kofax does not need a pdb file, but they are handy if you want to debug your connector and attach it to the release.exe process (learn more about them here).
I would not recommend changing the output path itself to Capture\Bin, but rather create a post-build event:
For example, the following line copies all required files to a separate folder under the CaptureSS\Bin folder:
xcopy "$(TargetDir)*" "C:\Program Files (x86)\Kofax\CaptureSS\ServLib\Bin\SmartCAP\kec\SmartCAP.KEC.Template\" /Y /S
Having a dll.config file is possible, but rare. I would rather recommend storing process-specific data in a custom storage string object of the respective batch class definition (which has the added benefit that you can just import/export the definition along with the batch class, and that you can display and have it changed it in setup form). Having said all that, back to your initial issue - the connector can't be installed.
COM visibility
The assembly needs to be COM-visible, but you mentioned that it was. For the sake of completeness, here's what you will need to do. Note that the GUID must be unique (only relevant if you copied an existing solution):
If you're installing the connector on a different machine, you will need to register it first using regasm.exe - here's an example:
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" SampleExport.dll /codebase /tlb:SampleExport.tlb
ProgIds
Then, your .inf file needs to contain the precise ProgIDs:
[Scripts]
SampleExport
[SampleExport]
SetupModule=SampleExport.dll
SetupProgID=SampleExport.Setup
SetupVersion=11.0
ReleaseModule=SampleExport.dll
ReleaseProgID=SampleExport
ReleaseVersion=11.0
SupportsNonImageFiles=True
SupportsKofaxPDF=True
Both your ReleaseScript.cs and ReleaseSetupScript.cs files need the correct attribute, for example:
[ProgId("SampleExport")]
public class ReleaseScript
If that all still does not work, please provide us with the detailed error message (to be found at CaptureSV\Logs).

I had to change the file format from UTF-8 to UTF-8 without BOM.
This worked for me.

Related

codeigniter4 - How do I shorten the path to the view folder for modules?

Based on a video with Codeigniter4, I created the Modules folder on the ROOTPATH and the Controllers, Views..etc folders in the Modules folder. It works fine, but when I want to call my view file inside the module
<?php
namespace Modules\Giris\Controllers;
use App\Controllers\BaseController;
class IndexController extends BaseController
{
public function index(){
return view('Modules\Giris\Views\index');
}
}
I need to specify a very long path like How can I make it just like view('index') and call the file from the Views folder in that module if I write it in a module? I don't want to write "Modules\Login\Views" in short is this possible?
Thanks in advance for all the kind replies.
Because view requires a string you couldn't provide a namespaced reference as you might think you should. Furthermore the code adds a .php extension and the "view path" (defined in your config\paths file) as part of its process (see system/View/View.php and render()). Therefore without modifying Codeigniter (which could be done but would affect all your code) the easiest way is to simply declare a public property or constant and make reference to that instead. Also helps if you need to change the path at any point.
I.e. protected $path = 'Modules\Giris\Views\' and then view($this->path.'index'); is probably the easiest way.

Custom Module is being used by batch classes and cannot be removed

I would like to remove my custom module from the Kofax administration module but I can't because I get the following error
Using the module multiple times increases the amount of batch classes listed there. But there is only one batch class so this can't be.
I removed the module from the batch class queue, stopped all background services and have no forms app running. The only way to remove this module is to export the batch class, delete it in the administration module, delete the custom module and reimport the batch class.
Maybe I don't exit the application properly?
My session management:
public void LoginToRuntimeSession()
{
login = new Login();
login.EnableSecurityBoost = true;
login.Login();
login.ApplicationName = Resources.CUSTOM_MODULE_ID;
login.Version = "1.0";
login.ValidateUser($"{Resources.CUSTOM_MODULE_ID}.exe", false);
session = login.RuntimeSession;
}
public void Logout()
{
session.Dispose();
login.Logout();
}
I get a new active batch with this code
public IBatch GetNextBatch()
{
return session.NextBatchGet(login.ProcessID);
}
and this is how I process the batch after polling for new ones
public void ProcessBatch(IBatch batch)
{
// ... IACDataElement stuff
batch.BatchClose(KfxDbState.KfxDbBatchReady, KfxDbQueue.KfxDbQueueNext, 0, "");
}
Any ideas how to fix this "bug"? Please let me know if you need more information!
The message you are seeing is only referring to the configuration in the Administration module. Therefore it is not related to what your module actually does when it is running or closing (no problem in your code can cause this).
If you are using Kofax Capture 11, previous published versions of the batch class remain in the system, so these probably still count as references to the module. If you go to the Publish dialog window, you can click the "Versions..." button to see and delete older versions. Try to remove your module again after you have deleted all the older versions that were still using it.
Additionally, you can look through the batch class properties to make sure that this module isn't set in one of the other settings, such as the module to start foldering on the Foldering tab, or the module to start Partial Batch Export on the Advanced tab.
If neither of those suggestions work, then you may want to open a case with Kofax Technical Support. One thing that either they or you can do is open the admin.xml file in the exported batch class cab file and see where your module ID is found. That will give context for finding out what is still referencing the module.

mockito - mock protected method in different packages

I am writing the test case using mockito for a protected method.
public HttpResponse createPostRequest(HashMap<String, String> requestHeaders, String url, String methodName)
{
//some logic
}
my class is in src/main/java and test case is in different package src/main/test.
and am using the following.
Mockito.doReturn(mockHttpResponse).when(userServiceImpl).createPostRequest(Mockito.any(HashMap.class),
Mockito.any(String.class),Mockito.any(String.class));
but it is not working. It is asking to change the method signature to public.
Please help on that.
Thanks.
This seems a configuration problem with your project structure. Your main class is in src/main/java and test class is in src/main/test with one source folder src.
While you could get this to work (setting source folders in buildpath etc.), but most of the time below project structure is used (eg. in spring boot/ maven):
Project-Name
bin
lib
src
main
java
SomeMainClass.java
resources
test
java
TestSomeMainClass.java
resources
This structure has two source folders, one for main (src/main/java) and other one for test (src/test/java). This has the advantage that TestSomeMainClass can access the package private i.e. default member fields of SomeMainClass.
The project structure is src/main/java and src/test/java. but with default modifier not able to mock the method. It is asking to modify the modifier as public

Default config.xml?

On this page of the documentation, at the bottom, it says:
You can find full examples of Sphinx-4 configuration file in sources. For example, check the file
sphinx4/src/apps/edu/cmu/sphinx/demo/transcriber/config.xml
Well, I looked, and there is no config.xml in that directory, and there is no such file in any of the other folders inside of demo either.
So where can one find a default config file to use to get started with?
If I just do Configuration configuration = new Configuration();, would that be good enough to start with?
I recently found out that what you suggest is not enough. Take a look at the latest code on the Github repository. There is a default.config.xml file at https://github.com/cmusphinx/sphinx4/tree/master/sphinx4-core/src/main/resources/edu/cmu/sphinx/api, and the path to it is set in the Context class in package edu.cmu.sphinx.api:
public Context(Configuration config)
throws IOException, MalformedURLException
{
this("../sphinx4/sphinx4-core/src/main/resources/edu/cmu/sphinx/api/default.config.xml", config);
}

Entity Framework my DB Context does not have connection when Reference in other Project

So here is my problem Guys
In my Solution,
I have ORM Class Liberary where I've added EntityFramework 5 (so has .edmx containing Context.tt
Designer.cs, edmx.diagram and .tt) files.. So far so good
And I have Project called Repositories and has reference of ORM project above.
In HeaderRepository class of Repositories Project, when I write following code,
using(UFPEntities ufpEntities = new UFPEntities())
{
try{
Header header = ufpEntities.Headers.Single(x => x.VendorId == id);
}catche(Exception e)
{
}
}
Note: intellisense works fine COMPILER DOES NOT GIVE ERROR while writing above code, it happens at Run time
But, I get "No connection string named 'UFPEntities' could be found in the application config file."
App.config is in ORM Project, not in Repository Project where I am dealing with Data as Above.
Can you please help me so that I can CREATE MY MODEL class (such as Header) from Repository Project? or What I am doing wrong so it gives me Exceptions?
Thx in Advance.
The connection string must be in config of entry assembly - it is either web.config for web application or app.config for executable or unit test library. App.config for arbitrary library which is just referenced by executed code is completely ignored.

Resources