Extract information using Find, Copy & Paste
- View SourceHello,
I have recently downloaded NoteTabPro Trial (ver5.61) and really need
some help with the clip programming language. One of your members
suggested I post my questions here. I do have some experience
programming but that was in DOS & GWBasic and MANY years ago.
I have a need to copy multiple text entries from a binary file. The
binary files are generally .75 to 15 megabytes in length. The "text"
portion of the file is usually less than 1/2 meg. IF there were just
a few I would do them by hand but I have over 500 to do. IF this is
not the correct program to use, someone please have pity on an Old
Man and tell me.
ANY and ALL assistance is appreciated.
Below is a synopsis of what I am trying to accomplish:
I have managed to open the binary file by using the "Filter Binary
Codes" option and found the information I was seeking.
The bits of information I am looking for immediately follow a unique
string. As a matter of fact, there are several unique strings I need
to extract information from. Below is an example of the identifier
and info I am trying to capture.
"origin" "-544 3344 1272"
"classname" "info_player_ start "
"origin" "-2080 -2104 304"
The unique identifiers are:
"info_player_deathmatch", "info_player_FFA", "info_player_allied", "in
fo_player_axis" and "info_player_start"
As is apparent, all identifiers are identical except the word
following the last "_". I didn't use a wildcard because I need the
output in their respective groups.
The information I need to extract includes the identifier, the line/s
staring with "origin", and the line "angle" (if present) immediately
below the identifier. Rather than create a conditional statement, I
chose to select 2 lines below the identifier and just delete the line
with only the "}" in the output.
The output is saved to a text file with the same name as the binary
file name. (I can't for the life of me figure out how to create a
file using the original name with out the extension so my file name
is something like "origfilename.bsp.txt".)
Below is the code I have managed to create so far but it is certainly
NOT pretty. (P.S. Please don't hurt yourselves laughing. :)
= V5 MultiLine NoSorting TabWidth=30
H=";Extracting Spawn Points"
This clip will extract all the spawn points from a BSP file and save
them in a text file of the same name!
; Makes sure we start with no other files open
;Provides me the choice of the file I want to open
^!ToolBar Open Document
;Assigns the file name of the file I opened to a variable
;Creates a text file with the same filename as the opened file
^!ToolBar New Document
^!Save As ^%BSPTXT%.txt
;Moves focus back to the file I opened
;Gives me the opportunity to see the files are correct.
H="; Find Spawns"
;Label to return to after loop1
;1st bit of information needed
^!Find ""info_player_allied"" CIWS
;If info found,goto loop1, if not go to next search
^!IfTrue ^!Find ""info_player_allied"" Loop1 ELSE Next
^!Find ""info_player_axis"" CIWS
^!IfTrue ^!Find ""info_player_axis"" Loop1 ELSE Next
^!Find ""info_player_Deathmatch"" CIWS
^!IfTrue ^!Find ""info_player_Deathmatch"" Loop1 ELSE Next
^!Find ""info_player_start"" CIWS
; If info not found, Spawn search ends
^!IfTrue ^!Find ""info_player_start"" Loop1 ELSE End
^!Keyboard HOME SHIFTDOWN DOWN DOWN DOWN SHIFTUP
;Inserts a line between found info
Best regards to all and thanks in advance for any comments.
- View SourceYes, I am at least one of the culprits.
I didn't realize until a few days ago that this was a no-no and that it
caused problems on the Yahoo list.
I guess the proper way is to simply address a new email to the list.
My apologies to all.
Alec Burgess wrote:
> wonder whether its just a quirk in my client or if you
> guys really did take the quick and dirty path to switch topics?