You are not logged in.
Pages: 1
It's me again, sorry.
Just a question:
It seams i can't use environment-variables in Pascal script?
like
FileWriteContent('%Temp%\ReNamerCount.txt', IntToStr(I));
---------------------------
Error
---------------------------
Preview process has been terminated due to a critical error:Pascal Script Execute:
[Line 4] Exception: Cannot create file "D:\ReNamerBeta 12.11\Help\%temp%\ReNaCount.txt".
Das System kann den angegebenen Pfad nicht finden.---------------------------
OK
---------------------------
Is there something like
vTEMP := WideExpandEnvVar(%tmp%) ?
FileWriteContent( vTEMP + '\ReNamerCount.txt', IntToStr(I));
I just try to use this for FileCounter.pas:
var I: Integer;
begin
I := I + 1;
FileWriteContent('C:\ReNamerCounter.txt', IntToStr(I));
// later in an another script use ==> FileCount := FileReadLine('C:\ReNamerCounter.txt', 1);
end.
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
I think you'll be happy to know that I've added this new function
function WideGetEnvironmentVar(const VarName: WideString): WideString;
No need for the "%" signs, just use WideGetEnvironmentVar('TEMP').
TRY: ReNamerBeta.zip
Offline
Yes that helps, many thanks Denies :D
I have test this with some files only. Will test more over the weekend.
FilesCountWrite.pas
var
I: Integer;
vTEMP: WideString;
begin
I := I + 1;
If I < 2 Then
vTEMP := WideGetEnvironmentVar('TEMP');
FileWriteContent(vTEMP + '\ReNamerCounter.txt', IntToStr(I));
end.
FilesCountRead.pas
var
I: Integer;
vTEMP, vFileCount: WideString;
begin
I := I + 1;
If I < 2 Then
vTEMP := WideGetEnvironmentVar('TEMP');
vFileCount := FileReadLine(vTEMP + '\ReNamerCounter.txt', 1);
FileName := WideExtractBaseName(FileName) + ' (' + IntToStr(I) + ' of ' + vFileCount + ')' + WideExtractFileExt(FileName)
end.
How to use:
- add files
- load Pascal Rule FilesCountWrite.pas
- load Pascal Rule FilesCountRead.pas
- press Preview
- disable Pascal Rule FilesCountWrite.pas
- check New Names
If you change the amount of files (add or uncheck some) THEN
- enable Pascal Rule FilesCountWrite.pas
- (maybe press Preview)
- disable Pascal Rule FilesCountWrite.pas
Great tool Denis
greeds
Stefan
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
It's good too know that you are making a lot of use out this little function
Offline
Pages: 1