コミュニティ

can I do a checkmark switch to export field image

Greate capturedocs forums,I encountered a problem on checkmark group. The checkmarg group include several options,but the last one can be handwritten. So I want to add rule to Determine the last option output , If the handwritten item chosed,then export the handwritten as image.

like the picture shown below:



If I chose Yes ,then export the text "pxxxxmnt" as tif using script.

Thanks in advance

why can't be displayed after post ?

この記事は役に立ちましたか?

0人中0人がこの記事が役に立ったと言っています

コメント

5件のコメント

  • Avatar
    Katja Ovcharova
    Hello,

    If I understood your question right, you would like to export picture block according to a checkmark value from group (if checked, then export).
    If so, then in the rule script you will need to implement the following steps:
    1. Access the checkmark group field and its children, get the last one and check its Value.
    You can find sample scripts that demonstrate accessing checkmarks and checkmark groups in FlexiCapture 11 Help, section Appendix > Using scripts in ABBYY FlexiCapture > Scripts for customizing processing stages > Sample scripts for creating custom rules.
    2. If the last checkmark value is TRUE, then get the document field with the handwritten text as picture and save it to file.
    Here you have two opportunities:
    - if it is already a block of Picture type, then you can take its value directly (should be IPicture) and write to file with SaveAs method, e.g.
    me.Field("HadnwrittenField").Value.SaveAs(...);
    - if it is a text block, then you can take is region (we assume that there is a simple rectangular region), the code should be like something like me.Field("HadnwrittenField").Regions[0].Picture.SaveAs(...).

    Hope this helps.
    0
  • Avatar
    Permanently deleted user
    Dear Katja,

    You are right,that is what I want(if checked,then export the handwritten text as picture).

    like the picture bellow:



    Q6 is a general group,it has two members: Data and Q6_Yes_Text
    Data is a checkmark group,it has two members:Q6_Yes and Q6_No

    If I check Yes(the fieldName is Q6_Yes), then export Q6_Yes_Text(it is already a block of picture type)

    but now I have two questions comparative doubts:

    1.script error ,I don't known where I am wrong.
    on fieldName of Data,I add two fields,which are "EN\Data\Q6\Data" (read only and alias name is Data) and "..\Q6_Yes_Text" (r/w and alias name is Q6_Yes_Text).the script is only one line:
    me.Field("Q6_Yes_Text").Value.SaveAs("a1.tif") (use VBScript)

    when run test and click check,it throwing "Rule 'EN\Data\Q6\Script'bject required:'Me.field(...).Value'(line 1,pos 1) " error.

    2.Can I only type few word to enable or disable the handwritten text for exporting when the option checked?
    maybe me.Field("Q6_Yes_Text").IsExportable = true ? but I know IsExportable is invalid property assignment here.
    the purpose of doing this is I want to write the path(the handwritten picture will get the path/field name ) to the exported excel.



    It is better to setting a switch to enable/disable the picture output,using script,not click the "Export field value" on the tab of General about field.




    I'm so sorry to trouble you and I am ashamed of my english, I do not know whether you can understand me.












    0
  • Avatar
    Permanently deleted user
    Hello,

    In order to save a field region as image try using SaveAs method the following way:

    me.Field("FieldName").Regions.Item(0).Picture.SaveAs filename, null

    Second argument is for image options, when it is null default options are used.

    If you are using an export script, the FieldName should contain an absolute path to the field, in rule sripts it is the alias name.

    As for the second question, consider creating an additional text field to store the image export path.

    Please reply if you have any further questions.


    0
  • Avatar
    Permanently deleted user
    Dear Timur,
    Thank you for your prompt reply.the reply of the second question makes me excited.That is a good idea.Thank you very much.
    But the first problem is still not resolved.
    me.Field("Q6_Yes_Text").Regions.Item(0).Picture.SaveAs "abc.jpg",null
    Error: Index out of range

    me.Field("Q6_Yes_Text").Regions.Item.Picture.SaveAs "abc.jpg",null
    Error: wrong number of arguments or invalid property assignment:'Me.Field(...).Regions.Item'
    furthermore,the software version of flexicapture is Standard Edition 10.0.4.1486
    0
  • Avatar
    Permanently deleted user
    Hello,

    Try creating a script similar to following example:

    dim imageOptions

    set imageOptions = FCTools.NewImageSavingOptions

    imageOptions.Format = "tif"

    imageOptions.ColorType = "BlackAndWhite"

    imageOptions.Resolution = 600

    me.Field("fieldname").Regions.Item(0).Picture.Save As "C:\Test.tif", imageOptions


    This should probably solve the second issue, since in it coould be that previous versions always requred specific image options to be used.

    First error is teling us that field was not found, and we are trying to access an object that doesn't exist

    in order to avoid this error, try checking if the field contains needed items in the following manner:

    if me.Field("fieldname").Regions.Count>=1 then

    me.Field("fieldname").Regions.Item(0).Picture.Save As "C:\Test.tif", imageOptions

    end if
    0

サインインしてコメントを残してください。