Pages: 1
RSS
Pulling items from a file consecutively?, How can I achieve this?
 
I need to be able to pull items/lines from a file consecutively.

This works, but it pulls items RANDOMLY... I need to start from the top... I hope this is possible.

%COOKIE="C:\Documents and Settings\Administrator\Desktop\items.txt"

Thanks in advance!
 
or if someone could provide me with another solution to accomplish this task, that would be great.
 
Off hand I can't think of any way to do what you want, the cookie  macro is designed to do its work randomly. And I don't know any third plug-in that offers the functionality you're looking for.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
With xmp http://www.gaijin.at/tbpxmp.php everything is possible!

This is quick template called 'cons'

Code
%_file=%_1%-
%IF:'%XMP_FileExist(%_file)'='0':'Bad filename':'%-
%_linenumber=%XMP_IniGet(`e:\Internet\The Bat!\XMP\my.ini`, `cons`,%-
`%_file`,1)%-
%_maxline(%XMP_FileLnCnt(%_file))%-
%XMP_FileLines(%_file, %_linenumber, 1)%-
%_linenumber(%CALC=`%_linenumber+1`)%-
%IFN:`%_linenumber`>`%_maxline`:`%_linenumber(1)`%-
%XMP_IniSet(`e:\Internet\The Bat!\XMP\my.ini`, `cons`,%-
`%_file`, %_linenumber)%-
'%-


In line with %XMP_IniSet you must put your own path to ini file (macro create this file if doesn't exist).

To execute this quick template add in some template
Code
%QINCLUDE(cons, 'e:\test.txt')%-
%QINCLUDE(cons, 'C:\Documents and Settings\Administrator\Desktop\items.txt')%-
 
Quote
In line with %XMP_IniSet
...and in line with macro %XMP_IniGet too, of course.
 
Hm, I created the quick template but it doesn't seem to be working. Any advice?
 
Quote
Hm, I created the quick template but it doesn't seem to be working. Any advice?

Did You installed xmp plugin? Any error results after runnig a template?

Try this slighty improved version:
Code
%_ini='e:\Internet\The Bat!\XMP\my.ini'%-
%_file=%_1%-
%IF:'%XMP_FileExist(%_file)'='0':'Bad filename':'%-
%_linenumber=%XMP_IniGet(%_ini, cons, %_file, 0)%-
%_maxline(%XMP_FileLnCnt(%_file))%-
%IFN:`%_linenumber`>=`%_maxline`:`%_linenumber(0)`%-
%_linenumber(%CALC=`%_linenumber+1`)%-
%XMP_FileLines(%_file, %_linenumber, 1)%-
%XMP_IniSet(%_ini, cons, %_file, %_linenumber)%-
'%-

You must to correct a path in the first line (to place where You want to hold an ini file).

To execute this template You must use macro %QINCLUDE with two parameters: template name and path to file.
 
Maybe I installed it correctly? Where should I place the XMP files? I dont see a plugins folder within Program Files/The Bat
 
Quote
thud wrote:
Where should I place the XMP files? I dont see a plugins folder within Program Files/The Bat
Anywhere, but remember to add a plugin (xmp.tbp file) in Options/Preferences - Plug-Ins.
 
Got it
Pages: 1