/// <summary> /// Set Single Job Options. /// </summary> public virtual void SetSingleJobOptions(string id, int copies, bool duplexMode, bool colorMode) { string idString = _engine.ExecuteFunction("getSingleJobOptionsIdbyDocumentIds", id).Trim('"', '$'); if (idString.Equals("-1")) { throw new DeviceWorkflowException("Unknown solution error encountered."); } PressButton(idString); if (copies > 1) { SetSingleJobCopies(copies); } if (duplexMode) { SetSingleJobDuplexMode(); } if (colorMode) { SetSingleJobGrayScale(); } }
/// <summary> /// Executes the job. /// </summary> /// <param name="workflow">The workflow.</param> /// <param name="documentName">The document name.</param> public bool ExecuteJob(string workflow, string documentName) { bool docNameFound = false; if (_engine.WaitForHtmlContains(workflow, TimeSpan.FromSeconds(20))) { _engine.ExecuteFunction("pressWorkflowButton", workflow); string fieldName = "name=\"Document Name:\""; docNameFound = _engine.WaitForHtmlContains(fieldName, TimeSpan.FromSeconds(10)); if (docNameFound) { string documentProcess = _engine.GetBrowserHtml(); docNameFound = ProcessDocumentFlow(documentProcess, documentName); } if (!docNameFound) { throw new ElementNotFoundException("Unable to find text box for entering document name: " + documentName); } } else { throw new DeviceWorkflowException("Unable to execute workflow '" + workflow + "'."); } return(docNameFound); }
/// <summary> /// The various workflows have different paths. Setup for processing different HPCR workflows. /// </summary> private void ProcessHpcrWorkflows() { _version1_6 = bool.Parse(_engine.ExecuteFunction("ExistButtonId", "btnIdExit")); UpdateStatus("Pressing {0}", _buttonTitle); if (_version1_6) { ProcessHpcrV6Workflows(); } else { if (_buttonTitle.StartsWith(HpcrAppTypes.ScanToFolder.GetDescription(), StringComparison.OrdinalIgnoreCase)) { FolderDistributionButton(_scanDestination); } else if (_buttonTitle.StartsWith(HpcrAppTypes.PersonalDistributions.GetDescription(), StringComparison.OrdinalIgnoreCase)) { FolderDistributionButton(_scanDistribution); } else if (_buttonTitle.StartsWith(HpcrAppTypes.PublicDistributions.GetDescription(), StringComparison.OrdinalIgnoreCase)) { FolderDistributionButton(_scanDestination); PressPanelButton(_scanDistribution); } } }
private bool CheckHpacVersion(int versionIndex) { var isNew = _engine.ExecuteFunction("ExistButtonId", _refreshButtonId[versionIndex]); bool version = bool.Parse(isNew.ToString()); return(version); }
private bool ExistAutoStoreId(string id) { bool exist = false; string existId = _engine.ExecuteFunction("ExistButtonId", id); exist = (existId.Equals("true")) ? true : false; return(exist); }
/// <summary> /// Determines whether [is safe COM go or newer]. /// </summary> /// <returns>System.Boolean.</returns> private bool IsSafeComGoOrNewer() { bool isNewSafeComGo = true; var isNew = _engine.ExecuteFunction("ExistButtonId", _inputCopies[SafeComGO]); isNewSafeComGo = bool.Parse(isNew.ToString()); return(isNewSafeComGo); }
/// <summary> /// Starts the current job and runs it to completion, using the specified <see cref="ScanExecutionOptions" />. /// </summary> /// <param name="executionOptions">The execution options.</param> public bool ExecuteJob(ScanExecutionOptions executionOptions) { bool completedJob = false; string statusMsg = string.Empty; _enhancedWorkflowApp.WorkflowLogger = this.WorkflowLogger; if (executionOptions.JobBuildSegments > 1) { completedJob = ScanDocuments(executionOptions); } else { _enhancedWorkflowApp.ExecuteJob(); _masthead.WaitForActiveJobsButtonState(true, TimeSpan.FromSeconds(3)); statusMsg = _engine.ExecuteFunction("getStatusMessage").Trim('"'); RecordEvent(DeviceWorkflowMarker.ProcessingJobBegin); if (string.IsNullOrEmpty(statusMsg)) // old way of finding the status { completedJob = ProcessNoStatusBanner(executionOptions); } else { completedJob = ProcessStatusBanner(statusMsg); } } return(completedJob); }
/// <summary> /// Executes the job. /// </summary> /// <param name="workflow">The workflow.</param> /// <param name="documentName">The document name.</param> public bool ExecuteJob(string workflow, string documentName) { bool done = false; if (_engine.WaitForHtmlContains("Send to", TimeSpan.FromSeconds(20))) { _engine.ExecuteFunction("pressWorkflowButton", workflow); ProcessDocumentName(documentName); _controlPanel.WaitForValue(_hpecNotificationPanel, "innerText", OmniPropertyType.Property, _workflowOptionTitles[0], StringMatch.Contains); done = true; } else { throw new ControlNotFoundException("The HPEC workflow button, " + workflow + ", could not be found."); } return(done); }
/// <summary> /// Presses the Print button. /// </summary> public void Print() { PressButton(_printButtonId[0]); string exist = _engine.ExecuteFunction("ExistButtonId", "message-ok-button"); if (exist.Equals("true")) { DismissPostOperationPopup(); } else { int threshhold = 30; if (!StartedProcessingWork(TimeSpan.FromSeconds(threshhold))) { throw new DeviceWorkflowException($"PaperCut Print operation did not start printing documents within {threshhold} seconds."); } } }
/// <summary> /// Wait for job list restored /// </summary> public virtual void WaitForJobList(int jobCount, int waitingSeconds) { DateTime endTime = DateTime.Now.AddSeconds(waitingSeconds); int currentJobCount = int.Parse(_engine.ExecuteFunction("getDocumentCounts", "fyp_jobContentEventArea")); while (jobCount != currentJobCount) { if (DateTime.Now > endTime) { throw new DeviceWorkflowException($"Job list is not restored - Job Count: Previous ({jobCount}), Current ({currentJobCount})"); } Thread.Sleep(TimeSpan.FromMilliseconds(500)); currentJobCount = int.Parse(_engine.ExecuteFunction("getDocumentCounts", "fyp_jobContentEventArea")); } }
/// <summary> /// Gets the HPAV version 15.4 or newer document ids. /// </summary> /// <returns>IEnumerable<System.String>.</returns> public string GetFirstDocumentId() { //char[] separator = { '"', ';' }; int value = -1; bool success = int.TryParse(_engine.ExecuteFunction("getDocumentCountUsingImgTag"), out value); //string[] values = id; if (success && value > 0) { return("j1"); } else { return(""); } }
/// <summary> /// Gets the document count. /// </summary> /// <returns>Document count</returns> public int GetDocumentCount() { int docCount = -1; try { docCount = int.Parse(_engine.ExecuteFunction("getDocumentCount")); } catch (JavaScriptExecutionException jsee) { if (jsee.Message.Contains("Can't find variable: getDocumentCount")) { Framework.Logger.LogDebug("Retrying JavaScript 'getDocumentCount' at " + DateTime.Now.ToString()); Thread.Sleep(3000); docCount = int.Parse(_engine.ExecuteFunction("getDocumentCount")); } else { throw; } } return(docCount); }
/// <summary> /// Selects all documents from the document list. /// </summary> public void SelectAllDocuments(string className) { string element = _engine.ExecuteFunction("SelectAllDocuments", className); }
/// <summary> /// Gets the document count. /// </summary> /// <returns>Document count</returns> public override int GetDocumentCount() { return(int.Parse(_engine.ExecuteFunction("getDocumentCount").Replace("\"", ""))); }
private bool ExistElementText(string tag, string elementText, int zIndex) { string existId = _engine.ExecuteFunction("getElementIdbyTextandZIndex", tag, elementText, zIndex).Trim('"'); return(!existId.Equals("undefined")); }
/// <summary> /// Execute Function /// </summary> /// <param name="function">function name</param> public string ExecuteFunction(string function) { return(_engine.ExecuteFunction(function)); }