Collect different descriptions for one file - FAR2 problem

Here you can discuss any topic concerning Far macro commands.
farman
Posts: 118
Joined: Thu 03 Sep, 2009 11:32

Collect different descriptions for one file - FAR2 problem

Postby farman » Tue 22 Sep, 2009 11:12

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: 11025
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 9 times
Been thanked: 61 times

Re: Collect different descriptions to on file - FAR2 problem

Postby John Doe » Tue 22 Sep, 2009 11:26

It's bug. Report to mantis

Workaround: In first line use %si= "0"+%i; instead of %si="01"

farman
Posts: 118
Joined: Thu 03 Sep, 2009 11:32

Re: Collect different descriptions for one file - FAR2 problem

Postby farman » Tue 22 Sep, 2009 13:40

Thanx John Doe. Works fine now.


Return to “Macro Commands Discussions”

Who is online

Users browsing this forum: No registered users and 1 guest