Separating Scanned Data

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
bivanchan
Posts: 29
Joined: 10 Feb 2022, 10:01

Re: Separating Scanned Data

Post by bivanchan » 26 Nov 2022, 16:02

Fantastic that works perfect. Now if someone has to manually type in an artwork ID they still can. Thank you both for all the help today.

User avatar
JoeWinograd
Posts: 2198
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Separating Scanned Data

Post by JoeWinograd » 26 Nov 2022, 17:38

bivanchan wrote:we might have some old barcodes floating around
The code you posted will not work. For starters, DataArray is an array, so if (DataArray = "XYZ") is bad syntax...it would have to be if (DataArray[N] = "XYZ"), where N is an integer, i.e., the Nth element of the array.

But let's think this through. The old barcodes do not have XYZ anywhere in them, while the new barcodes do. There are many ways to code for this. One simple idea is that when doing the StrSplit(gtx,"XYZ"), the old barcodes will have DataArray[2] as null, while the new barcodes will have DataArray[2] as non-null. The code for that approach is:

Code: Select all

Gui,Submit,Nohide
DataArray:=StrSplit(gtx,"XYZ")
If (DataArray[2]!="")
  gtx:=DataArray[2]
Another simple idea is to see if gtx has XYZ in it before doing the StrSplit. The code for that approach is:

Code: Select all

Gui,Submit,Nohide
If (InStr(gtx,"XYZ"))
{
  DataArray:=StrSplit(gtx,"XYZ")
  gtx:=DataArray[2]
}
Regards, Joe

User avatar
JoeWinograd
Posts: 2198
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Separating Scanned Data

Post by JoeWinograd » 26 Nov 2022, 17:39

You're welcome...our messages crossed again. :)

Post Reply

Return to “Ask for Help (v1)”