示例#1
0
        public void Execute(Arguments arguments)
        {
            if ((arguments.Language?.Value == null) && (arguments.Dictionary?.Value == null))
            {
                arguments.Language = new TextStructure("English");
            }

            AbbyyManager manager = AbbyyManager.Instance;

            FineReaderDocument document = manager.CreateDocument(arguments.Path.Value);

            List <int> pageIndices = null;

            if (arguments.Pages != null && arguments.Pages.Value != null)
            {
                pageIndices = new List <int>(arguments.Pages.Value.Count);
                foreach (Structure o in arguments.Pages.Value)
                {
                    pageIndices.Add(((IntegerStructure)o).Value - 1);
                }
            }

            manager.ProcessDocument(document, pageIndices, arguments.Language?.Value, arguments.LanguageWeight.Value, arguments.DictionaryWeight.Value, ListConverter.ExtractDictionary(arguments.Dictionary?.Value));
            var a = document.Tables.Count;

            Scripter.Variables.SetVariableValue(arguments.Result.Value, new IntegerStructure(document.ID));
            Scripter.Variables.SetVariableValue(arguments.TablesCountResult.Value, new IntegerStructure(document.Tables.Count));
        }
        public void Execute(Arguments arguments)
        {
            if ((arguments.Language?.Value == null) && (arguments.Dictionary?.Value == null))
            {
                arguments.Language = new TextStructure("English");
            }

            Rectangle rectangle    = !arguments.Relative.Value ? arguments.Area.Value : arguments.Area.Value.ToAbsoluteCoordinates();
            Bitmap    partOfScreen = RobotWin32.GetPartOfScreen(rectangle);

            AbbyyManager       manager       = AbbyyManager.Instance;
            FineReaderDocument imageDocument = null;

            using (MemoryStream stream = new MemoryStream())
            {
                partOfScreen.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);
                stream.Position = 0;
                imageDocument   = manager.CreateDocument(stream);
            }

            manager.ProcessDocument(imageDocument, null, arguments.Language?.Value, arguments.LanguageWeight.Value, arguments.DictionaryWeight.Value, ListConverter.ExtractDictionary(arguments.Dictionary?.Value));

            Scripter.Variables.SetVariableValue(arguments.Result.Value, new IntegerStructure(imageDocument.ID));
        }