#1 2010-05-23 00:30

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Script: store and reuse var

SafetyCar wrote:

Is there any way to assign variables on a pascal rule and read it from other pascal rule???

1) First Script to Store one var:

begin 
   FileWriteContent('C:\Temp\var.txt', 'string or digit to store'); 
end.

2) Second Script to Read one var:

var 
   variable: string; 
begin 
   variable := FileReadContent('C:\Temp\var.txt'); 
   showmessage('Stored var content: ' + variable); 
end.


Or store an whole list of information, one per line:

First Script to Store many vars:

begin
   FileAppendContent('C:\Temp\myVars.txt', FileName + #13#10);
end.

Second Script to Read one var of many:

    variable := FileReadLine('C:\Temp\myVars.txt', 3);

var
 variable: string;
 index: integer;
 
begin
if (index < 1) then index := 1;
   variable := FileReadLine('C:\Temp\myVars.txt', index);
   showmessage('Stored var content of index( ' + IntToStr(index) + '):  ' + variable);
   index := index + 1;
end.

Last edited by Stefan (2010-05-23 00:30)


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#2 2010-05-23 00:46

SafetyCar
Senior Member
Registered: 2008-04-28
Posts: 446
Website

Re: Script: store and reuse var

I was thinking on something easier, but thanks for this solution.


If this software has helped you, consider getting your pro version. :)

Offline

Board footer

Powered by FluxBB