SRL Archive - Help and Support

File Saving Help?? (Again :p)


Timer

2008-01-17 22:14:21

its to do with the save…

procedure Settings(Way: string);
var SettingsFile: Integer;
SettingsString: string;
begin
if Way = 'load' then
begin
SettingsFile := OpenFile(AppPath + 'ScriptName\SDSettings.txt', False);
ReadFileString(SettingsFile, SettingsString, FileSize(SettingsFile));
SRLIDBox.Text := Between('-SRL ID Number: ', ' -SRLID-', SettingsString);
SRLPasswordBox.Text := Between('-SRL Password: ', ' -SRLPass-', SettingsString);
if Way = 'save' then
begin
SettingsFile := ReWriteFile(AppPath + 'SCriptName\SDSettings.txt', False);
WriteFileString(SettingsFile, '-SRL ID Number: ' + SRLIDBox.Text + ' -SRLID-');
WriteFileString(SettingsFile, '-SRL Password: ' + SRLPasswordBox.Text + ' -SRLPass-');
CloseFile(SettingsFile);
end;
end;

i get..
[PHP]//[Runtime Error] : Access violation at address 3AA22178. Read of address 3AA22178 in line 32 in script C:\Program Files\SCAR 3.13\Scripts\Script Name Form.scar[/PHP]

help? :p
thanks,
Timer150

Timer

2008-01-18 01:03:51

No One? Please?

Daniel

2008-01-18 03:23:50

I am not sure how to do that, but i asked a similar question in this thread and it got answered.

Miitchyy

2008-01-18 04:40:14

Do you get it the first time the procedure is called or the second?

I think this might help
procedure Settings(Way: string);
var SettingsFile: Integer;
SettingsString: string;
begin
if (Way <> 'load') and (Way <> 'save') then Exit;
try
if Way = 'load' then
begin
SettingsFile := OpenFile(AppPath + 'ScriptName\SDSettings.txt', False);
ReadFileString(SettingsFile, SettingsString, FileSize(SettingsFile));
SRLIDBox.Text := Between('-SRL ID Number: ', ' -SRLID-', SettingsString);
SRLPasswordBox.Text := Between('-SRL Password: ', ' -SRLPass-', SettingsString);
end;
if Way = 'save' then
begin
SettingsFile := ReWriteFile(AppPath + 'SCriptName\SDSettings.txt', False);
WriteFileString(SettingsFile, '-SRL ID Number: ' + SRLIDBox.Text + ' -SRLID-');
WriteFileString(SettingsFile, '-SRL Password: ' + SRLPasswordBox.Text + ' -SRLPass-');
end;
finally
CloseFile(SettingsFile);
end;
end;

Timer

2008-01-18 11:09:05

second time i called it, trying your procedure..

EDIT: TY TY TY SOOOO Veray much, well, maybe not. i figuded if u seave if once u hit save, and not when outta form, it works, plus i did it outaa form but it worked only once… in thiough try, and finnaly prevented any errors? lol :p