SecurityAgent interrupts script

I have a script that purges files from certain network and local folders. It has worked flawlessly up until either an update or a tech person messed with something. Now SecurityAgent asks for a password when the script tries to move the files to the trash. I have tried to UI script entering my password and cancelling the dialog using UI scripting. The code for cancelling the dialog and for entering my password works when I run it in a separate script when the SecurityAgent dialog is up, but SA won’t do anything when I invoke the code in the main script, and I can’t seem to activate one script from another. I can manually cancel SA’s dialog without putting my password in and it performs all of the functions that the script is supposed to, but that means that I have to be there to click cancel, which defeats the purpose. Can I deactivate SecurityAgent? It doesn’t appear to be of any practical use except to irritate me. Or perhaps someone knows something about SecurityAgent that I’m missing which will allow me to get the job done despite it? Please help. This “Agent Smith” needs it’s ass kicked!


tell application "Finder"
	activate
	set deleteMerlinItems to (items of folder "NEWSROOMS$:Merlin:" whose modification date < (current date) - 7 * days)
	set deleteTonedItems to (items of folder "Storage:7 day toned archive:" whose modification date < (current date) - 7 * days)
	set archiveResend to items of folder "Resend" of desktop
	duplicate archiveResend to folder "Storage:7 day toned archive:" with replacing
	set deleteAll to {archiveResend, deleteMerlinItems, deleteTonedItems}
	delete deleteAll
	empty trash
	display dialog "Resend folder archived and Merlin and archive folders cleared." giving up after 10
end tell