help appending code to this working script

Hello.

So I have this script here

Now what I want to do is If that message is infected with a virus, I want it to change to subject.

Now the only way I found to do this is

take the email in question
open it in text editor
find the subject line and modify it to whatever you choose… in my case I choose INFECTED then rest of subject
For me the subject line was Subject: [VirusTotal] Server notification
so i modified the subject like this
Subject: INFECTED [VirusTotal] Server notification
Save the file

When I open the file, the subject is changed :slight_smile: :slight_smile:

So my question is how would it automate this task with appending code to this above script?

EDITED: not sure if this will help but I’m seeing something like
open thisMessage in textedit
get line that contains Subject: [VirusTotal] Server notification (Subject: whatever it maybe)
Add line INFECTED just before subjects begins. but after Subject:
Save file