Collect different descriptions for one file - FAR2 problem

Here you can discuss any topic concerning Far macro commands.
Post Reply
farman
Posts: 118
Joined: Thu 03 Sep, 2009 11:32
Been thanked: 2 times

Collect different descriptions for one file - FAR2 problem

Post by farman »

This is a macro which i use to collect different descriptions/informations to one file in several indexed description files.
1. Macro tries to create a file using
'current filename' + '.01' + '.txt'
If file already exists macro increases the index '.01' to '.02' and further on, if necessary.
2. Then macro writes the content of the clipboard to the file and ends.
(Macro is executed via Hotkey)

Macro works great in FAR 1.75. In FAR 2.0.x it ignores the zero in '.01' and reduces this index to '.1'. Next index '.02' works fine. Do you have any idea what I have to change. Or is this buggy in FAR 2?

Code: Select all

%i=1; %si="01"; %ext=".txt";     

$WHILE(panel.fexist(0,fsplit(APanel.Current,4)+"."+%si+%ext) == 1) 
   %i=%i+1;
   $IF (%i < 10) %si="0"+%i; $ELSE %si=%i; $END        
   $IF (%i == 100) MsgBox("ERROR creating new Filename",  "\nToo many loops ("+%i+") in Macro while creating new name for\n\n\""+APanel.Current+"\"\n ", 1) $EXIT $END          
$End       

ShiftF4 $Text fsplit(APanel.Current,4) . $Text %si $Text %ext "" Enter ShiftF8 d ShiftIns Enter Enter CtrlHome Down ShiftF10
Edit: Corrected errors in Subject Title...
Last edited by farman on Tue 22 Sep, 2009 13:27, edited 1 time in total.
User avatar
John Doe
Бюрократ
Posts: 13801
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 72 times
Been thanked: 425 times
Contact:

Re: Collect different descriptions to on file - FAR2 problem

Post by John Doe »

It's bug. Report to mantis

Workaround: In first line use %si= "0"+%i; instead of %si="01"
https://t.me/FarManager — Telegram чат
farman
Posts: 118
Joined: Thu 03 Sep, 2009 11:32
Been thanked: 2 times

Re: Collect different descriptions for one file - FAR2 problem

Post by farman »

Thanx John Doe. Works fine now.
Post Reply

Return to “Macro Commands Discussions”