Page 1 of 1

UMM auto mass mail

Posted: Sun May 09, 2010 8:56 am
by rock5
I'm trying automate sending mass mail using Ultimate Mail Mod.

I've marked items to send and entered a recipient now I need to click send.
I'm pretty sure

Code: Select all

UMMFrameTab3Status.StartSending(UMMFrameTab3Status);
is called when clicking send but it doesn't work. I get an error AutoDisableTabs is a nil value. Any idea why?

Can anyone figure out if this is the correct command?

If not can you figure out what it is?

Re: UMM auto mass mail

Posted: Sun May 09, 2010 10:18 am
by Administrator
Probably a class? Try using ':' instead of '.' for that.

Re: UMM auto mass mail

Posted: Sun May 09, 2010 11:48 am
by rock5
Administrator wrote:Probably a class? Try using ':' instead of '.' for that.
Nah that's not it, but I did try it.

UMMFrameTab3Status.StartSending definately fires.

The send button has this in onclick

Code: Select all

this:GetParent():StartSending();
I'm pretty sure the butons name is "UMMFrameTab3StatusSend"

The start of the function looks like this

Code: Select all

this.StartSending = function(self)
It's inside another function

Code: Select all

function UMMMassSendItemsStatusTemplate_OnLoad(this)
This is called when UMMFrameTab3Status loads. so 'this' = 'UMMFrameTab3Status'

So;
this:GetParent():StartSending();
=
UMMFrameTab3StatusSend:GetParent():StartSending();

Didn't work. I've also tried
UMMFrameTab3Status:StartSending();
UMMFrameTab3Status.StartSending();


None of these caused errors. The following did.
UMMFrameTab3Status.StartSending(UMMFrameTab3Status);
UMMFrameTab3Status:StartSending(UMMFrameTab3Status);


And lots of other variations.

I'm not sure what effect a function being in another function has, is it possible that is a problem?

Re: UMM auto mass mail

Posted: Sun May 09, 2010 12:52 pm
by Administrator
this.StartSending = function(self)
You'll definitely need the ':', then. A function that accepts 'self' does so because ':' automatically inserts the 'self'. That is, this:

Code: Select all

object:func();
Is equivalent to:

Code: Select all

object.func(object);
I'm guessing you are just using the wrong frame. Check by doing something like this:

Code: Select all

if( this:GetParent() == UMMFrameTab3Status ) then
 -- correct
else
  -- incorrect
end

Re: UMM auto mass mail

Posted: Sun May 09, 2010 10:27 pm
by rock5
Administrator wrote:

Code: Select all

object:func();
Is equivalent to:

Code: Select all

object.func(object);
I knew "object" is taken to be the first argument of the function but I didn't know it also meant to prefix the function. That clarifies this a bit.

But I did try, as stated in my original post;

Code: Select all

UMMFrameTab3Status.StartSending(UMMFrameTab3Status);
which, if the object is correct, should have worked.
Administrator wrote:I'm guessing you are just using the wrong frame. Check by doing something like this:

Code: Select all

if( this:GetParent() == UMMFrameTab3Status ) then
 -- correct
else
  -- incorrect
end
I decided to display the objects name instead. I put this in the buttons onclick event;

Code: Select all

DEFAULT_CHAT_FRAME:AddMessage(this:GetParent():GetName())
It printed nothing when I clicked send.

Then I tried the following in the StartSending function

Code: Select all

if this:GetName() then DEFAULT_CHAT_FRAME:AddMessage("this = ".. this:GetName()) else
	DEFAULT_CHAT_FRAME:AddMessage("this = nil") end
if self:GetName() then DEFAULT_CHAT_FRAME:AddMessage("self = ".. self:GetName()) else
	DEFAULT_CHAT_FRAME:AddMessage("self = nil") end
Output was "self = UMMFrameTab3Status".

I think I understand that "this" has no value in the function but I can't understand how it could print nothing for "this".

Anyway, it looks like the frame is correct, right? So why doesn't it work?

Re: UMM auto mass mail

Posted: Sun May 09, 2010 11:22 pm
by Administrator
I'm not really sure. The whole addon structure is very confusing. I'm guessing that you are getting the wrong object because of inheritance. It does not error when calling it because all of the objects created are inheriting that function (although not using it).

I think it should be something like:

Code: Select all

UMMFrameTab3:StartSending();

Re: UMM auto mass mail

Posted: Mon May 10, 2010 2:31 am
by rock5
I've nailed it!

There was no doubt in my mind that StartSending() was being calling and that 'self' = 'UMMFrameTab3Status' because of the printed messages but I was confused that print statements from the send button onclick event weren't firing and no value was being printed for 'this'.

So, on a whim, I commented out the StartSending command and, what do you know, it still sent the mail. That's when I realized I had the wrong button. The only other place StartSending is called is in the Send function which is called by another send button. Then it was just a matter of backtracking the inheritences and viola! the correct function.

Code: Select all

UMMFrameTab3Action:Send()
And I was just about to give up too.

I may not be too good at coding but my deductive reasoning amazes even me sometimes. :D

Now to get back to work on my Uber waypoint scripts.

Thanks for your help.