AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Processing text column by column?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
EveOnline001



Joined: 23 Mar 2009
Posts: 27

PostPosted: Tue Mar 31, 2009 9:09 am    Post subject: Processing text column by column? Reply with quote

Code:
WWBBWWWWWWWBBBBBWWWWWBBBBBWWWWWWWWWWWWWWBBBBBWWWWBBBBBBWWBBBBBBWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWBBWWWWWWBBBBBBBWWWBBBBBBBWWWWWWWWWWWWBBBBBBBWWWBBBBBWWWBBBBBWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWBBWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWWWWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWWWWWWWWWW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WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWBBWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWBBBBBBWWBBBBBBBWWWBBBBBBBWWWWWWWWWWWWBBBBBBBWWWBBWWWWWWBBWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWBBBBBBWWWBBBBBWWWWWBBBBBBWWWWWWWWWWWWWBBBBBWWWWBBWWWWWWBBWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW


If you look closely, you will notice that is the phrase LOG OFF. The text
are the B letters, the background are the W letters.

I am using using some code to extract Pixels from a video game. It then
decides whether the pixel is a background color, or a text color, and it
adds each pixel into a blob of text I will be able to save and compare in
the future.

My challenge: I need to remove all the lines of background that appear
before the phrase, between the letters, and after the phrase.

How can I erase the columns where the column is only W's, and it doesn't
have any B's? I was thinking of using arrays, but it seems the arrays in
AutoHotKey aren't complex enough.

Do you have any ideas?

Thnx


Last edited by EveOnline001 on Tue Mar 31, 2009 10:10 am; edited 1 time in total
Back to top
View user's profile Send private message
Guest






PostPosted: Tue Mar 31, 2009 10:08 am    Post subject: Reply with quote

Quote:
Choose a descriptive subject line. For example, avoid titles like "Need help with something simple". Instead, use a specific title like "How to programmatically select text in Notepad".
Confused
Back to top
EveOnline001



Joined: 23 Mar 2009
Posts: 27

PostPosted: Tue Apr 07, 2009 6:07 pm    Post subject: Reply with quote

Does anyone have suggestion?

Thnx
Back to top
View user's profile Send private message
hugov



Joined: 27 May 2007
Posts: 2181

PostPosted: Tue Apr 07, 2009 8:00 pm    Post subject: Reply with quote

Two examples, one that removes all similar columns e.g. all W and all B will be removed the second will do what you want I think. Remove only W cols
Code:
SetBatchLines, -1
String= ; replace by fileread
(
WWBBWWWWWWWBBBBBWWWWWBBBBBWWWWWWWWWWWWWWBBBBBWWWWBBBBBBWWBBBBBBWWWW
WWBBWWWWWWBBBBBBBWWWBBBBBBBWWWWWWWWWWWWBBBBBBBWWWBBBBBWWWBBBBBWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWBBWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWWWWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWWWWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWWWWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWBBBBWWWWWWWWWWWWBBWWWBBWWWBBBBBWWWBBBBBWWWWW
WWBBWWWWWWBBWWWBBWWWBBWBBBBWWWWWWWWWWWWBBWWWBBWWWBBBBBWWWBBBBBWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWBBWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWBBWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWBBWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWW
WWBBBBBBWWBBBBBBBWWWBBBBBBBWWWWWWWWWWWWBBBBBBBWWWBBWWWWWWBBWWWWWWWW
WWBBBBBBWWWBBBBBWWWWWBBBBBBWWWWWWWWWWWWWBBBBBWWWWBBWWWWWWBBWWWWWWWW
)
Filedelete, stringout.txt
StringSplit, Line, String, `n, `r
Loop % StrLen(Line1)
   {
    ColTheSame=True
    Check:=A_Index
    Loop % Line0
      {
       Col:=A_Index
       NextLine := A_Index + 1
       If (A_Index = Line0)
         Break
       A:= SubStr(Line%A_Index%,Check,1)
       B:= SubStr(Line%NextLine%,Check,1)   
       ;MsgBox % Check "`na" a ":" "b" b
       If ( A <> B )
          {
          ColTheSame=False
          break
         }
      }
    If ( ColTheSame = "True" )
      RemoveCols .= Check ","
   }

Loop % Line0
   {   
   Check:=A_Index
    Loop, Parse, Line%Check%
      {
       ; If A_Index not in %RemoveCols% ; note if in var is very very slow
        If (InStr("," . RemoveCols . "," , "," . A_Index . ",") = 0) ; 0 is not found
         OutPut .= A_LoopField ; append
      }
   Output .= "`n"   
   }
FileAppend, %Output%, stringout.txt
Esc::ExitApp


Code:
SetBatchLines, -1
String= ; replace by fileread
(
WWBBWWWWWWWBBBBBWWWWWBBBBBWWWWWWWWWWWWWWBBBBBWWWWBBBBBBWWBBBBBBWWWW
WWBBWWWWWWBBBBBBBWWWBBBBBBBWWWWWWWWWWWWBBBBBBBWWWBBBBBWWWBBBBBWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWBBWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWWWWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWWWWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWWWWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWBBBBWWWWWWWWWWWWBBWWWBBWWWBBBBBWWWBBBBBWWWWW
WWBBWWWWWWBBWWWBBWWWBBWBBBBWWWWWWWWWWWWBBWWWBBWWWBBBBBWWWBBBBBWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWBBWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWBBWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWW
WWBBWWWWWWBBWWWBBWWWBBWWWBBWWWWWWWWWWWWBBWWWBBWWWBBWWWWWWBBWWWWWWWW
WWBBBBBBWWBBBBBBBWWWBBBBBBBWWWWWWWWWWWWBBBBBBBWWWBBWWWWWWBBWWWWWWWW
WWBBBBBBWWWBBBBBWWWWWBBBBBBWWWWWWWWWWWWWBBBBBWWWWBBWWWWWWBBWWWWWWWW
)
Filedelete, stringout2.txt
StringSplit, Line, String, `n, `r
Loop % StrLen(Line1)
   {
    ColTheSame=True
    Check:=A_Index
    Loop % Line0
      {
       Column .= SubStr(Line%A_Index%,Check,1)
      }
    IfNotInString, Column, B
      RemoveCols .= Check ","
    Column=   
   }

Loop % Line0
   {   
   Check:=A_Index
    Loop, Parse, Line%Check%
      {
       ; If A_Index not in %RemoveCols% ; note if in var is very very slow
        If (InStr("," . RemoveCols . "," , "," . A_Index . ",") = 0) ; 0 is not found
         OutPut .= A_LoopField ; append
      }
   Output .= "`n"   
   }
FileAppend, %Output%, stringout2.txt
Esc::ExitApp

_________________
Tut 4 Newbies
TF : Text file & string lib, TF Forum
Back to top
View user's profile Send private message Visit poster's website
EveOnline001



Joined: 23 Mar 2009
Posts: 27

PostPosted: Tue Apr 07, 2009 8:53 pm    Post subject: Reply with quote

Code:
BBWWWWWBBBBBWWBBBBBWWBBBBBWBBBBBBBBBBBB
BBWWWWBBBBBBBBBBBBBBBBBBBBBBBBBBWBBBBBW
BBWWWWBBWWWBBBBWWWBBBBWWWBBBBWWWWBBWWWW
BBWWWWBBWWWBBBBWWWWWBBWWWBBBBWWWWBBWWWW
BBWWWWBBWWWBBBBWWWWWBBWWWBBBBWWWWBBWWWW
BBWWWWBBWWWBBBBWWWWWBBWWWBBBBWWWWBBWWWW
BBWWWWBBWWWBBBBWBBBBBBWWWBBBBBBBWBBBBBW
BBWWWWBBWWWBBBBWBBBBBBWWWBBBBBBBWBBBBBW
BBWWWWBBWWWBBBBWWWBBBBWWWBBBBWWWWBBWWWW
BBWWWWBBWWWBBBBWWWBBBBWWWBBBBWWWWBBWWWW
BBWWWWBBWWWBBBBWWWBBBBWWWBBBBWWWWBBWWWW
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBWWWWBBWWWW
BBBBBBWBBBBBWWBBBBBBWBBBBBWBBWWWWBBWWWW


Success Smile The script you wrote is a lot shorter than the one I had
previously. I'll have to look over it and see what you did.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group