Email with var. OK task A butnot task B?

Discuss RoboTask here
Post Reply
deesloop
Posts: 70
Joined: Wed Feb 25, 2009 3:44 am

Email with var. OK task A butnot task B?

Post by deesloop »

I've made a task that look sfor 5 files in 5 folders
It then merges some PDFS generates alist of the files and emails it out then it moves the PDFs into some folders

Everything works except the email doesn't include the variable which is a list of filenames.

I created a standalone task and it works fine
I then cut & paste it into the task and the email is sent put the variableis missing?

Steps 10 - 14 are where the problems lies.
But they are identical to the standalone task which works fine :(


;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|0
Comment=STRINGLIST
ContinueOnError=INTEGER|1
Events=FOLDER
ExternalName=STRING|"Task4"
Hide=INTEGER|0
ID=INTEGER|1610418628
LocalVariables=STRING|"NUMFILES,INTPLANT,EXTPLANT,WAGES,SOUR CE,WEEKLY"
LogOnAsUser=INTEGER|1
Name=STRING|"Watch for 5 files"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action14=FOLDER
Action15=FOLDER
Action16=FOLDER
Action17=FOLDER
Action18=FOLDER
Action19=FOLDER
Action2=FOLDER
Action20=FOLDER
Action21=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"Check Wages"
Params=FOLDER

[Actions\Action1\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{FileExists(d:\costs\wages\wages.txt)}"
value2=STRING|"1"

[Actions\Action10]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"Looks for Merged PDFs"
Params=FOLDER

[Actions\Action10\Params]
createmode=STRING|"5"
date1=STRING|"20050921"
date2=STRING|"20050921"
destvar=STRING|"NOOFILES"
DuringDays=STRING|"28"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"d:\costs\record\*.pdf"
filecount=STRING|"1"
OlderDays=STRING|"28"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"1"

[Actions\Action11]
ActionID=STRING|"A_STR_EXTRACT"
Enabled=INTEGER|-1
Name=STRING|"Grab contract names"
Params=FOLDER

[Actions\Action11\Params]
amount=STRING|"4"
from=STRING|"12"
source=STRING|"{NOOFILES}"
variable=STRING|"noofiles"

[Actions\Action12]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Append list"
Params=FOLDER

[Actions\Action12\Params]
expand=STRING|"1"
varname=STRING|"ALLFILES"
varvalue=STRING|"<br> {ALLFILES} {noofiles}</br>"

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

[Actions\Action14]
ActionID=STRING|"A_INET_SENDMAIL"
Enabled=INTEGER|-1
Name=STRING|"Send Email with file list"
Params=FOLDER

[Actions\Action14\Params]
attachcount=STRING|"0"
auth=STRING|"0"
charset=STRING|"iso-8859-1"
from=STRING|"costs@rjmcleod.co.uk"
host=STRING|"172.16.64.3"
html=STRING|"1"
msg0=STRING|"<p>The following cost files have been merged and moved</p>"
msg1=STRING|"<p>Please check <a href=""file://///dingdc\costs\record"">these folders</a> for the files</p>"
msg2=STRING|"<p>Thank you</p>"
msg4=STRING|"{ALLFILES}"
msgcount=STRING|"5"
password=STRING|"2540125197259642494625963"
passwordmode=STRING|"0"
port=STRING|"25"
SSL=STRING|"0"
subject=STRING|"Costs Merged"
to=STRING|"deesloop@myemail.co.uk"

[Actions\Action15]
ActionID=STRING|"BASIC_SCRIPT"
Enabled=INTEGER|-1
Name=STRING|"Run Move to folders script"
Params=FOLDER

[Actions\Action15\Params]
line00000=STRING|"Sub Main"
line00001=STRING|"Dim objshell"
line00002=STRING|"Dim objFSO"
line00003=STRING|"Dim objResult"
line00004=STRING|"Dim objfile"
line00005=STRING|"Dim dayt"
line00006=STRING|"Dim strFolderPath"
line00007=STRING|"Set objshell = CreateObject(""WScript.Shell"")"
line00008=STRING|"Set objFSO = CreateObject(""Scripting.FileSystemObject"")"
line00009=STRING|"On Error Resume Next"
line00010=STRING|"Set objFSO = CreateObject(""Scripting.FileSystemObject"")"
line00011=STRING|"Set objFolder = objFSO.GetFolder(""d:\costs\record"")"
line00012=STRING|"For Each objfile In objFolder.Files"
line00013=STRING|"    contract = Mid(objfile.Name, 12, 4)"
line00014=STRING|"    folder = Mid(objfile.Name, 12, 2)"
line00015=STRING|"    strFolderPath = ""d:\costs\record\"" & folder & ""00-"" & folder & ""99\"""
line00016=STRING|"If Not objFSO.FolderExists(strFolderPath) Then"
line00017=STRING|"        Set objFolder2 = objFSO.CreateFolder(strFolderPath)"
line00018=STRING|"End If"
line00019=STRING|"    strFolderPath2 = ""d:\costs\record\"" & folder & ""00-"" & folder & ""99\"" & contract & ""\"""
line00020=STRING|"If Not objFSO.FolderExists(strFolderPath2) Then"
line00021=STRING|"        Set objFolder2 = objFSO.CreateFolder(strFolderPath2)"
line00022=STRING|"End If"
line00023=STRING|"objFSO.MoveFile objfile.Path, strFolderPath2"
line00024=STRING|"Next"
line00025=STRING|"Set objFSO = CreateObject(""Scripting.FileSystemObject"")"
line00026=STRING|"Set objfile = objFSO.CreateTextFile(""D:\Costs\Finished.txt"")"
line00027=STRING|"End Sub"
linecount=STRING|"28"
source=STRING|"0"

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

[Actions\Action16\Params]
Count=STRING|"7"
deletedirs=STRING|"0"
file0=STRING|"d:\costs\extplant\*.*"
file1=STRING|"d:\costs\intplant\*.*"
file2=STRING|"d:\costs\source\*.*f"
file3=STRING|"d:\costs\wages\*.*"
file4=STRING|"d:\costs\weekly\*.*"
file5=STRING|"d:\costs\splits\*.*f"
file6=STRING|"d:\costs\*.txt"
hidden=STRING|"1"
subdir=STRING|"0"
system=STRING|"1"
ToRecycleBin=STRING|"0"

[Actions\Action17]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action18]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action19]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action2]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"Check Costs"
Params=FOLDER

[Actions\Action2\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{FileExists(d:\costs\weekly\weekly.txt)}"
value2=STRING|"1"

[Actions\Action20]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action21]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action3]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"Check Source"
Params=FOLDER

[Actions\Action3\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{FileExists(d:\costs\source\source.txt)}"
value2=STRING|"1"

[Actions\Action4]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"Check Intplant"
Params=FOLDER

[Actions\Action4\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{FileExists(d:\costs\intplant\intplant.txt)}"
value2=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"Check Extplant"
Params=FOLDER

[Actions\Action5\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{FileExists(d:\costs\extplant\extplant.txt)}"
value2=STRING|"1"

[Actions\Action6]
ActionID=STRING|"BASIC_SCRIPT"
Enabled=INTEGER|-1
Name=STRING|"Run PDF Merge script"
Params=FOLDER

[Actions\Action6\Params]
line00000=STRING|"Sub Main"
line00001=STRING|"Dim objResult"
line00002=STRING|"Dim objfile"
line00003=STRING|"Dim dayt"
line00004=STRING|"Dim strFolderPath"
line00005=STRING|"Set objShell = CreateObject(""WScript.Shell"")"
line00006=STRING|"Set objFSO = CreateObject(""Scripting.FileSystemObject"")"
line00007=STRING|"Set oFolder=objFSO.getfolder(""d:\costs\splits"")"
line00008=STRING|"On Error Resume Next"
line00009=STRING|"For Each aFile In oFolder.Files"
line00010=STRING|"    If sNewest = """" Then"
line00011=STRING|"        Set fNewest = aFile"
line00012=STRING|"        sNewest = aFile.Name"
line00013=STRING|"    Else"
line00014=STRING|"        If fNewest.DateCreated < aFile.DateCreated Then"
line00015=STRING|"             Set fNewest = aFile"
line00016=STRING|"        End If"
line00017=STRING|"    End If"
line00018=STRING|"Next"
line00019=STRING|"dayt=(Left(fNewest.Name,10))"
line00020=STRING|"Set objfile = objFSO.CreateTextFile(""D:\Costs\started.txt"")"
line00021=STRING|"For lp = 1500 To 2500"
line00022=STRING|"objResult = objShell.Run(""c:\pdftk.exe d:\costs\splits\????-??-??_"" & lp & ""*.pdf cat output d:\costs\record\"" & dayt & ""_"" & lp & ""_costs.pdf"", 1, True)"
line00023=STRING|"Next"
line00024=STRING|"End Sub"
linecount=STRING|"25"
source=STRING|"0"

[Actions\Action7]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Wait 2 minutes"
Params=FOLDER

[Actions\Action7\Params]
delay=STRING|"1200"

[Actions\Action8]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""ALLFILES"" with value """""
Params=FOLDER

[Actions\Action8\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"ALLFILES"

[Actions\Action9]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""NOOFILES"" with value """""
Params=FOLDER

[Actions\Action9\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"NOOFILES"

[Events]
Event1=FOLDER

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

[Events\Event1\Params]
id=STRING|"A020OJP5"
interval=STRING|"30"
Oleg
Site Admin
Posts: 3105
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Email with var. OK task A butnot task B?

Post by Oleg »

It seems you want to get file list in HTML format like this:
<p>file1<br/>
file2<br/>
file3<br/>
file4<br/></p>

In this case write in step #12 this:
{ALLFILES}{noofiles}<br/>{eol}

in step #14 insert variable ALLFILES so:
<p>{ALLFILES}</p>
Last edited by Oleg on Thu Dec 13, 2012 2:25 pm, edited 1 time in total.
deesloop
Posts: 70
Joined: Wed Feb 25, 2009 3:44 am

Email with var. OK task A butnot task B?

Post by deesloop »

That sorted it.
I don't kow why it works in one task and not the other though.
I cut and pasted the 4 steps into my task and it doesnt work. But they work by themselves. How bizzarre!

Thanks yet again Oleg.
Post Reply