Forum

Share

Please consider registering
guest

Log In RegisterMembers
Or log in with

Register | Lost password?
Advanced Search:

— Forum Scope —



— Match —



— Forum Options —




Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Action Delete file (via Javascript?)
February 1, 2011
4:31 pm
JajaGaboor
Guest

Hi,

Id like to be able to delete a file – or even folder – on reciept of an email, guess i can only achieve that with javascript, but using various stock bits of code about i cannot get it to work.

Is this feasable?

Im trying to get a template to reply with a freshly downloaded file as attachment, but cannot as it pulls the previous one from the local temp folder, hence why i want to delete it as part of the filter action.

Thanks.

Share
February 1, 2011
9:03 pm
Admin
Forum Posts: 323
Member Since:
July 12, 2008
Offline

I would think that deleting the file would be the easiest part of what you describe. So yes it is possible to delete a file with a filter action. The trickiest part I imagine would be communicating the file name to the action.

Share
February 2, 2011
2:13 am
JajaGaboor
Guest

Well the script i have used is this:

myActiveXObject = new ActiveXObject("Scripting.FileSystemObject");
file = myActiveXObject.GetFile("c:\\whateverfile.txt");
file.Delete();

Do you have any suggestions how to get this to work? Or do you mean maybe that sending the command outside of TB is the tricky bit?

No problem if its hassle, a batch could do the job no prob, i just thought javasript might be a more elegant way of achieving it.

 

Thank you

Share
February 2, 2011
9:14 am
Admin
Forum Posts: 323
Member Since:
July 12, 2008
Offline

I don't have any experience with the "ActiveXObject". Using Mozilla components, this script will delete a file in a javascript action:

 

let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
file.initWithPath("c:\\temp\\test-ml-7.eml");
if (file.exists()) file.remove(false);

 

rkent

Share
Forum Timezone: UTC -8

Most Users Ever Online: 18

Currently Online:
9 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

bobkatz: 8

BigMike: 8

t2m: 7

zabolyx: 7

taa: 6

onlyme: 6

Member Stats:

Guest Posters: 130

Members: 565

Moderators: 1

Admins: 1

Forum Stats:

Groups: 1

Forums: 7

Topics: 231

Posts: 802

Moderators: rkent (323)

Administrators: rkent (323)