View Full Version : save statement for next use
GoOgLe
04-21-2008, 11:40 AM
how can i save color code for next use ?
APZ file :
DOWNLOAD (http://www.indigorose.com/forums/attachment.php?attachmentid=6134&d=1206637251)
reteset
04-21-2008, 12:15 PM
Global Functions:
LastColor = 0;
Slider_Btn_R On Click:
local nR = e_Pos;
local nG = SliderEx.GetSliderPos("Slider_G");
local nB = SliderEx.GetSliderPos("Slider_B");
local nColor = Math.RGBToNumber(nR, nG, nB);
LastColor = nColor;
Shape.SetFillColor("Shape1", nColor);
Slider_Btn_G On Click:
local nR = SliderEx.GetSliderPos("Slider_R");
local nG = e_Pos;
local nB = SliderEx.GetSliderPos("Slider_B");
local nColor = Math.RGBToNumber(nR, nG, nB);
LastColor = nColor;
Shape.SetFillColor("Shape1", nColor);
Slider_Btn_B On Click:
local nR = SliderEx.GetSliderPos("Slider_R");
local nG = SliderEx.GetSliderPos("Slider_G");
local nB = e_Pos;
local nColor = Math.RGBToNumber(nR, nG, nB);
LastColor = nColor;
Shape.SetFillColor("Shape1", nColor);
Page >> On Close:
TextFile.WriteFromString("C:\\bgcolor.txt", LastColor , false);
GoOgLe
04-21-2008, 12:31 PM
thanks alot Reteset
but i cant load the same color next use
GoOgLe
04-21-2008, 12:47 PM
i put this on preload but it didnt work !!!
result = TextFile.ReadToString("C:\\bgcolor.txt");
Shape.SetFillColor("Shape1", result);
ShadowUK
04-21-2008, 01:15 PM
i put this on preload but it didnt work !!!
result = TextFile.ReadToString("C:\\bgcolor.txt");
Shape.SetFillColor("Shape1", result);
but it didnt work !!!
I'm getting really tired and annoyed at this.
Anyway, you can't set it from a string. Use String.ToNumber then SetFillColor.
RizlaUK
04-21-2008, 01:21 PM
GOOGLE, open AMS, goto the main menu, click about>>help, look for the actions section, then look for INIFile.....all the information you need is there
ButtonMaker
04-21-2008, 01:21 PM
try this GoOgLe
result = TextFile.ReadToString("C:\\bgcolor.txt");
color = String.ToNumber(result);
Shape.SetFillColor("Shape1", color);
RizlaUK
04-21-2008, 02:35 PM
storeing 1 line of text in a file like that is a waist, what if you need to save more settings....more files..?..
use a ini file to store app settings
result = INIFile.GetValue(_WindowsFolder.."\\My Settings.ini", "My Section", "bgcolor");
color = String.ToNumber(result);
Shape.SetFillColor("Shape1", color);
GoOgLe
04-21-2008, 02:55 PM
what am i doing wrong ?
On Show:
result = INIFile.GetValue(_WindowsFolder.."\\My Settings.ini", LastColor);
color = String.ToNumber(result);
Shape.SetFillColor("Shape1", color);
On Close:
INIFile.SetValue(_WindowsFolder.."\\My Settings.ini", LastColor);
RizlaUK
04-21-2008, 03:38 PM
dont use a variable for the page show bit, it needs the actual name of the ini value, also you dont have enough arguments
i take it you are storeing the color in the variable "LastColor"
try this
-- on show
result = INIFile.GetValue(_WindowsFolder.."\\My Settings.ini", "LastColor");
color = String.ToNumber(result);
Shape.SetFillColor("Shape1", color);
-- on close
INIFile.SetValue(_WindowsFolder.."\\My Settings.ini", "LastColor",LastColor);
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.