Hi,
I have a remote camera that mail me a *.jpg file if anything moves in front of it. I want to configure thunderbirs in the way that it automatically loads the jpg-file and shows me the pic if I select the mail that it's within. Now I have to doubleclick on the attachment..
Thanks
Autoopening of attachments!
- DanRaisch
- Moderator
- Posts: 127187
- Joined: September 23rd, 2004, 8:57 pm
- Location: Somewhere on the right coast
Re: Autoopening of attachments!
Have you tried setting Thunderbird to display attachments inline? Menu path View->Display Attachments Inline.
- tanstaafl
- Moderator
- Posts: 49647
- Joined: July 30th, 2003, 5:06 pm
Re: Autoopening of attachments!
That will work but it is a security risk since it will automatically open any attachment, including spam. You might be able to use a message filter to automatically open and display any attachments using a "open file" action after testing that the message was sent from a specific email address (your remote camera). The FiltaQuilla add-on adds a "open file" action and a javascript action to message filters, among other things.
https://addons.mozilla.org/en-US/thunde ... la/?src=ss
https://addons.mozilla.org/en-US/thunde ... la/?src=ss
-
- Posts: 6403
- Joined: February 3rd, 2009, 6:29 pm
Re: Autoopening of attachments!
The FiltaQuilla Javascript Action stuff is pretty difficult.
Here is an old example of autoprinting the first attachment with LibreOffice. (not tested with current release)
Reference
https://dxr.mozilla.org/comm-release/se ... imeMessage
https://dxr.mozilla.org/comm-release/so ... mimemsg.js
https://dxr.mozilla.org/comm-release/so ... senger.idl
Starting the LibreOffice Software With Parameters
http://help.libreoffice.org/Common/Star ... Parameters
Here is an old example of autoprinting the first attachment with LibreOffice. (not tested with current release)
Code: Select all
/*Javascript Action*/
function urlListener(aPath) {
this.OnStartRunningUrl = function(aUrl) {}
this.OnStopRunningUrl = function(aUrl, aExitCode) {
if (Components.isSuccessCode(aExitCode)) {
var localFile = Components.classes["@mozilla.org/file/local;1"].
createInstance(Components.interfaces.nsILocalFile);
var process = Components.classes["@mozilla.org/process/util;1"].
createInstance(Components.interfaces.nsIProcess);
var args = ["-norestore", "-nofirststartwizard", "-nologo",
"-headless", "-p", aPath];
localFile.initWithPath("C:\\Program Files\\LibreOffice 3.5" +
"\\program\\soffice.exe");
process.init(localFile);
process.run(false, args, args.length);
}
}
}
for (var i = 0; i < msgHdrs.length; i++) {
var msgHdr = msgHdrs.queryElementAt(i, Components.interfaces.nsIMsgDBHdr);
MsgHdrToMimeMessage(msgHdr, null, function(aMsgHdr, aMimeMsg) {
if (aMimeMsg == null) return; // shouldn't happen, but sometimes does?
var msgURI = aMsgHdr.folder.generateMessageURI(aMsgHdr.messageKey);
var attachment = aMimeMsg.allAttachments[0];
var file = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
get("TmpD", Components.interfaces.nsIFile); // temporary folder
file.append(attachment.name);
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE,
parseInt("666", 8));
// 0666 read and write permission for owner, group, others
// example.txt example-1.txt example-2.txt example-3.txt et cetera
var messenger = Components.classes["@mozilla.org/messenger;1"].
createInstance(Components.interfaces.nsIMessenger);
messenger.saveAttachmentToFile(file, attachment.url, msgURI,
attachment.contentType, new urlListener(file.path));
}, false /*allowDownload*/);
}
https://dxr.mozilla.org/comm-release/se ... imeMessage
https://dxr.mozilla.org/comm-release/so ... mimemsg.js
https://dxr.mozilla.org/comm-release/so ... senger.idl
Starting the LibreOffice Software With Parameters
http://help.libreoffice.org/Common/Star ... Parameters