Author |
Message |
Dean Lo
Joined: 17 Aug 2009 Posts: 10 Country: Australia |
|
How to get a "true" file name from @v parameters |
|
Hi,
I tried to use @v"attachments" to save a file trigger from an email. I found that the attachment has been saved in a local temp folder and if that file already exist, it will rename the file automatically.
e.g. If 1 email comes in with test.txt, then it will save it and rename to test1.txt if a test.txt already exist in the temp directory.
I need to get the "true" file name but not to rename it? Any fix or command I can use? Thanks for your help!
Lo
|
|
Mon Nov 02, 2009 1:45 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
You can make the job to delete its files from the TEMP directory. This way, when the next email comes, it won't need to rename anything.
By the way, it is your email client program (Outlook?) that renames files, not 24x7, and there is nothing you can do in 24x7 to alter that behavior.
An alternative is to upgrade to 24x7 MP Edition, it can do virtually everything that 24x7 Windows Edition can do and a lot more, and it doesn't need an email client program for email processing. Email attachments are saved as they're named in the message, without renames.
|
|
Mon Nov 02, 2009 7:53 am |
|
 |
Dean Lo
Joined: 17 Aug 2009 Posts: 10 Country: Australia |
|
|
|
Hi,
Now I updated my version to 4.3 MP (trial) version. I set up the job to be email watch jobs. Here is the code:
DIM email, string, "@V"sender""
DIM subject, string, "@V"subject""
DIM attachments, string, "@V"attachments""
messagebox (email)
messagebox (attachments)
I set up SMTP, POP3 and the email address and account details. When the email comes in, the job starts but it is blank
messagebox (email) - blank??
I think Macro parameters are working with MP version. I don't have Outlook client installed this time. I tried setting the job as detached / non-detached. It doesn't work. Did I miss anything?
The code works fine if apply to 3.6.2 Windows version.
Thanks for your advise.
Lo
|
|
Wed Nov 18, 2009 11:35 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
The following should work:
In MP Edition, change job type from JAL to JavaScript, and in the code try
Scheduler.messageBox( "@V"sender"" );
|
|
Wed Nov 18, 2009 11:46 pm |
|
 |
Dean Lo
Joined: 17 Aug 2009 Posts: 10 Country: Australia |
|
|
|
Hi,
In the script type, I am using JAL - windows only.
If I changed to JAVA Script - Mutil Platform, I got error for all the syntax. So which script type I can use?
Thanks!
|
|
Wed Nov 18, 2009 11:54 pm |
|
 |
Dean Lo
Joined: 17 Aug 2009 Posts: 10 Country: Australia |
|
|
|
Hi,
I use Scheduler.messageBox( "@V"sender"" );
But when the job runs, it says
" An error occured when executing the automation script in line XX. Keyword not found"
|
|
Thu Nov 19, 2009 12:00 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
Sorry, I don't understand what you mean by "all the syntax" reference. There is only one line in my example. This example for Scheduler.messageBox( "@V"sender"" ); is provided as an example for a JavaScript job. It will not work if you choose JAL script engine to run it.
|
|
Thu Nov 19, 2009 12:14 am |
|
 |
Dean Lo
Joined: 17 Aug 2009 Posts: 10 Country: Australia |
|
|
|
I created a new job for email watch. When email arrives, run the following script:
Scheduler.messageBox( "@V"sender"" );
In the job log, it shows job start and job finish. No error and no messagebox as well???
|
|
Thu Nov 19, 2009 12:34 am |
|
 |
Dean Lo
Joined: 17 Aug 2009 Posts: 10 Country: Australia |
|
|
|
Sorry, If I set the job as non-detached, it shows the sender email address now. Thanks!
But what about my JAL -windows script?
Does that mean for MP version, I need to choose JAVA Script and change all my JAL into JAVA Script??
|
|
Thu Nov 19, 2009 12:42 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
No, you don't need to change them all, perhaps you only need to change 1 email-watch job.
There are some specifics related to treatment of various macro parameters. Please keep in mind that in MP Edition the email check is done by built-in POP3 client interface, while in Windows Edition it needs a standalone email client program controlled via Windows MAPI interface. The internal email mechanics (POP3 vs. MAPI) do affect how email related macro parameters are passed from the scheduling engine to scripts.
|
|
Thu Nov 19, 2009 12:54 am |
|
 |
Dean Lo
Joined: 17 Aug 2009 Posts: 10 Country: Australia |
|
|
|
So do you mean for all email watch jobs, need to choose JAVA Script code for MP version.
So If I using MP version, while setting up email watch jobs, can I watch email from different email address?
|
|
Thu Nov 19, 2009 1:07 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
While it is possible to create multiple email watch jobs, I don't think they will work as you think they will. The determination for sender is done in your job script. Once an email message is grabbed by a job, other jobs won't grab the same email again. So, if a job finds that the email sender is not good for that job, other jobs won't process it too.
I suggest in your case not to create multiple email-watch jobs. Instead, create a single job that will have some if/case logic and dispatch other jobs depending on the sender's address.
|
|
Thu Nov 19, 2009 1:15 am |
|
 |
|