I wrote a task to read the 2nd line of every file in a folder and append the 2nd line to a different file. It needs to do this for every file in the folder. The problem is it only does it for the 1st two files. Please Help me fix the problem. Thanks!
Here is the task
;**********************
;* RoboTask Task file *
;* Do not edit! *
;**********************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1261164818
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task7"
Hide=INTEGER|0
ID=INTEGER|1166573864
Name=STRING|"(1) Combine New Member .csv files for import to Quickbooks"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
[Actions\Action1]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER
[Actions\Action1\Params]
createmode=STRING|"1"
date1=STRING|"20050731"
date2=STRING|"20050731"
destvar=STRING|"{NEWMEMBER}"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"C:\ICARE\New Members to Import to QuickBooks\*.csv"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"
[Actions\Action2]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER
[Actions\Action2\Params]
destvar=STRING|"{LINE}"
file=STRING|"{NEWMEMBER}"
linecount=STRING|"0"
sourcetext=STRING|"0"
[Actions\Action3]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER
[Actions\Action3\Params]
destvar=STRING|"{LINE}"
file=STRING|"{NEWMEMBER}"
linecount=STRING|"0"
sourcetext=STRING|"0"
[Actions\Action4]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action5]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action6]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file C:\ICARE\GOPD\Quickbooks Import\QB_IMPORT_FILE.csv"
Params=FOLDER
[Actions\Action6\Params]
fileexists=STRING|"1"
filname=STRING|"C:\ICARE\GOPD\Quickbooks Import\QB_IMPORT_FILE.csv"
line0=STRING|"{LINE}"
linecount=STRING|"1"
[Actions\Action7]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
Text files reading 2nd line
Text files reading 2nd line
Try this task (see below). If you want to process only 2-nd line in each file you must use some counter (in task there is Line_Num variable) and insert "If … then" action into text loop.
I've added "Minimize RoboTask" into beginning of the task, because loops work quickly, when RoboTask is minimized.
;**********************
;* RoboTask Task file *
;* Do not edit! *
;**********************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1614811947
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task290"
Hide=INTEGER|0
ID=INTEGER|1984238025
Name=STRING|"Combine New Member .csv files for import to Quickbooks"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER
[Actions\Action1]
ActionID=STRING|"A_ROBOTASK_MINIMIZE"
Enabled=INTEGER|-1
Name=STRING|"Minimize RoboTask"
[Actions\Action10]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action11]
ActionID=STRING|"A_ROBOTASK_RESTORE"
Enabled=INTEGER|0
Name=STRING|"Restore RoboTask"
[Actions\Action2]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER
[Actions\Action2\Params]
createmode=STRING|"1"
date1=STRING|"20050731"
date2=STRING|"20050731"
destvar=STRING|"{NEWMEMBER}"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"C:\ICARE\New Members to Import to QuickBooks\*.csv"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"
[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""LINE_NUM"" with value ""1"""
Params=FOLDER
[Actions\Action3\Params]
expand=STRING|"0"
varname=STRING|"LINE_NUM"
varvalue=STRING|"1"
[Actions\Action4]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER
[Actions\Action4\Params]
destvar=STRING|"{LINE}"
file=STRING|"{NEWMEMBER}"
line0=STRING|"{TextFile({newmember})}"
linecount=STRING|"1"
sourcetext=STRING|"0"
[Actions\Action5]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action5\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"1"
value1=STRING|"{Line_Num}"
value2=STRING|"2"
[Actions\Action6]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file C:\ICARE\GOPD\Quickbooks Import\QB_IMPORT_FILE.csv"
Params=FOLDER
[Actions\Action6\Params]
fileexists=STRING|"1"
filname=STRING|"C:\ICARE\GOPD\Quickbooks Import\QB_IMPORT_FILE.csv"
line0=STRING|"{LINE}"
linecount=STRING|"1"
[Actions\Action7]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action8]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""Line_Num"""
Params=FOLDER
[Actions\Action8\Params]
incement=STRING|"1"
vaiable=STRING|"Line_Num"
[Actions\Action9]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
I've added "Minimize RoboTask" into beginning of the task, because loops work quickly, when RoboTask is minimized.
;**********************
;* RoboTask Task file *
;* Do not edit! *
;**********************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1614811947
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task290"
Hide=INTEGER|0
ID=INTEGER|1984238025
Name=STRING|"Combine New Member .csv files for import to Quickbooks"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER
[Actions\Action1]
ActionID=STRING|"A_ROBOTASK_MINIMIZE"
Enabled=INTEGER|-1
Name=STRING|"Minimize RoboTask"
[Actions\Action10]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action11]
ActionID=STRING|"A_ROBOTASK_RESTORE"
Enabled=INTEGER|0
Name=STRING|"Restore RoboTask"
[Actions\Action2]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER
[Actions\Action2\Params]
createmode=STRING|"1"
date1=STRING|"20050731"
date2=STRING|"20050731"
destvar=STRING|"{NEWMEMBER}"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"C:\ICARE\New Members to Import to QuickBooks\*.csv"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"
[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""LINE_NUM"" with value ""1"""
Params=FOLDER
[Actions\Action3\Params]
expand=STRING|"0"
varname=STRING|"LINE_NUM"
varvalue=STRING|"1"
[Actions\Action4]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER
[Actions\Action4\Params]
destvar=STRING|"{LINE}"
file=STRING|"{NEWMEMBER}"
line0=STRING|"{TextFile({newmember})}"
linecount=STRING|"1"
sourcetext=STRING|"0"
[Actions\Action5]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action5\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"1"
value1=STRING|"{Line_Num}"
value2=STRING|"2"
[Actions\Action6]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file C:\ICARE\GOPD\Quickbooks Import\QB_IMPORT_FILE.csv"
Params=FOLDER
[Actions\Action6\Params]
fileexists=STRING|"1"
filname=STRING|"C:\ICARE\GOPD\Quickbooks Import\QB_IMPORT_FILE.csv"
line0=STRING|"{LINE}"
linecount=STRING|"1"
[Actions\Action7]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action8]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""Line_Num"""
Params=FOLDER
[Actions\Action8\Params]
incement=STRING|"1"
vaiable=STRING|"Line_Num"
[Actions\Action9]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"