Hello Team,
I am using workflow designer 11 and CAT ( client automation dll) to generate pdf pages. Somehow script activity was not working for me and giving me an error for version 11 but its working fine under the version 10.4
Seems its working fine for workflow designer 10.4 but for same workflow its showing an error for version 11. You can check error attached. "Timeout waiting for client startup".
namespace WorkflowActivity.Scripting.PageGenerationScript
{
using System;
using System.IO;
using System.Threading;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using Laserfiche.RepositoryAccess;
using Laserfiche.DocumentServices;
using Laserfiche.ClientAutomation;
using System.Diagnostics;
/// <summary>
/// Provides one or more methods that can be run when the workflow scripting activity is performed.
/// </summary>
public class Script1 : RAScriptClass104
{
/// <summary>
/// This method is run when the activity is performed.
/// </summary>
protected override void Execute()
{
string usrName = "admin";
string usrPass = "admin";
var processID = -1;
using (ClientManager lfclient = new ClientManager())
{
WorkflowApi.TrackInformation("client manager");
LaunchOptions options = new LaunchOptions();
WorkflowApi.TrackInformation("LaunchOptions");
options.ServerName = RASession.Repository.ServerName;
options.RepositoryName = RASession.Repository.Name;
options.UserName = usrName;
options.Password = usrPass;
options.HiddenWindow = true;
options.ShowSplashScreen = false;
WorkflowApi.TrackInformation("options");
MainWindow FolderBrowser = null;
WorkflowApi.TrackInformation("Main Window");
// ClientInstance singleLFexe = null;
WorkflowApi.TrackInformation("Client instance");
try
{
//singleLFexe = lfclient.LaunchClient(options);
lfclient.LogIn(options, out FolderBrowser);
WorkflowApi.TrackInformation("single LF.exe");
// processID = singleLFexe.ProcessID;
// WorkflowApi.TrackInformation("ProcessID");
// SetTokenValue("ProcessID", processID);
// IEnumerable<ClientWindow> OpenWindows = singleLFexe.GetAllClientWindows();
// FolderBrowser = OpenWindows.First() as MainWindow;
GeneratePagesOptions gpOptions = new GeneratePagesOptions();
//DocumentInfo di = (DocumentInfo)BoundEntryInfo;
//MsgBox(di.Extension);
//if(di.Extension == "pdf")
gpOptions.ForceSnapshot = false;
//else
//gpOptions.ForceSnapshot = true;
gpOptions.ShowUI = false;
List<int> docs = new List<int>();
try
{
docs.Add(this.BoundEntryId);
WorkflowApi.TrackInformation("Starting page generation for: " + this.BoundEntryInfo.Name + "(" + this.BoundEntryId+ ")");
FolderBrowser.GeneratePages(docs, gpOptions);
WorkflowApi.TrackInformation("Pages generated successfully for: " + this.BoundEntryInfo.Name + "(" + this.BoundEntryId+ ")");
// DocumentInfo entinfo = Document.GetDocumentInfo(this.BoundEntryId,RASession);
// entinfo.DeleteEdoc(); //delete electronic document
// entinfo.Save(); //delete and save
WorkflowApi.TrackInformation("in");
FolderBrowser.Close();
// singleLFexe.Dispose();
lfclient.Dispose();
WorkflowApi.TrackInformation("out");
processID = -1;
SetTokenValue("ProcessID", processID);
}
catch(System.Exception excp)
{
//FolderBrowser.Close();
// singleLFexe.Dispose();
//lfclient.Dispose();
WorkflowApi.TrackError( "Error during page generation for " + this.BoundEntryInfo.Name + "(" + this.BoundEntryId+ ") exception: " + excp.Message);
}
//FolderBrowser.Close();
//singleLFexe.Dispose();
// lfclient.Dispose();
}
catch(System.Exception exp)
{
WorkflowApi.TrackError(exp.Message.ToString());
// FolderBrowser.Close();
//singleLFexe.Dispose();
//lfclient.Dispose();
// WorkflowApi.TrackError( "Error loading Client for page generation...attempt " + GetTokenValue("Repeat_Iteration").ToString() + " will try again in " + GetTokenValue("CalculateDelayTime_Delaytime").ToString() + "mins exception: " + exp.Message );
}
}
}
}
}