Jump to content











Photo
- - - - -

IniWrite


  • Please log in to reply
21 replies to this topic

#1 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 22 November 2006 - 12:14 PM

*** Edited: I caught the wrong line. :P
It really was an IniWrite, not an IniWriteTextLine
***
Here the actual issue
***
I have the following code (in Alexei's network script)
Message,"1 IniWrite Alerter_Service_Inst",Information

IniWrite,"%InfNQ%\netmscli.inf","Alerter_Service_Inst","StartType","3"

Message,"2 IniWrite Alerter_Service_Inst",Information
(I inserted the message lines to observe)

At the first message, netmscli.inf has the 'normal' content. Here the text around Alerter_Service_Inst (where the IniWrite has to insert).
[attachment=798:attachment]
At the second message, that is after the IniWrite, the complete netmscli.inf is erased, letting only the newly written entry left:
[attachment=799:attachment]

I found a possible reason:
netmscli.inf is an Unicode file!

Peter

Edited by psc, 23 November 2006 - 07:36 AM.


#2 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 22 November 2006 - 11:42 PM

I know how to handle unicode files, but will decrease overall performance..

Perhaps it can be added as an option? :P

#3 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 23 November 2006 - 07:34 AM

I know how to handle unicode files, but will decrease overall performance..

Perhaps it can be added as an option? :P


What about the additional commands

ReadUniIni, WriteUniIni ...

Peter

#4 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 23 November 2006 - 12:31 PM

Seems a good idea, I'll run some tests and see the results.. :P

#5 Holger

Holger

    Silver Member

  • .script developer
  • 534 posts
  • Location:Munich
  • Interests:- programming / scripting
    - scooter driving / modifying
    - writing poems
  •  
    Germany

Posted 14 January 2007 - 01:59 AM

Edit: cause I think it will also need some time I wrote a small cmdline "uni2ansi source target" to solve my problems :P

#6 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 14 January 2007 - 08:29 PM

Edit: cause I think it will also need some time I wrote a small cmdline "uni2ansi source target" to solve my problems :P

How do you wanna transform unicode into ANSI? :P

@psc
Checked the unicode thing, seems all ini* commands can't write or open unicode files, so they create new ones with the same names. :P
I would prefer an error message instead! :P

#7 Holger

Holger

    Silver Member

  • .script developer
  • 534 posts
  • Location:Munich
  • Interests:- programming / scripting
    - scooter driving / modifying
    - writing poems
  •  
    Germany

Posted 14 January 2007 - 08:50 PM

Ever heard of "WideCharToMultiByte()"? :P

...I wrote a small cmdline...

:P

#8 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 14 January 2007 - 09:48 PM

Ever heard of "WideCharToMultiByte()"? :P

:P

Ah, i see you wanna turn the unicode file into pseudo ansi so that the commands work and then turn it back into a unicode file! :P
Very clever! :P

#9 Holger

Holger

    Silver Member

  • .script developer
  • 534 posts
  • Location:Munich
  • Interests:- programming / scripting
    - scooter driving / modifying
    - writing poems
  •  
    Germany

Posted 14 January 2007 - 09:59 PM

Nearly :P
I convert the inf file to ansi - however, converting back to unicde ist not needed.
Windows also understands ansi inf files.

#10 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 14 January 2007 - 10:45 PM

Nearly :P
I convert the inf file to ansi - however, converting back to unicde ist not needed.
Windows also understands ansi inf files.

You don't need unicode for the 'data' part. In no language. You only need it for the [Strings] part of certain languages.
I doubt that those strings will still be readable, if you don't convert back.

:P

#11 Holger

Holger

    Silver Member

  • .script developer
  • 534 posts
  • Location:Munich
  • Interests:- programming / scripting
    - scooter driving / modifying
    - writing poems
  •  
    Germany

Posted 15 January 2007 - 05:03 AM

Good point, we will see....hmmm...should work...will take a look again, cause German has also some special characters like "ä", "ö" and "ü".
For other languages like Chinese, Japanese, Korean i.e. we will see :P
And implementing a back converting is not a problem...

#12 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 15 January 2007 - 02:30 PM

Good point, we will see....hmmm...should work...will take a look again, cause German has also some special characters like "ä", "ö" and "ü".
For other languages like Chinese, Japanese, Korean i.e. we will see :P
And implementing a back converting is not a problem...

German is 100% ANSI. :P

#13 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 15 January 2007 - 05:00 PM

As localization is supposed to be supported by WB, "INI-commands not working with unicode" is just a bug.

Until it's not fixed, a quick workaround seems to be (requires some programming):
- split the INI file in two (before and starting-with [strings]),
- convert 1st part to ANSI
- do INI processing on the 1st part
- convert 1st part to unicode
- combine two files (append 2nd part to 1st)

Even simpler (but tricky) workaround may be possible (though I'm not sure):
- replace hex 0 with some special simbol (for ex "|")
- replace "|[" with "[" and "|]" with "]" to make INI-commands to see sections in INI-file, also do same with blanks!
- replace all strings in INI-commands like this: "abc" -> "|a|b|c"
- perform INI-editing commands
- replace "[" with "|["
- replace "]" with "|]"
- replace " " with "| "
- replace "|" with hex 0 :P

:P
Alexei

#14 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 15 January 2007 - 05:36 PM

I know how to handle unicode files, but will decrease overall performance..
Perhaps it can be added as an option? :P

@Nuno
What did you mean by "overall performance"?
Was it that you was thinking about rewriting WB to switch completely to widestrings?

You can add processing of unicode INIs (and only them!) using widestrings, though even this is not really necessary. You can do minimal changes to make it work:
- recognize unicode [,], and blank as [,],blank (I mean treat '#0[' as '[', etc.)
- convert to unicode (to strings in unicode, not widestrings) all strings specified in INI-edit commands (I mean 'abc' to '#0a#0b#0c').

:P
Alexei

PS
A bit off topic: I already mentioned this, we can add unicode support to WB by simply adding 'anyunicode' to existing "anystring" syntax.

#15 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 15 January 2007 - 06:08 PM

@Alexei
Not just the ini-commands don't do unicode, the txtcommands can also only do ANSI! :P

#16 smiley

smiley

    Silver Member

  • .script developer
  • 905 posts
  •  
    Greece

Posted 15 January 2007 - 07:16 PM

I know how to handle unicode files, but will decrease overall performance..
Perhaps it can be added as an option?


Yes, Alexei is right. Perhaps make you can make only the commands for ini - text files to use unicode.
If this happen, I think that only if there are many of these commands in a script , it can decrease overall performance

#17 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 16 January 2007 - 10:32 AM

@Nuno
What did you mean by "overall performance"?
Was it that you was thinking about rewriting WB to switch completely to widestrings?

You can add processing of unicode INIs (and only them!) using widestrings, though even this is not really necessary. You can do minimal changes to make it work:
- recognize unicode [,], and blank as [,],blank (I mean treat '#0[' as '[', etc.)
- convert to unicode (to strings in unicode, not widestrings) all strings specified in INI-edit commands (I mean 'abc' to '#0a#0b#0c').

:P
Alexei

PS
A bit off topic: I already mentioned this, we can add unicode support to WB by simply adding 'anyunicode' to existing "anystring" syntax.


Will work on it after this release - some time is needed for testing and see the how things go - thanks for the all the starter tips, will surely use them - thanks!! :P

#18 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 20 January 2007 - 12:03 PM

Sorry, i don't understand, why the use of unicode instead of ANSI should degrade performance.
XP is a native unicode system and therefore the use of just a subset of unicode should not improve performance.


If we really want to talk performance, than i would suggest that we get rid of all the unnecessary io operations.

Take for example, 3 iniWrites to file xyz.ini.
It looks something like that:
- iniWrite1
- iniWrite2
- iniWrite3

But what really happens is:
- open file xyz.ini
- iniWrite1
- close file xyz.ini
- open file xyz.ini
- iniWrite2
- close file xyz.ini
- open file xyz.ini
- iniWrite3
- close file xyz.ini

If we add the FileOpen and FileClose commands and make the ???Writes really only write, it would look like that:
- open file xyz.ini
- iniWrite1
- iniWrite2
- iniWrite3
- close file xyz.ini

And as everone knows, io operations are the most time consuming part of any program.

:P

#19 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 22 January 2007 - 10:37 AM

Sorry, i don't understand, why the use of unicode instead of ANSI should degrade performance.
XP is a native unicode system and therefore the use of just a subset of unicode should not improve performance.

We will be working further on this, but it migth need some more time to complete this step - the more performance with stability - the better.. :P


If we really want to talk performance, than i would suggest that we get rid of all the unnecessary io operations.

Take for example, 3 iniWrites to file xyz.ini.
It looks something like that:
- iniWrite1
- iniWrite2
- iniWrite3

But what really happens is:
- open file xyz.ini
- iniWrite1
- close file xyz.ini
- open file xyz.ini
- iniWrite2
- close file xyz.ini
- open file xyz.ini
- iniWrite3
- close file xyz.ini

If we add the FileOpen and FileClose commands and make the ???Writes really only write, it would look like that:
- open file xyz.ini
- iniWrite1
- iniWrite2
- iniWrite3
- close file xyz.ini

And as everone knows, io operations are the most time consuming part of any program.

:P

You're a good coder - also planned to add some commands like this, but they weren't added to keep things simpler - can probably be added soon too - just a matter of working further on the script engine and see where we can optimize it.. :P

#20 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 22 January 2007 - 01:56 PM

I don't really think we should change WB in the suggested way, as i think ease of use is far more important than speed for a program like this. It's not like, one will use it a dozend times a day. :P

I only threw it in, to point out, that there is enormous time saving potential in WB that isn't used, to show how pointless the discussion about performance loss in regards to unicode is.

Anyway, Holger seems to have solved the problem. :P So no need to change WB.
But we may should make Holgers tool a default in the tools folder and explain it's use in the Wiki. ?
:P

#21 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 22 January 2007 - 02:52 PM

good idea! :P

#22 Rui Paz

Rui Paz

    Frequent Member

  • Advanced user
  • 201 posts
  •  
    Portugal

Posted 15 April 2010 - 04:14 PM

Hi,

Sorry for bumping this old thread but i'm having exactly the same problem and didn't find a solution for this using search.

Running Winbuilder 080 with LiveXP project and need to change the PENetwork.ini using IniWrite from my script, the file is on unicode and IniWrite is writing a new one.

Any fix inside winbuilder to deal with those unicode files?

Tanks.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users