text manipulation issue

Discuss RoboTask here
Post Reply
jeffthebat
Posts: 3
Joined: Thu Apr 05, 2007 9:20 am

text manipulation issue

Post by jeffthebat »

I am using robotask 2.51 and monitoring log files that are automatically added to a directory.
My goal is to have the files contents emailed to several people.
I have the file monitor creating a text file called loglist.txt
I am then taking that files contents and making it a variable {loglist}placing it into the "Put Text" "External Text File" input field as the lookup for the correct file name.
The problem I am having is with the data won't read into the variable, I belive this is because of the <CR><LF> added to the end of the text in the file monitor save changes function.
I have attached the task data, any help or suggestions is appreciated.
Error: Error occured: Cannot open file "C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\backup06.log<CR><LF>". The filename, directory name, or volume label syntax is incorrect
task:
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|0
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"logmonitor"
Hide=INTEGER|0
ID=INTEGER|813242743
Name=STRING|"logmonitor"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
[Actions\Action1]
ActionID=STRING|"A_CLIPBOARD_PUT"
Enabled=INTEGER|-1
Name=STRING|"Put Text"
Params=FOLDER
[Actions\Action1\Params]
file=STRING|"G:\OBBackups\batchfiles\loglist.txt"
linecount=STRING|"0"
sourcetext=STRING|"0"
[Actions\Action2]
ActionID=STRING|"A_CLIPBOARD_GET"
Enabled=INTEGER|-1
Name=STRING|"Get Text"
Params=FOLDER
[Actions\Action2\Params]
variable=STRING|"loglist"
[Actions\Action3]
ActionID=STRING|"A_CLIPBOARD_PUT"
Enabled=INTEGER|-1
Name=STRING|"Put Text"
Params=FOLDER
[Actions\Action3\Params]
file=STRING|"{loglist}"
linecount=STRING|"0"
sourcetext=STRING|"0"
[Actions\Action4]
ActionID=STRING|"A_CLIPBOARD_GET"
Enabled=INTEGER|-1
Name=STRING|"Get Text"
Params=FOLDER
[Actions\Action4\Params]
variable=STRING|"logfiledata"
[Actions\Action5]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file G:\OBBackups\batchfiles\test.txt"
Params=FOLDER
[Actions\Action5\Params]
fileexists=STRING|"0"
filname=STRING|"G:\OBBackups\batchfiles\test.txt"
line0=STRING|"{logfiledata}"
linecount=STRING|"1"
[Events]
Event1=FOLDER
[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_FILE_MONITOR"
Params=FOLDER
[Events\Event1\Params]
chg=STRING|"0"
chga=STRING|"1"
chgsl=STRING|"1"
chgsm=STRING|"1"
chgtl=STRING|"1"
chgtm=STRING|"1"
del=STRING|"0"
folder1=STRING|"C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data"
foldercount=STRING|"1"
id=STRING|"KAHVX9TTP"
incmask=STRING|"backup*.log"
interval=STRING|"60"
listmode=STRING|"1"
mon_files=STRING|"1"
mon_folders=STRING|"0"
new=STRING|"1"
onelist=STRING|"G:\OBBackups\batchfiles\loglist.txt"
saveresults=STRING|"1"
subfolders1=STRING|"0"
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

text manipulation issue

Post by Oleg »

File monitor event creates the LIST of files, i.e. after each file name event puts end-of-line symbols. If a few log files will appear in your folder your task can't work at all. Any list you have to process in some loop (File loop, text loop, etc)
See my task below. This task creates a few texts "testN.txt" where N - sequence number. Also you don't need to use clipboard in this task. There is {TextFile(SomeFileName)} system variable for retrieving content of text file.
If you have some questions feel free to ask me again.

;**********************
;* RoboTask Task file *
;* Do not edit!       *
;**********************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1128993393
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task214"
Hide=INTEGER|0
ID=INTEGER|853532536
Name=STRING|"logmonitor (My edition)"
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

[Actions\Action1]
ActionID=STRING|"A_FILE_DELETE"
Enabled=INTEGER|-1
Name=STRING|"Delete File"
Params=FOLDER

[Actions\Action1\Params]
Count=STRING|"1"
deletedirs=STRING|"0"
file0=STRING|"G:\OBBackups\batchfiles\test*.txt"
subdir=STRING|"0"
ToRecycleBin=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NUMFILE"" with value ""1"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"NUMFILE"
varvalue=STRING|"1"

[Actions\Action3]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER

[Actions\Action3\Params]
destvar=STRING|"CURRENT_LOG_FILE"
file=STRING|"G:\OBBackups\batchfiles\loglist.txt"
linecount=STRING|"0"
sourcetext=STRING|"0"

[Actions\Action4]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file G:\OBBackups\batchfiles\test{numfile}.txt"
Params=FOLDER

[Actions\Action4\Params]
fileexists=STRING|"0"
filname=STRING|"G:\OBBackups\batchfiles\test{numfile}.txt"
line0=STRING|"{TextFile({CURRENT_LOG_FILE})}"
linecount=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""numfile"""
Params=FOLDER

[Actions\Action5\Params]
incement=STRING|"1"
vaiable=STRING|"numfile"

[Actions\Action6]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_FILE_MONITOR"
Params=FOLDER

[Events\Event1\Params]
chg=STRING|"0"
chga=STRING|"1"
chgsl=STRING|"1"
chgsm=STRING|"1"
chgtl=STRING|"1"
chgtm=STRING|"1"
del=STRING|"0"
folder1=STRING|"C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data"
foldercount=STRING|"1"
id=STRING|"HX91IHLJG"
incmask=STRING|"backup*.log"
interval=STRING|"60"
listmode=STRING|"1"
mon_files=STRING|"1"
mon_folders=STRING|"0"
new=STRING|"1"
onelist=STRING|"G:\OBBackups\batchfiles\loglist.txt"
saveresults=STRING|"1"
subfolders1=STRING|"0"
Post Reply