visiyo / AutoStoreWorkflows

Open Source Repo for Sample AutoStore CFGs, Scripts, and Questions
MIT License
8 stars 5 forks source link

Get specific data out of Zone ocr #8

Closed PDGsolutions closed 5 years ago

PDGsolutions commented 7 years ago

Hi,

Could you tell me how i can get specific data out of a ocr zone? I don't know how big the data is that i need, but I know what stand before and after the specific data.

To be more specific i have a zone and i need a name from that zone, and before the name there will be always be "Name:"

njcaruso commented 7 years ago

Can you provide a sample document/image? Can the name be anywhere on the page? Will the value always be to the right of the name?

PDGsolutions commented 7 years ago

Hi, Here i think i am almost there, but i have two problems. First the ~USR::%datum%~ gives an empty value when sending to https, and second is that there is no pass true with this script while there was without. The strange thing is that i tested it with a send to folder and it works there.

here is the script:

Sub test_OnLoad EKOManager.Statusmessage("hello " & m_voertuig) Dim i Dim e

Dim my_len

my_len = 9

i = instr (m_voertuig,"Voertuig:")
ekomanager.statusmessage("koekoek " & i)
e = instr (m_voertuig,"Serienummer:")
m_voertuig= Mid(m_voertuig,i+my_len, e - i - my_len)
EKOManager.Statusmessage("hello2 " & m_voertuig)

Set Topic = KnowledgeContent.GetTopicInterface
If  Not ( Topic Is Nothing) Then
    Topic.Replace "~USR::%voertuig%~", m_voertuig
End If

my_len = 12

i = instr (m_serie,"Serienummer:")
ekomanager.statusmessage("koekoek " & i)
e = instr (m_serie,"Capaciteit:")
m_serie= Mid(m_serie,i+my_len, e - i - my_len)
EKOManager.Statusmessage("hello3 " & m_serie)

Set Topic = KnowledgeContent.GetTopicInterface
If  Not ( Topic Is Nothing) Then
    Topic.Replace "~USR::%serie%~", m_serie
End If

my_len = 6

i = instr (m_datum,"Datum:")
ekomanager.statusmessage("koekoek " & i)
e = instr (m_datum,"Startuur")
ekomanager.statusmessage("koekoek " & e)
m_datum= Mid(m_datum,i+my_len, e - i - my_len)
EKOManager.Statusmessage("hello4 " & m_datum)

Set Topic = KnowledgeContent.GetTopicInterface
If  Not ( Topic Is Nothing) Then
    Topic.Replace "~USR::%datum%~", m_datum
End If

my_len = 10

i = instr (m_order,"nummer:")
ekomanager.statusmessage("koekoek " & i)
m_order= Mid(m_order,i+my_len)
EKOManager.Statusmessage("hello5 " & m_order)

Set Topic = KnowledgeContent.GetTopicInterface
If  Not ( Topic Is Nothing) Then
    Topic.Replace "~USR::%order%~", m_order
End If

End Sub

njcaruso commented 7 years ago

Sorry - I'm still confused. While I haven't run the script, it looks pretty standard. You're creating new RRTs for ~USR::%voertuig%~, etc. Assuming your status messages are being correctly shown in Status Monitor, there is nothing wrong in your script.

When you say "gives an empty value when sending to https", where are you sending to HTTP? Are you using a component, or another script?

When you say "second is that there is no pass true with this script while there was without", what do you mean? The VBScript component should not be impacting any documents in your Knowledge Object (unless in script you are removing them).