[MacEd] Newbe and macro for thunderbird
Biju G C
bijumaillist at yahoo.com
Thu Dec 18 14:59:04 EST 2003
--- "Andrea M." <acme at email.it> wrote:
> That's I'm trying to do, but, for now, I can't hold the new editor
> "window", I also tried various "set focus" methods, but apparently there
> is a "timeout" problem. In effect I also noticed that the content
> windows already has the focus, the cursor is blinking in the correct
> place, but the macro doesn't work.
one correction, the mail editor is
\content\messenger\messengercompose\messengercompose.xul in mail.jar
it also overlay many files in \content\editor dir
I modified it to run after 3 second (3000 ms) delay.
As well as both (approve/reject) functionality in one macro.
checks the context (ie, the current window) in which macro
is running
//========= MsgApproveReject Macro ==============
var delaysec = -1;
var replyclick = false;
if(window.location== 'chrome://messenger/content/messenger.xul' ) //main window
{
delaysec = 3; //3 sec
replyclick = true;
}
if(window.location== 'chrome://messenger/content/messageWindow.xul' ) //msg open window
{
delaysec = 3; //3 sec
replyclick = true;
}
if(window.location== 'chrome://messenger/content/messengercompose/messengercompose.xul') //msg
edit window
{
delaysec = 0; //imediate
}
var MsgApproveReject = function(action )
{
var contentWin;
if(window.location== 'chrome://messenger/content/messengercompose/messengercompose.xul') //msg
edit window
{
contentWin = window;
} else {
contentWin=GetWindowMediator().getMostRecentWindow("msgcompose");
}
var contentFrame =contentWin.document.getElementById("content-frame");
var contentDoc = contentFrame.contentWindow._content.document;
var approve = /Command.*approve.*\d*/i;
var reject = /Command.*reject.*\d*/i;
action = action ? approve : reject;
var a = contentDoc.body.textContent ;
a=a.split('\n')
for (i = 0 ; i < a.length;i++)
{
if(a[i].search(action) != -1)
{
contentDoc.body.innerHTML=a[i]
break;
}
if (i > 20) break; //ignore if more than 20 lines
}
contentWin.focus();
}
if (delaysec > -1) //execute only on valid window
{
var action = confirm("[Yes] - approve\n[Cancel] - Reject")
replyclick && MsgReplyMessage(); //execute only if replyclick = true
if (delaysec) {
window.setTimeout(MsgApproveReject, 3 * delaysec, action );
} else {
MsgApproveReject(action);
}
}
//========= MsgApproveReject end ==============
________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping"
your friends today! Download Messenger Now
http://uk.messenger.yahoo.com/download/index.html
More information about the MacroEditor
mailing list