4 Replies Latest reply on Mar 5, 2007 9:06 AM by (Tom_Warfield)

    Custom Task / Agent

      I've been working with Central 5.5 and Forms Designer 5.5 for about 4 months now. I'm at the point that in order to customize forms the way they're wanted, a custom task needs to be put in.

      Basically, it will be a VB executable that reads the .dat file and changes the ^job to a different job based on one of the ^global fields in the file. It's weird I know, but the only way to separate our forms into different jobs. Currently all our forms run through three different jobs...one for printing, one for faxing, and another for emailing.

      So can someone please provide some direction on this? I've read Chapter 6 "Creating a Custom Agent" but I'm still confused...

      1. It doesn't look like we have to change jfserver.ini file (can we just specify it in Control?)

      2. How do you make the .pif file for the VB executable?

      3. What kind of format does the exit value need to be (like specifying exitvalue=0 or something like that)?

      I think that's it...but I'm probably missing something. I can't find anything that really spells it out step by step anywhere.
        • 1. Re: Custom Task / Agent
          Level 1
          We use a number of custom agents in our jobs so I can give you some pointers if not direct answers (I'm not the programmer that writes our agents). I hope this helps.

          First, you are confusing me by mentioning a PIF file. VB creates Windows programs and a PIF file is not needed. Besides, Central is firing off the program and, if I recall correctly, a PIF file would be for a manual startup from a desktop icon for a DOS program. Anyway, we don't have any PIF files. We just copy the EXE to the server and set up all the other necessary stuff for running it.

          Second, we have been unable to figure out a method to set the exit value from within the VB application. I'm not saying there isn't a method, just that we haven't found it (VB.NET). If you don't know how or don't find a way then you will have to use the file method described in chapter 6.

          I don't understand what you mean by "specify it in Control". Or what you are going to specify. You can certainly put all the necessary options on the ^job line or define them within the task definition.

          b will
          have to modify the jfserver.ini file. Central will not run anything unless there is a section within the file that describes where to get the EXE from. You might as well define the location of the INI file (if there is one) while you are there. This would be a section similar to [JFMERGE] but the EXE name would be between the brackets (no '.exe').

          There is one "gotcha" that you have to be aware of. For all tasks within the job, the parameters on the ^job line that is in the original file is
          b always
          used for the duration of the job. You can have an agent change stuff and pass the file on to other tasks but the following tasks will not see the changes as command-line parameters.

          In our application most of our jobs are multiple tasks. Our custom agents read the input file specified on the command line, do whatever is needed and then write an output file. File names come from the @INFile & @OutFile variables supplied by Central (unless we have a specific name we want. The output may or may not have changes depending on the purpose of the agent.

          We do have one agent that essentially does what you need to do. Though it doesn't search for particular fields (other of our agents do) it does change ^job parameters, including the name of the job. It reads the input file, changing the ^job parameters, builds a temporary file that is a copy of the input file (with the job name change). When it is done it then copies this temporary file into the collector folder. The file has to have a different physical name or Central will delete it (or copy it to the backup folder).
          • 2. Re: Custom Task / Agent
            Level 1
            We have a plugin (DBConnect) that runs on Java. When installed I didn't have to do anything to the jfserver.ini file. That's why I was wondering if you can just set the parameters when you set up a new task (specifying in Control). Is it because our current plugin is java and not an EXE?

            Thanks for the information Tom! I will update this once I try and get the agent working.
            • 3. Re: Custom Task / Agent
              _MDI_ Level 1
              To run a java application from the command line you run java.exe, which is an executable file. The syntax is like this: "java my_java_program".

              Actually you don't need to configure the jfserver.ini, IF you set up a task where you specify the absolute path for your program.
              If you have to launch the program MyPrg which is installed under C:\Program files\MyInstallDir, then you just put this line in the command line field in the task configuration screen in JetForm:
              C:\Program files\MyInstallDir\MyPrg.exe

              It will run. You can even run batch files like that as well as any other executable, Java included.

              Best regards,
              • 4. Re: Custom Task / Agent
                Level 1
                Marco - I didn't consider putting the full path within the task description. We completely emulated all the provided tasks by just having the program name defined in the task. That is how I learned that I had to add the sections to the jfserver.ini file. I can see that providing the full path within the task definition would eliminate that requirement.