Page 1 of 1

Modify amc.groovy email

Posted: 12 May 2016, 13:12
by beanz
Would you be able to tell me how to edit the amc.groovy code to alter the subject to include the processed file name instead of the pre-processed one?

I tried messing around with the line below, removing getReportTitle() and replacing it variations of { ':) ' + renameLog.to.name } but I can't figure out where the new file name is stored at this point in the code. Thanks for any help.

Code: Select all

title(getReportTitle())

Re: Modify amc.groovy email

Posted: 12 May 2016, 13:29
by rednoah
At this point the new filename is stored in the rename log / history. Full metadata may have been lost at that point, unless xattr metadata is enabled and working of course.

Re: Modify amc.groovy email

Posted: 12 May 2016, 13:41
by beanz
Thanks for getting back to me. I'm not sure if I explained myself too well. I edited line 545 which I think is the email subject. I tried to incorporate part of the code in the table in the body of the email below. I just want to be able to put exactly what is in the "New Name" cell into the subject line, but I am unsure of groovy syntax. Thanks again.

Code: Select all

hr(); table {
						tr { th('Original Name'); th('New Name'); th('New Location') }
						renameLog.each{ from, to ->
							tr { [from.name, to.name, to.parent].each{ cell -> td(cell) } }
						}

Re: Modify amc.groovy email

Posted: 12 May 2016, 13:56
by rednoah
This thread is somewhat related to this:
viewtopic.php?f=8&t=3755

Depending on what you want to do, it might be easier to use the --def exec option to hook your own shell script into the amc script, without modifying the amc script.

If you do decide to hack the amc script, then you won't get around learning some Groovy, and spending time debugging the existing code until you understand how it works.

As a wise man once said:
A wise Man wrote:5. YOU CANNOT DEBUG CODE BY STARING AT IT. First thing, put print statements
that display a log message with the variables leading up to the problem area
and use that to trace through the code to find your error. Keep executing it
and adding debugging to see what's going on.
@see https://gist.github.com/anonymous/b65ca ... 5da70eeced