jhn9119
01-02-2004, 09:49 AM
hi guys
first off......happy new year to everyone :)
i've been playing with the ini file actions and what i'm lookin at is using an ini file to allow changes to an image (width, height, x pos, y pos & opacity) so say this is my ini section and values
[Sample Button 1]
Width = 300
Height = 50
X = 655
Y = 336
Opacity = 100
and this would be my code in the onpreload of the page to set the image stuff
-- get button information
strbutW = INIFile.GetValue(_SourceFolder .. "\\sample.ini", "Sample Button 1", "Width");
strbutH = INIFile.GetValue(_SourceFolder .. "\\sample.ini", "Sample Button 1", "Height");
strbutX = INIFile.GetValue(_SourceFolder .. "\\sample.ini", "Sample Button 1", "X");
strbutY = INIFile.GetValue(_SourceFolder .. "\\sample.ini", "Sample Button 1", "Y");
strbutO = INIFile.GetValue(_SourceFolder .. "\\sample.ini", "Sample Button 1", "Opacity");
-- set the values to the button
Image.SetSize("sample_but_1", strbutW, strbutH);
Image.SetPos("sample_but_1", strbutX, strbutY);
Image.SetOpacity("sample_but_1", strbutO);
Image.SetVisible("sample_but_1", true);
using that code works absolutly fine for what i want to achieve but if you had 10+ buttons on a page then the code would be quite long so i'm wondering if there is a better way to read the ini values for a specified section into a table
i see you can read all section names into a table but not the values within a section so would the way i've done it above be the best way to achieve this
one way i was thinking was to create the ini file sections like this
[Sample Button 1]
Setting1 = 300
Setting2 = 50
Setting3 = 655
Setting4 = 336
Setting5 = 100
and then use a loop to go through setting1-5 and add the values into a table but does anyone know a better way to script it
Thanks for any replies but dont post the code just your thoughts on possible ways, the best way to get used to it is coding it yourself :)
first off......happy new year to everyone :)
i've been playing with the ini file actions and what i'm lookin at is using an ini file to allow changes to an image (width, height, x pos, y pos & opacity) so say this is my ini section and values
[Sample Button 1]
Width = 300
Height = 50
X = 655
Y = 336
Opacity = 100
and this would be my code in the onpreload of the page to set the image stuff
-- get button information
strbutW = INIFile.GetValue(_SourceFolder .. "\\sample.ini", "Sample Button 1", "Width");
strbutH = INIFile.GetValue(_SourceFolder .. "\\sample.ini", "Sample Button 1", "Height");
strbutX = INIFile.GetValue(_SourceFolder .. "\\sample.ini", "Sample Button 1", "X");
strbutY = INIFile.GetValue(_SourceFolder .. "\\sample.ini", "Sample Button 1", "Y");
strbutO = INIFile.GetValue(_SourceFolder .. "\\sample.ini", "Sample Button 1", "Opacity");
-- set the values to the button
Image.SetSize("sample_but_1", strbutW, strbutH);
Image.SetPos("sample_but_1", strbutX, strbutY);
Image.SetOpacity("sample_but_1", strbutO);
Image.SetVisible("sample_but_1", true);
using that code works absolutly fine for what i want to achieve but if you had 10+ buttons on a page then the code would be quite long so i'm wondering if there is a better way to read the ini values for a specified section into a table
i see you can read all section names into a table but not the values within a section so would the way i've done it above be the best way to achieve this
one way i was thinking was to create the ini file sections like this
[Sample Button 1]
Setting1 = 300
Setting2 = 50
Setting3 = 655
Setting4 = 336
Setting5 = 100
and then use a loop to go through setting1-5 and add the values into a table but does anyone know a better way to script it
Thanks for any replies but dont post the code just your thoughts on possible ways, the best way to get used to it is coding it yourself :)