Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Modify the string table entry through script.


5 replies to this topic

Neha

Neha
  • Members
  • 7 posts

Posted 28 March 2003 - 11:47

Hi,

I want to modify the string table entry called MY_STRING in my script. This string has to be updated according the option that user has selected for installation.
How can i do this?

Regards
Neha

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 28 March 2003 - 15:55

I think the string table is considered read only at install time, but you could try simply assigning back to it.

I assume you know that to access an entry you simply precede the the string identifier with an at sign (@).

So for like MY_STRING , you would do:

Code Sample
@MY_STRING  = "Test";


If this does NOT work, then you'll probably need to settle for using a global string variable which you (re)populate as deemed necessary.


user posted image

Neha

Neha
  • Members
  • 7 posts

Posted 29 March 2003 - 07:45

@MY_STRING  = "Test";
This statement doesn't complile. It gives error .

Regards
Neha

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 29 March 2003 - 20:47

Oh yeah, that's right.  Now that I think about it, I've also wanted to do that before, but the compiler does indeed treat the string table as read only.
user posted image

runningquicklynowher

runningquicklynowher
  • Members
  • 20 posts

Posted 07 April 2003 - 16:54

If you really want to use the string table you could set multiple strings in the string table and use a case statement or group of if statements to assign it depending on your users choice.

For example if you had three possible choices available to your user you could have in the string table
MY_STRING1 = xxx
MY_STRING2 = yyy
MY_STRING3 = zzz

From there in the code you get your user selection and have something like this:

if ( UserSelection = 1 ) then
   //process with @MY_STRING1
else if ( UserSelection = 2 ) then
   //process with @MY_STRING2
else if ( UserSelection = 3 ) then
   //process with @MY_STRING3
endif;

That would work if your MY_STRING data is fairly static and only changes the one time and doesn't get built upon as the install progresses.  If you need to continually modify the value of MY_STRING by appending things to it based on multiple selection then you will need to have a String variable in your code that you use to store the current value of your assembled String Table values and you will need multiple String Table values representing each possibility.
Using the same three MY_STRING string table entries above the code would differ like this:

//Define String variable at begining of function
STRING sTemp

//code sample
if ( UserSelection = 1 ) then
   sTemp = @MY_STRING1;
else if ( UserSelection = 2 ) then
   sTemp = @MY_STRING2;
endif;
if ( UserSelection2 = 1 ) then
   sTemp = sTemp + @MY_STRING3;
endif;

Hope this helps.

Xitch13

Xitch13
  • Members
  • 134 posts

Posted 07 April 2003 - 18:06

Could you let us know why you want to use a String Table constant instead of a global String variable?

If I knew more about what you're trying to do, I could probably make a better suggestion.
There is great chaos under heaven, and the situation is excellent. (Mao Tse Tung)