Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently November 14th, 2024, 11:04 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: how to use GetINISectionData()
PostPosted: April 10th, 2007, 10:29 am 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
I found this function in the script reference and I put .ini file ,but i don't know how to use it.
I want how to write data to ini file and how to retrieve them.


For this message opuslover has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 10th, 2007, 11:23 am 
Did you see GetINISectionData() in OpusScript Help? I thought the explanation and the examples were self-explanatory. This seems to limit the action to retrieving info from an INI file.

My limited understanding is that the GetINI... functions extract data from existing INI files, or from INI files that you have written outside Opus -- but i'm no expert :oops: However, the only way I can see to write data to an INI file, is to use a combination of OpenFile() and Write().

Perhaps if you explain exactly what you want to do, some one might be able to help you.


Top
   
 
 Post subject:
PostPosted: April 10th, 2007, 1:31 pm 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
Thanks santosa for your reply.I'm doing like a quiz .I want to write the questions to ini file as example
[Q1]
type=trueFalse
question="whatever"
answer=Yes
[Q2]
........ etc
I know how to write,however , i want how to display for example what the question in [q1]

I hope this is clear


For this message opuslover has been thanked by : mackavi


Top
 Profile  
 
 Post subject: split string
PostPosted: April 10th, 2007, 1:48 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi OP,

If I u/d you correctly, you can already read the section data from an INI (this is explained in the script help) but need each line from the INI section?

Because the GETINI will read everything in the section into a single string, you need to use the SPLIT command to separate this into an array. Only problem is that this needs and end-of-line identifier and as of yet, I can't find a way of getting it to recognize 'return' character.

My work around has been to end each line in the INI file with a semi-colon and use this in the SPLIT command.

Mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 10th, 2007, 2:17 pm 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
Thanks mac for your reply.I hope that you find a solution for me.
In C++ it's like this (maybe this help mac)


To create and manage the sections that make up an INI file, the TIniFile provides a series of methods such as ReadSection() and ReadSections(). To create and manage the strings of an INI file, you use the methods of the parent class TCustomIniFile. When creating the strings, you use Read() methods.

Here is an example:

//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
TIniFile *StartUp = new TIniFile("IValues.ini");

Left = StartUp->ReadInteger("FormPos", "Left", 250);
Top = StartUp->ReadInteger("FormPos", "Top", 200);

delete StartUp;
}
//---------------------------------------------------------------------------

To retrieve the values of the strings, you use Write() methods. Here is an example:

//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
TIniFile *StartUp = new TIniFile("IValues.ini");

StartUp->WriteInteger("FormPos", "Left", Left);
StartUp->WriteInteger("FormPos", "Top", Top);

delete StartUp;
}
//---------------------------------------------------------------------------

In opus we want to know the way.


For this message opuslover has been thanked by : mackavi


Top
 Profile  
 
 Post subject: brain strain.
PostPosted: April 10th, 2007, 2:50 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
OP you've inspired me;

the line you need is

myData = sectionData.split(String.fromCharCode(10))

Explained:

myData is a publication array
sectionData is the section read in from the INI file
split is the command to 'cut' a string into sections

fromCharCode - DOES NOT APPEAR in the help manual BUT is a javascript command to insert an ascii character from its code.

The number 10 is the ascii code for a new line feed (sorry thought it would have been a CR).

Can't say I know much about C, last thing I programmed in was PL/SQL for Oracle :-)))

Hope it helps,

Mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 10th, 2007, 3:02 pm 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
Excellent mac it works , but it retrieve the whole line
[Q1]
type=trueFalse

it retrieve (type=trueFalse) and I neede only the value(trueFalse)


For this message opuslover has been thanked by : mackavi


Top
 Profile  
 
 Post subject: data organisation
PostPosted: April 10th, 2007, 4:18 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Not sure how you need to store your data, but can you simply save it with out the type= part?


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 10th, 2007, 4:28 pm 
Offline

Joined: October 26th, 2004, 10:23 am
Posts: 666
Location: Digital Workshop
Opus 6 adds a SetINIFileData() function to allow INI files to be written as well as read.

_________________
ddww Opus Developer


For this message Duncan Lilly has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: :-)
PostPosted: April 10th, 2007, 4:53 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
But we 5.5 people can only dream :-)


Top
 Profile Visit website  
 
 Post subject: Re: :-)
PostPosted: April 10th, 2007, 5:25 pm 
Offline

Joined: October 26th, 2004, 10:23 am
Posts: 666
Location: Digital Workshop
mackavi wrote:
But we 5.5 people can only dream :-)

Or upgrade! :D

_________________
ddww Opus Developer


For this message Duncan Lilly has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: ????
PostPosted: April 10th, 2007, 5:48 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Didn't think Opus Pro 6 was available....?


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 10th, 2007, 6:04 pm 
Offline

Joined: October 26th, 2004, 10:23 am
Posts: 666
Location: Digital Workshop
Ummm... I only write it, not sell it! I think it will be available as an upgrade and to purchase from the site very soon - it is currently available to Evolution customers.

_________________
ddww Opus Developer


For this message Duncan Lilly has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 10th, 2007, 7:11 pm 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
Thanks all for your sharing.We really need the new version of opus .But now can't we do something with this ini file?


For this message opuslover has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 10th, 2007, 8:09 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
What do we need to do with the INI file?


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group