Call a Mail rule from Applescript

I have written a script (with a lot of help) to save selected messages and attachments as PDF’s in a folder I select. The last part of my script asks if I want to delete the original mail message and I have found that I do not always want to. So I am looking for a way to flag the message or color the preview line. Any ideas greatly appreciated.
This is my script.

--This script is underdevelopment 5/24/2011 to take a selected email message save it as a PDF file and then save any attachments to the same folder with the file name given to the email plus name of attachment
global listOfFiles, filecount, Subject_, destinationFolder, d
activate application "Finder"
tell application "Finder"
	set destinationFolder to (choose folder)
	set listOfFiles to the name of every file in destinationFolder
	set filecount to count every item in listOfFiles
end tell

activate application "Mail" --Brings window to the front

tell application "Mail"
	set theMsg to selection
	set theMsg to item 1 of theMsg
	set theMsgCount to {}
	
	tell theMsg
		set Subject_ to subject of item 1 of theMsg
		set Sender_ to sender of item 1 of theMsg
		set Recipients_ to to recipients
		set Recipients_ to address of first recipient of item 1 of theMsg
		set Sender_ to extract name from Sender_
		set brkpos to offset of "@" in Recipients_ --Finds position of start of URL in email address
		--display dialog "Break " & brkpos
		set Recipients_ to characters 1 through (brkpos - 1) of Recipients_
		display dialog "Sent to " & Recipients_ & return & "Sent by " & Sender_
		
		set theMsgCount to mail attachments of theMsg
		
		set theMsgCount to count every mail attachment of theMsg
		
		set Subject_ to text returned of (display dialog "From " & Sender_ & return & "Proposed file name is in the box" & return & "Select OK or  start typing to erase and change" & return & "and then Select OK" buttons {"OK", "Change"} default button "OK" default answer Subject_)
		set Subject_ to my FixFileName(Subject_) --Calls handler to strip bad characters
		set Subject_ to my Filename(Subject_) --Calls handler to check for duplicate names
		activate application "Mail" --Brings window to the front
	end tell
	
	my FileasPDF() --Calls handler to process the save part of routine
	
	set AttachNumber to 0
	
	repeat with att from 1 to count every mail attachment of theMsg
		set AttachNumber to AttachNumber + 1
		set att to name of mail attachment att of theMsg as string
		set att2 to (((count (every character in Subject_))) - 4)
		--set att2 to characters 1 thru att2 of Subject_
		set att3 to characters -1 thru -4 of att --Gets last 4 characters of attachment name
		--display dialog Subject_ & " Attach" & AttachNumber & att3 as string
		set attachname to Subject_ & " Attach" & AttachNumber & att3 as string
		
		set destinationFolder to destinationFolder as string
		save mail attachment att of theMsg in destinationFolder & attachname
		
	end repeat
	set check to the button returned of (display dialog "Delete " & return & Subject_ & return & " from Mail " buttons {"Yes", "No"} default button 1)
	if check = "Yes" then
		delete theMsg
	end if
end tell
--end tell
------------------------------------------
on FileasPDF()
	tell application "System Events"
		tell process "Mail"
			keystroke "p" using command down
			repeat until exists sheet 1 of window 1
				delay 0.2
			end repeat
			tell sheet 1 of window 1
				click menu button "PDF"
				repeat until exists menu 1 of menu button "PDF"
					delay 0.02
				end repeat
				click menu item "Save as PDF." of menu 1 of menu button "PDF"
			end tell
			repeat until exists window "Save"
				delay 0.2
			end repeat
			tell window "Save"
				keystroke "g" using {command down, shift down}
				repeat until exists sheet 1
					delay 0.2
				end repeat
				tell sheet 1
					--Subject_Added Peter to test how to pass file name
					set value of text field 1 to POSIX path of destinationFolder & "/" & Subject_
					click button "Go"
				end tell
				repeat while exists sheet 1
					delay 0.2
				end repeat
				click button "Save"
			end tell
		end tell
	end tell
end FileasPDF
-----------------------------------------
on FixFileName(str) --Deletes characters that cannot be used in file names
	--display dialog "Check Filename for duplicates"
	--display dialog "Fixed str " & str
	set fixed_string to {}
	set bad_char to {":", "/"}
	repeat with c from 1 to (count every character in str)
		if bad_char contains (character c of str) then
			set end of fixed_string to "-"
		else
			set end of fixed_string to (character c of str)
		end if
	end repeat
	fixed_string as string
	set str to fixed_string
end FixFileName
---------------------------------------
on Filename(str) --Has to iterate through every file name twice
	tell application "Finder"
		set fileCheck to str & ".pdf" --add as the file is to be saved as a PDF
		repeat with lof1 from 1 to filecount --1st Iteration will be fileCheck 2nd fileCheck1 3rd fileCheck11 etc
			repeat with lof from 1 to filecount
				--activate application "Finder"
				if fileCheck as string = item lof of listOfFiles as string then
					set str to str & 1 --Extends str by 1
					set fileCheck to str & ".pdf" --resets filecheck to new string as PDF
					exit repeat --match found exits to next loop
				end if
			end repeat
		end repeat
		set Subject_ to str
	end tell
end Filename
-----------------------------------------
on ParseName(str) --Takes attachment name and strips extension not in use
	set d to AppleScript's text item delimiters
	set AppleScript's text item delimiters to "."
	set str to every text item of str as list
	set AppleScript's text item delimiters to " "
	set str to every text item of str as text
	set strcnt to count of words in str
	set str3 to {}
	set ext1 to last word of str
	if strcnt is greater than 2 then
		repeat with n from 1 to strcnt - 1
			set str2 to word n of str
			set str3 to str3 & str2
		end repeat
	else
		set str3 to word 1 of str
		display dialog "In Parse Name " & str3
	end if
	set str3 to str3 as string
	set str to my replaceChars(str3)
end ParseName
---------------------------------
on replaceChars(thisText) --Removes spaces not in use called from ParseName
	set d to AppleScript's text item delimiters
	set AppleScript's text item delimiters to the " "
	set the itemList to every text item of thisText
	set AppleScript's text item delimiters to the ""
	set thisText to the itemList as string
	set AppleScript's text item delimiters to ""
	return thisText
	set AppleScript's text item delimiters to d
end replaceChars

thanks

Peter

Model: iMac 27"
AppleScript: 2.1.2
Browser: Safari 533.19.4
Operating System: Mac OS X (10.6)