Jump to content











Photo
- - - - -

[Syntax] IniWriteTextLine command


  • Please log in to reply
13 replies to this topic

#1 edborg

edborg

    Frequent Member

  • .script developer
  • 387 posts
  •  
    Italy

Posted 02 November 2006 - 05:56 PM

It took me quite awhile and a lot of trial and error to find out that the IniWriteTextLine command writes lines in almost reverse order, as shown by the enclosed test (in WB 052 beta3). :P
Why is this so? :P
edborg

Attached Files



#2 pedrole15

pedrole15

    Silver Member

  • .script developer
  • 731 posts
  •  
    France

Posted 02 November 2006 - 07:02 PM

It took me quite awhile and a lot of trial and error to find out that the IniWriteTextLine command writes lines in almost reverse order, as shown by the enclosed test (in WB 052 beta3). :P
Why is this so? :P
edborg

Yes for my MakeScript i have got the same problem :P
"IniWriteTextLine" write always at the first line of the section
"TextAddLine" have the "Append" option for write at the bottom or "Prepend" for write at the top
So it is not easy write code :P

#3 smiley

smiley

    Silver Member

  • .script developer
  • 905 posts
  •  
    Greece

Posted 02 November 2006 - 07:22 PM

Yes for my MakeScript i have got the same problem :P
"IniWriteTextLine" write always at the first line of the section
"TextAddLine" have the "Append" option for write at the bottom or "Prepend" for write at the top
So it is not easy write code :P


Then the IniWriteTextLine command needs also the options "append" or "prepend"
I'll ask Nuno to add this to next Beta :P


John

#4 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 03 November 2006 - 03:15 AM

Then the IniWriteTextLine command needs also the options "append" or "prepend"
I'll ask Nuno to add this to next Beta :P
John

It also needs "navigate" option with following context string to write in the middle :P
I mean
IniWriteTextLine,"file","section","textline",Navigate,"searchstring"
:P
Alexei

#5 edborg

edborg

    Frequent Member

  • .script developer
  • 387 posts
  •  
    Italy

Posted 03 November 2006 - 09:50 AM

Yes for my MakeScript i have got the same problem :P
"IniWriteTextLine" write always at the first line of the section
"TextAddLine" have the "Append" option for write at the bottom or "Prepend" for write at the top
So it is not easy write code :P

Happy to see that I'm not the only one to find it difficult to use. :P
In fact I discovered this when trying to add some lines to your excellent MakeScript (to delete the program folder from Target and CDPrograms before creating a new one). :P

But to me it seems even worse than what you say:
"IniWrite" write always at the first line of the section, but "IniWriteTextLine" writes the first line at the beginning, but then it writes the last one and the remaning in reverse order. :P :P :P
As a minimum, it should have a consistent behaviour.
The suggested "append", "prepend" and "navigate" options would be a further improvement. :P
edborg

#6 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 03 November 2006 - 10:39 AM

IniWrite also "voluntary" reformats the source file deleting comments (";"-lines), etc. :P
I'd like to be able to control it.
As you may noticed, I managed to do some changes in the .inf-file (see my Network.script).
In the future we may need to do more such things, so they shouldn't be too hard :P
:P
Alexei

#7 edborg

edborg

    Frequent Member

  • .script developer
  • 387 posts
  •  
    Italy

Posted 09 November 2006 - 03:39 PM

Just for the records:
The IniWriteTextLine misbehaviour has been solved as from Winbuilder 052 beta8. :P
The "append/prepend/navigate" features are still an open issue.
edborg

#8 FerrariGuy

FerrariGuy

    Member

  • Members
  • 50 posts
  • Location:South Carolina
  •  
    United States

Posted 24 August 2011 - 03:02 PM

I know this is an old topic, but I'd like to re-open the request for the addition of "place" syntax to the IniWriteText line command (like TextWriteLine) http://code.google.c...wiki/txtaddline

Sometimes it would be nice to place a line in a specific spot in a specific section of an ini.

For TextWriteLine, it would be nice if it also had the ability to find a known line, and place a line/space a specific number of lines above or below that line

#9 homes32

homes32

    Gold Member

  • .script developer
  • 1030 posts
  • Location:Minnesota
  •  
    United States

Posted 24 August 2011 - 03:15 PM

I know this is an old topic, but I'd like to re-open the request for the addition of "place" syntax to the IniWriteText line command (like TextWriteLine) http://code.google.c...wiki/txtaddline

Sometimes it would be nice to place a line in a specific spot in a specific section of an ini.

For TextWriteLine, it would be nice if it also had the ability to find a known line, and place a line/space a specific number of lines above or below that line

wow. that's quite an act of necromancy reviving a 5 year old topic! :wodoo:
but this would be useful for modifying GRUB4DOS or Syslinux menus.

#10 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 24 August 2011 - 04:17 PM

@Homes32 - I'm guessing you mean the TextWriteLine, since they don't use "Ini" files :unsure: And yes, this might be handy...(i.e. to more easily find the line number that matched something so we could "insert" additional things in the right place)

@FerrariGuy - Can you give more justification of why (other than human readability and esthetics) that an INI file section contents should be in a specific order?

#11 homes32

homes32

    Gold Member

  • .script developer
  • 1030 posts
  • Location:Minnesota
  •  
    United States

Posted 24 August 2011 - 04:23 PM

@Homes32 - I'm guessing you mean the TextWriteLine, since they don't use "Ini" files :unsure: And yes, this might be handy...(i.e. to more easily find the line number that matched something so we could "insert" additional things in the right place)

@FerrariGuy - Can you give more justification of why (other than human readability and esthetics) that an INI file section contents should be in a specific order?

yep textwriteline..I misread the question....no point in having a placement in IniWriteLine as ini files don't care where stuff is as long as it is in the correct section.

#12 FerrariGuy

FerrariGuy

    Member

  • Members
  • 50 posts
  • Location:South Carolina
  •  
    United States

Posted 24 August 2011 - 05:31 PM

yep textwriteline..I misread the question....no point in having a placement in IniWriteLine as ini files don't care where stuff is as long as it is in the correct section.


Example/Shaky Justification: WinPEShl.ini executes each command in the order it is listed I believe. From Winpeshl.log, I've noticed that in WinPE7_SE nothing seems to execute after "X:\Program Files\PEShell\PEShell.exe" even if it is listed after that command in Winpeshl.ini. If that observation is correct, one wants to prepend WinPEShell.ini rather than append to it, and IniWriteLine allows you to prepend a section, whereas TextWriteLine does not let you append a certain section. Also, it would be better if I could place my modify computer name script before my register WMI command (both handled by WinPEShl.ini) so that WMI picks up on the new computer name. In this case I could look for a known line and place it a certain distance before said known line, but THAT could be handled by TextWriteLine instead since we'd be giving the command a known reference point. I'm not sure how all ini files for use with any/all programs behave. I was not aware than in general programs using ini files only cared that an entry was just in the correct section rather than also in *a* correct order.

Edited by FerrariGuy, 24 August 2011 - 05:32 PM.


#13 homes32

homes32

    Gold Member

  • .script developer
  • 1030 posts
  • Location:Minnesota
  •  
    United States

Posted 24 August 2011 - 06:19 PM


Example/Shaky Justification: WinPEShl.ini executes each command in the order it is listed I believe. From Winpeshl.log, I've noticed that in WinPE7_SE nothing seems to execute after "X:\Program Files\PEShell\PEShell.exe" even if it is listed after that command in Winpeshl.ini. If that observation is correct, one wants to prepend WinPEShell.ini rather than append to it, and IniWriteLine allows you to prepend a section, whereas TextWriteLine does not let you append a certain section. Also, it would be better if I could place my modify computer name script before my register WMI command (both handled by WinPEShl.ini) so that WMI picks up on the new computer name. In this case I could look for a known line and place it a certain distance before said known line, but THAT could be handled by TextWriteLine instead since we'd be giving the command a known reference point. I'm not sure how all ini files for use with any/all programs behave. I was not aware than in general programs using ini files only cared that an entry was just in the correct section rather than also in *a* correct order.

ha yeah. winpeshl is an exception...as like you deduced, commands are run in the order they are listed and the next command does not run until the previous command terminates, so anything after peshell will never be executed. (except in the event of PEshell's untimely death :) )
you can use the following command to prepend to the top of a section in an .ini file.

IniWriteTextLine,%TargetDir%\windows\system32\winpeshl.ini,LaunchApps,MyStartCommand

up to nuno or peter if there is enough justification for a new command allowing to specify a position within an ini section. otherwise it could be done with an API command executing an autoit script that would read the entire .ini section and insert the string in the specified order.

#14 FerrariGuy

FerrariGuy

    Member

  • Members
  • 50 posts
  • Location:South Carolina
  •  
    United States

Posted 24 August 2011 - 06:26 PM

If IniWriteTextLine were to be expanded to handle placing lines in XML (instead of perhaps an XMLWriteSection api or some such) then perhaps? Yes I just dovetailed again... but XML seems to make for perhaps a better example of when/where/why we could use an API of some sort that can precisely place a line in a file based on the position of other lines.

Edited by FerrariGuy, 24 August 2011 - 06:29 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users