Omitting certain characters with OCR

Hey all!

I am working on a program that will grab numbers using OCR and put them into a spreadsheet.

Right now, my code looks like this:
Put ReadText((500,100),(625,130), ValidCharacters:"0123456789.,") into Premium

Then I put that value into a .csv file
Put Premium into item 2 of line LineNumber of file Test

However, because it is a CSV file, if it is a number such as "1,838.88", the CSV file will have the value "1" in one cell of the spreadsheet, and "828.88" in the next cell.

Is there some sense talk code that could strip out any commas from the number?

Comments

  • EggplantMattEggplantMatt admin ForumAdmin admin
    Sure.
    delete comma from Premium
    
  • Nice! That did it! Thanks Matt.
    Another question with working with csv files.

    I have some code written to compare two columns of data and state whether they are equal, less than, or greater than.

    As the code goes through the data everything seems peachy, then it just nosedives for some reason. I have no idea why.
    put "2" into LineNumber
    Log "finished variable initialization"
    set myFile = "G:\QATCOE\scripts\Datasheets\testsheet.csv"
    Log "got file"
    repeat with CertInfo = each line of line LineNumber to the last of file myFile
    	Log " LineNumber is ["&LineNumber&"]"
    	Put item 2 of CertInfo into PROD_RFBAL
    	Log "["&PROD_RFBAL&"] found"
    	Put item 3 of CertInfo into TEST_RFBAL
    	Log "["&TEST_RFBAL&"] found"
    	If PROD_RFBAL = TEST_RFBAL
    		Put "EQUAL" into item 4 of line LineNumber of file myFile
    	Else if PROD_RFBAL <TEST_RFBAL> TEST_RFBAL
    		put "GREATER THAN" into item 4 of line LineNumber of file myFile
    	End if
    	
    	Add 1 to LineNumber
    	
    End Repeat
    

    The out put that the logs give me is this:
    10/13/14 9:50:23 AM	START		Running MPPQ_CompareRFBAL.script
    10/13/14 9:50:24 AM	opensuite		Common.suite
    10/13/14 9:50:24 AM	Log		finished variable initialization
    10/13/14 9:50:24 AM	Log		got file
    10/13/14 9:50:25 AM	Log		 LineNumber is [2]
    10/13/14 9:50:25 AM	Log		into loop
    10/13/14 9:50:25 AM	Log		[RECORD NOT IN GOOD STANDING] found
    10/13/14 9:50:25 AM	Log		[RECORD NOT IN GOOD STANDING] found
    10/13/14 9:50:26 AM	Log		 LineNumber is [3]
    10/13/14 9:50:26 AM	Log		into loop
    10/13/14 9:50:26 AM	Log		[1838.88] found
    10/13/14 9:50:26 AM	Log		[1804.44] found
    10/13/14 9:50:27 AM	Log		 LineNumber is [4]
    10/13/14 9:50:27 AM	Log		into loop
    10/13/14 9:50:27 AM	Log		[3137.64] found
    10/13/14 9:50:27 AM	Log		[3013.80] found
    10/13/14 9:50:28 AM	Log		 LineNumber is [5]
    10/13/14 9:50:28 AM	Log		into loop
    10/13/14 9:50:28 AM	Log		[836.76] found
    10/13/14 9:50:28 AM	Log		[688.44] found
    10/13/14 9:50:29 AM	Log		 LineNumber is [6]
    10/13/14 9:50:29 AM	Log		into loop
    10/13/14 9:50:29 AM	Log		[921.48] found
    10/13/14 9:50:29 AM	Log		[902.52] found
    10/13/14 9:50:30 AM	Log		 LineNumber is [7]
    10/13/14 9:50:30 AM	Log		into loop
    10/13/14 9:50:30 AM	Log		[RECORD NOT IN GOOD STANDING] found
    10/13/14 9:50:30 AM	Log		[RECORD NOT IN GOOD STANDING] found
    10/13/14 9:50:31 AM	Log		 LineNumber is [8]
    10/13/14 9:50:31 AM	Log		into loop
    10/13/14 9:50:31 AM	Log		[RECORD NOT IN GOOD STANDING] found
    10/13/14 9:50:31 AM	Log		[RECORD NOT IN GOOD STANDING] found
    10/13/14 9:50:32 AM	Log		 LineNumber is [9]
    10/13/14 9:50:32 AM	Log		into loop
    10/13/14 9:50:32 AM	Log		[1238.28] found
    10/13/14 9:50:32 AM	Log		[1187.64] found
    10/13/14 9:50:33 AM	Log		 LineNumber is [10]
    10/13/14 9:50:33 AM	Log		into loop
    10/13/14 9:50:33 AM	Log		[779.88] found
    10/13/14 9:50:33 AM	Log		[755.28] found
    10/13/14 9:50:35 AM	Log		 LineNumber is [11]
    10/13/14 9:50:35 AM	Log		into loop
    10/13/14 9:50:35 AM	Log		[3386.88] found
    10/13/14 9:50:35 AM	Log		[3352.68] found
    10/13/14 9:50:36 AM	Log		 LineNumber is [12]
    10/13/14 9:50:36 AM	Log		into loop
    10/13/14 9:50:36 AM	Log		[427.56] found
    10/13/14 9:50:36 AM	Log		[403.92] found
    10/13/14 9:50:37 AM	Log		 LineNumber is [13]
    10/13/14 9:50:37 AM	Log		into loop
    10/13/14 9:50:37 AM	Log		[7537.8] found
    10/13/14 9:50:37 AM	Log		[7392.48] found
    10/13/14 9:50:38 AM	Log		 LineNumber is [14]
    10/13/14 9:50:38 AM	Log		into loop
    10/13/14 9:50:38 AM	Log		[\n4708588] found
    10/13/14 9:50:38 AM	Log		[28.2] found
    10/13/14 9:50:39 AM	Log		 LineNumber is [15]
    10/13/14 9:50:39 AM	Log		into loop
    10/13/14 9:50:39 AM	Log		[] found
    10/13/14 9:50:39 AM	Log		[] found
    10/13/14 9:50:40 AM	Log		 LineNumber is [16]
    10/13/14 9:50:40 AM	Log		into loop
    10/13/14 9:50:40 AM	Log		[] found
    10/13/14 9:50:40 AM	Log		[] found
    10/13/14 9:50:41 AM	Log		 LineNumber is [17]
    10/13/14 9:50:41 AM	Log		into loop
    10/13/14 9:50:41 AM	Log		[\n4841743] found
    10/13/14 9:50:41 AM	Log		[1067.16] found
    10/13/14 9:50:42 AM	Log		 LineNumber is [18]
    10/13/14 9:50:42 AM	Log		into loop
    10/13/14 9:50:42 AM	Log		[1449] found
    10/13/14 9:50:42 AM	Log		[1376.28] found
    10/13/14 9:50:43 AM	Log		 LineNumber is [19]
    10/13/14 9:50:43 AM	Log		into loop
    10/13/14 9:50:43 AM	Log		[\n5345771] found
    10/13/14 9:50:43 AM	Log		[559.44] found
    10/13/14 9:50:44 AM	Log		 LineNumber is [20]
    10/13/14 9:50:44 AM	Log		into loop
    10/13/14 9:50:44 AM	Log		[\n4841054] found
    10/13/14 9:50:44 AM	Log		[1214.4] found
    10/13/14 9:50:46 AM	Log		 LineNumber is [21]
    10/13/14 9:50:46 AM	Log		into loop
    10/13/14 9:50:46 AM	Log		[552.12] found
    10/13/14 9:50:46 AM	Log		[538.80] found
    10/13/14 9:50:47 AM	Log		 LineNumber is [22]
    10/13/14 9:50:47 AM	Log		into loop
    10/13/14 9:50:47 AM	Log		[3611.76] found
    10/13/14 9:50:47 AM	Log		[3549.60] found
    10/13/14 9:50:48 AM	Log		 LineNumber is [23]
    10/13/14 9:50:48 AM	Log		into loop
    10/13/14 9:50:48 AM	Log		[1297.8] found
    10/13/14 9:50:48 AM	Log		[1235.40] found
    10/13/14 9:50:49 AM	Log		 LineNumber is [24]
    10/13/14 9:50:49 AM	Log		into loop
    10/13/14 9:50:49 AM	Log		[618.96] found
    10/13/14 9:50:49 AM	Log		[572.40] found
    10/13/14 9:50:50 AM	Log		 LineNumber is [25]
    10/13/14 9:50:50 AM	Log		into loop
    10/13/14 9:50:50 AM	Log		[595.2] found
    10/13/14 9:50:50 AM	Log		[568.56] found
    10/13/14 9:50:51 AM	Log		 LineNumber is [26]
    10/13/14 9:50:51 AM	Log		into loop
    10/13/14 9:50:51 AM	Log		[2437.92] found
    10/13/14 9:50:51 AM	Log		[2347.68] found
    10/13/14 9:50:52 AM	Log		 LineNumber is [27]
    10/13/14 9:50:52 AM	Log		into loop
    10/13/14 9:50:52 AM	Log		[581.4] found
    10/13/14 9:50:52 AM	Log		[548.88] found
    10/13/14 9:50:54 AM	Log		 LineNumber is [28]
    10/13/14 9:50:54 AM	Log		into loop
    10/13/14 9:50:54 AM	Log		[646.08] found
    10/13/14 9:50:54 AM	Log		[634.20] found
    10/13/14 9:50:55 AM	Log		 LineNumber is [29]
    10/13/14 9:50:55 AM	Log		into loop
    10/13/14 9:50:55 AM	Log		[RECORD NOT IN GOOD STANDING] found
    10/13/14 9:50:55 AM	Log		[RECORD NOT IN GOOD STANDING] found
    10/13/14 9:50:56 AM	Log		 LineNumber is [30]
    10/13/14 9:50:56 AM	Log		into loop
    10/13/14 9:50:56 AM	Log		[1151.28] found
    10/13/14 9:50:56 AM	Log		[1093.92] found
    10/13/14 9:50:57 AM	Log		 LineNumber is [31]
    10/13/14 9:50:57 AM	Log		into loop
    10/13/14 9:50:57 AM	Log		[] found
    10/13/14 9:50:57 AM	Log		[] found
    10/13/14 9:50:58 AM	Log		 LineNumber is [32]
    10/13/14 9:50:58 AM	Log		into loop
    10/13/14 9:50:58 AM	Log		[4106.4] found
    10/13/14 9:50:58 AM	Log		[3875.04] found
    10/13/14 9:50:59 AM	Log		 LineNumber is [33]
    10/13/14 9:50:59 AM	Log		into loop
    10/13/14 9:50:59 AM	Log		[\n5632340] found
    10/13/14 9:50:59 AM	Log		[4402.68] found
    10/13/14 9:51:00 AM	Log		 LineNumber is [34]
    10/13/14 9:51:00 AM	Log		into loop
    10/13/14 9:51:00 AM	Log		[1443.96] found
    10/13/14 9:51:00 AM	Log		[1378.68] found
    10/13/14 9:51:02 AM	Log		 LineNumber is [35]
    10/13/14 9:51:02 AM	Log		into loop
    10/13/14 9:51:02 AM	Log		[697.8] found
    10/13/14 9:51:02 AM	Log		[685.32] found
    10/13/14 9:51:03 AM	Log		 LineNumber is [36]
    10/13/14 9:51:03 AM	Log		into loop
    10/13/14 9:51:03 AM	Log		[20387.4] found
    10/13/14 9:51:03 AM	Log		[19550.16] found
    10/13/14 9:51:04 AM	Log		 LineNumber is [37]
    10/13/14 9:51:04 AM	Log		into loop
    10/13/14 9:51:04 AM	Log		[6168.12] found
    10/13/14 9:51:04 AM	Log		[5705.04] found
    10/13/14 9:51:05 AM	Log		 LineNumber is [38]
    10/13/14 9:51:05 AM	Log		into loop
    10/13/14 9:51:05 AM	Log		[] found
    10/13/14 9:51:05 AM	Log		[] found
    10/13/14 9:51:06 AM	Log		 LineNumber is [39]
    10/13/14 9:51:06 AM	Log		into loop
    10/13/14 9:51:06 AM	Log		[] found
    10/13/14 9:51:06 AM	Log		[] found
    10/13/14 9:51:07 AM	Log		 LineNumber is [40]
    10/13/14 9:51:07 AM	Log		into loop
    10/13/14 9:51:07 AM	Log		[RECORD NOT IN GOOD STANDING] found
    10/13/14 9:51:07 AM	Log		[RECORD NOT IN GOOD STANDING] found
    10/13/14 9:51:08 AM	Log		 LineNumber is [41]
    10/13/14 9:51:08 AM	Log		into loop
    10/13/14 9:51:08 AM	Log		[1297.32] found
    10/13/14 9:51:08 AM	Log		[1217.40] found
    10/13/14 9:51:09 AM	Log		 LineNumber is [42]
    10/13/14 9:51:09 AM	Log		into loop
    10/13/14 9:51:09 AM	Log		[\n6098443] found
    10/13/14 9:51:10 AM	Log		[1689.6] found
    10/13/14 9:51:11 AM	Log		 LineNumber is [43]
    10/13/14 9:51:11 AM	Log		into loop
    10/13/14 9:51:11 AM	Log		[LOAN OUTSTANDING] found
    10/13/14 9:51:11 AM	Log		[] found
    10/13/14 9:51:12 AM	Log		 LineNumber is [44]
    10/13/14 9:51:12 AM	Log		into loop
    10/13/14 9:51:12 AM	Log		[2147.64] found
    10/13/14 9:51:12 AM	Log		[2089.08] found
    10/13/14 9:51:13 AM	Log		 LineNumber is [45]
    10/13/14 9:51:13 AM	Log		into loop
    10/13/14 9:51:13 AM	Log		[RECORD NOT IN GOOD STANDING] found
    10/13/14 9:51:13 AM	Log		[RECORD NOT IN GOOD STANDING] found
    10/13/14 9:51:14 AM	Log		 LineNumber is [46]
    10/13/14 9:51:14 AM	Log		into loop
    10/13/14 9:51:14 AM	Log		[5104.8] found
    10/13/14 9:51:14 AM	Log		[4643.40] found
    10/13/14 9:51:15 AM	Log		 LineNumber is [47]
    10/13/14 9:51:15 AM	Log		into loop
    10/13/14 9:51:15 AM	Log		[LOAN OUTSTANDING] found
    10/13/14 9:51:15 AM	Log		[] found
    10/13/14 9:51:16 AM	Log		 LineNumber is [48]
    10/13/14 9:51:16 AM	Log		into loop
    10/13/14 9:51:16 AM	Log		[2760.6] found
    10/13/14 9:51:16 AM	Log		[2721.36] found
    10/13/14 9:51:17 AM	Log		 LineNumber is [49]
    10/13/14 9:51:17 AM	Log		into loop
    10/13/14 9:51:17 AM	Log		[\n5548146] found
    10/13/14 9:51:17 AM	Log		[12056.76] found
    10/13/14 9:51:18 AM	Log		 LineNumber is [50]
    10/13/14 9:51:18 AM	Log		into loop
    10/13/14 9:51:18 AM	Log		[RECORD NOT IN GOOD STANDING] found
    10/13/14 9:51:18 AM	Log		[RECORD NOT IN GOOD STANDING] found
    10/13/14 9:51:20 AM	Log		 LineNumber is [51]
    10/13/14 9:51:20 AM	Log		into loop
    10/13/14 9:51:20 AM	Log		[941.88] found
    10/13/14 9:51:20 AM	Log		[916.32] found
    10/13/14 9:51:21 AM	Log		 LineNumber is [52]
    10/13/14 9:51:21 AM	Log		into loop
    10/13/14 9:51:21 AM	Log		[\n6092924] found
    10/13/14 9:51:21 AM	Log		[40.8] found
    10/13/14 9:51:22 AM	Log		 LineNumber is [53]
    10/13/14 9:51:22 AM	Log		into loop
    10/13/14 9:51:22 AM	Log		[522.36] found
    10/13/14 9:51:22 AM	Log		[498.96] found
    10/13/14 9:51:23 AM	Log		 LineNumber is [54]
    10/13/14 9:51:23 AM	Log		into loop
    10/13/14 9:51:23 AM	Log		[1916.52] found
    10/13/14 9:51:23 AM	Log		[1862.16] found
    10/13/14 9:51:24 AM	Log		 LineNumber is [55]
    10/13/14 9:51:24 AM	Log		into loop
    10/13/14 9:51:24 AM	Log		[] found
    10/13/14 9:51:24 AM	Log		[] found
    10/13/14 9:51:25 AM	Log		 LineNumber is [56]
    10/13/14 9:51:25 AM	Log		into loop
    10/13/14 9:51:25 AM	Log		[1107] found
    10/13/14 9:51:25 AM	Log		[1040.40] found
    10/13/14 9:51:26 AM	Log		 LineNumber is [57]
    10/13/14 9:51:26 AM	Log		into loop
    10/13/14 9:51:26 AM	Log		[1167.72] found
    10/13/14 9:51:26 AM	Log		[1090.44] found
    10/13/14 9:51:27 AM	Log		 LineNumber is [58]
    10/13/14 9:51:27 AM	Log		into loop
    10/13/14 9:51:27 AM	Log		[1934.16] found
    10/13/14 9:51:27 AM	Log		[1877.28] found
    10/13/14 9:51:28 AM	EndTestCase		(Duration:"64.899", Errors:"1", Exceptions:"0", StartTime:"2014-10-13 09:50:23 -0500", Successes:"0", TestCase:"MPPQ_CompareRFBAL.script", Warnings:"0")
    10/13/14 9:51:28 AM	ABORTED		Execution Time 0:01:05 MPPQ_CompareRFBAL.script
    

    All of a sudden a ways through it doesn't read the .csv correctly. Any idea why it is doing this?
Sign In or Register to comment.