Some of the lines are simply redundant, some needs to be reformated and slightly changed, or added. All can be done with "find and replace " of any word processor, however I was wondering if more automatic approach could be devised. I can write line by line required changes.OUTPUT FROM 1st PROGRAM
[Macro]
Name=BoxBuilding1
X=6.4
Y=7
Rotation=180
File=D:\Leung Software\FS Scenery Creator\Macros\PARKING.API
V1=10000
V2=100
Param0=1.92
Param1=1.92
[Macro]
Name=BoxBuilding2
X=110
Y=37
Rotation=180
File=D:\Leung Software\FS Scenery Creator\Macros\PARKING.API
V1=10000
V2=100
Param0=2.56
Param1=2.56
[Macro]
Name=BoxBuilding3
X=114
Y=37
Rotation=180
File=D:\Leung Software\FS Scenery Creator\Macros\PARKING.API
V1=10000
V2=100
Param0=2.56
Param1=2.56
*************************************************************
INPUT FOR 2ndPROGRAM
[city1.bmp]
ObjectCount=3
Object000.TypeName=BoxBuilding1
Object000.MapClass=0
Object000.Chance=100
Object000.PositionX=6.400000
Object000.PositionY=7.000000
Object000.Angle=180.000000
Object001.TypeName=BoxBuilding2
Object001.MapClass=0
Object001.Chance=100
Object001.PositionX=110.000000
Object001.PositionY=37.000000
Object001.Angle=180.000000
Object002.TypeName=BoxBuilding3
Object002.MapClass=0
Object002.Chance=100
Object002.PositionX=114.000000
Object002.PositionY=37.000000
Object002.Angle=180.000000
The Forum is up for sale: XeNTaX Forum looking for new owner
Help in converting text file.
Help in converting text file.
Here is another request for help or advice I submit to this community. I am trying to addopt 3rd party utylity program for one major flight simulator to needs of another. Here is the sample of output and input required.
-
Deniz Oezmen
- VIP member

- Posts: 185
- Joined: Mon Aug 28, 2006 2:07 pm
- Has thanked: 1 time
- Been thanked: 14 times
- Contact:
If the number of files you want to convert is big enough to justify the effort, you could always write a lexer/parser combination that reads the data structures of the first file and outputs the reformatted information to the second file.
Judging from what you posted, this should not be very hard to do -- the format is line-based and doesn't seem to be nested in any difficult way.
Can you specify exactly what needs to be converted to what? And from where do you get the additional information that is not stored in the first file?
Judging from what you posted, this should not be very hard to do -- the format is line-based and doesn't seem to be nested in any difficult way.
Can you specify exactly what needs to be converted to what? And from where do you get the additional information that is not stored in the first file?
Something like this.......
Sorry for this little chaotic format.
Code: Select all
OUTPUT FROM 1st PROGRAM DESIRED INPUT FOR 2nd PROGRAM
ADD:[name of texture.bmp]
ADD:ObjectCount=total number of lines /6
[Macro] DELETE this line
Name=BoxBuilding1 REPLACE: Name with Object%.TypeName
ADD:Object%.MapClass=0
ADD:Object%.Chance=100
X=6.4 REPLACE: X with Object%.PositionX
Y=7 REPLACE: Y with Object%.PositionY
Rotation=180 REPLACE: Rotation with Object%Angle
File=D:\Leung Softwre\FS……… DELETE this line
V1=10000 DELETE this line
V2=100 DELETE this line
Param0=1.92 DELETE this line
Param1=1.92 DELETE this line
[Macro] DELETE this line
Name=BoxBuilding2 REPLACE: Name with Object%.TypeName
ADD:Object%.MapClass=0
ADD:Object%.Chance=100
X=110 REPLACE: X with Object%.PositionX
Y=37 REPLACE: Y with Object%.PositionY
Rotation=180 REPLACE: Rotation with Object%Angle
File=D:\Leung Softwre\FS……… DELETE this line
V1=10000 DELETE this line
V2=100 DELETE this line
Param0=2.56 DELETE this line
Param1=2.56 DELETE this line
[Macro] DELETE this line
Name=BoxBuilding3 REPLACE: Name with Object%.TypeName
ADD:Object%.MapClass=0
ADD:Object%.Chance=100
X=114 REPLACE: X with Object%.PositionX
Y=37 REPLACE: Y with Object%.PositionY
Rotation=180 REPLACE: Rotation with Object%Angle
File=D:\Leung Softwre\FS……… DELETE this line
V1=10000 DELETE this line
V2=100 DELETE this line
Param0=2.56 DELETE this line
Param1=2.56 DELETE this line
DESIRED INPUT
[city1.bmp]
ObjectCount=3
Object000.TypeName=BoxBuilding1
Object000.MapClass=0
Object000.Chance=100
Object000.PositionX=6.400000
Object000.PositionY=7.000000
Object000.Angle=180.000000
Object001.TypeName=BoxBuilding2
Object001.MapClass=0
Object001.Chance=100
Object001.PositionX=110.000000
Object001.PositionY=37.000000
Object001.Angle=180.000000
Object002.TypeName=BoxBuilding3
Object002.MapClass=0
Object002.Chance=100
Object002.PositionX=114.000000
Object002.PositionY=37.000000
Object002.Angle=180.000000
-
Deniz Oezmen
- VIP member

- Posts: 185
- Joined: Mon Aug 28, 2006 2:07 pm
- Has thanked: 1 time
- Been thanked: 14 times
- Contact:
Well, this program is not pretty ... but it should hopefully work.
I've assumed there are no negative values as positions given; else a slight change might be necessary.
[Edit: Well, the change would only be cosmetical. There might be odd warnings if a value is equal to -1.0, but the file will nevertheless be converted correctly.]
I've assumed there are no negative values as positions given; else a slight change might be necessary.
[Edit: Well, the change would only be cosmetical. There might be odd warnings if a value is equal to -1.0, but the file will nevertheless be converted correctly.]
You do not have the required permissions to view the files attached to this post.
-
Deniz Oezmen
- VIP member

- Posts: 185
- Joined: Mon Aug 28, 2006 2:07 pm
- Has thanked: 1 time
- Been thanked: 14 times
- Contact:
Thank you for your quick assistance.Thanks a milion.
The results are in: PERFECT
I understand that this works only in DOS box, but NP.
I will play with it little more, but so far so good. Perhaps just this one: in converted file there are empty lines separating each entry. My fault - but can they be deleted?
The results are in: PERFECT
I will play with it little more, but so far so good. Perhaps just this one: in converted file there are empty lines separating each entry. My fault - but can they be deleted?
-
Deniz Oezmen
- VIP member

- Posts: 185
- Joined: Mon Aug 28, 2006 2:07 pm
- Has thanked: 1 time
- Been thanked: 14 times
- Contact:
Nice to hear that it works.Xela wrote:Thank you for your quick assistance.Thanks a milion.![]()
The results are in: PERFECT
A command-line version was the easiest thing to do -- however, adding a simple GUI would be no problem. If you tell me what you need ...Xela wrote:I understand that this works only in DOS box, but NP.
Sure, no problem. Try the attachment ...Xela wrote:I will play with it little more, but so far so good. Perhaps just this one: in converted file there are empty lines separating each entry. My fault - but can they be deleted?
[Edit: trying once again to attach this file ...]
You do not have the required permissions to view the files attached to this post.
Last edited by Deniz Oezmen on Sat Sep 16, 2006 9:06 am, edited 1 time in total.

