hiteksoftware.com Forum Index hiteksoftware.com
User discussion forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

need to send a list of filenames as email msg body

 
Post new topic   Reply to topic    hiteksoftware.com Forum Index -> Frequently Asked Questions
View previous topic :: View next topic  
Author Message
icitos



Joined: 18 Jun 2009
Posts: 15

PostPosted: Wed Sep 16, 2009 12:46 pm    Post subject: need to send a list of filenames as email msg body Reply with quote

we currently have automize 8.24 enterprise. and i'm trying to create a chain as follows:

1. monitor an folder for incoming files
2. encrypt files
3. ftp
4. email notification
5. archiving

i am having difficulty with step 4 where the objective is to be able to send an email notification that contains the list of encrypted filenames as part of the message body in the following format:
filename1.pgp
filename2.pgp

Been trying the attached script but still getting the filenames as file #filename1.pgp^#filename2.pgp.

script being tested:
import com.hitek.engine.mods.script.Script;

String var = Script.getVar("mytaskname::Filenames");
System.out.println("...::Filenames Variable value = " + var);
String newVar = "";
StringTokenizer st = new StringTokenizer(var, "#^");
while (st.hasMoreTokens())
{
String name = st.nextToken();
newVar = newVar + name + System.getProperty("line.separator");
}
Script.setVar("ParsedFilename", newVar);
String confirm = Script.getVar("ParsedFilename");
System.out.print("New variable set (ParsedFilename) = " + confirm);


Please help asap and Thanks
Back to top
View user's profile Send private message
Robert
Site Admin


Joined: 25 May 2006
Posts: 1140

PostPosted: Thu Sep 17, 2009 8:06 am    Post subject: Reply with quote

The StringTokenizer only uses 1 character as a token.
so try ^ as the token first.. then strip off the #.

also the variables are stored as single lines, so you cannot store a variable as:
filename1
filename2

Or, you could use filename1, filename2 ... etc.. instead
for this you could use the Replace function:

String newVar = var.replaceAll("#^", ", ");
newVar = newVar.replaceAll("#"," ");
Back to top
View user's profile Send private message
icitos



Joined: 18 Jun 2009
Posts: 15

PostPosted: Thu Sep 17, 2009 12:36 pm    Post subject: Reply with quote

not able to get this working. is there other option to get the filenames added to the email message body after FTP.

ie:
the following files are seccessfully transferred to ....:
filename.txt
filename.pgp
etc
Back to top
View user's profile Send private message
Robert
Site Admin


Joined: 25 May 2006
Posts: 1140

PostPosted: Fri Sep 18, 2009 12:46 pm    Post subject: Reply with quote

Your only other option would be:
Use the script to write the message body you need, to a text file . See the script examples on how string to write to text files.

Then in your email task, message body field use:
$$$c:\test\test.txt

where c:\test\test.txt is the message body you output from the script.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    hiteksoftware.com Forum Index -> Frequently Asked Questions All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group