Ifs and Buts, Need help thinking logic through

tell application "Adobe Photoshop CS5.1"
	activate
	
	set textName to name of current document
	
	set the1stLetter to the first character of textName --> the 1st letter
	set the2ndLetter to the second character of textName --> the 2nd letter
	set the5thLetter to the fifth character of textName --> the 5th letter
	set the6thLetter to the sixth character of textName --> the 6th letter
	set ItemType to {the5thLetter, the6thLetter} as text
	set brandID to {the1stLetter, the2ndLetter} as text
	
	if brandID is in {"BH", "AL", "SM"} then
		set targetWidth to 1348
		set targetHeight to 1832
	else if brandID is in {"BU", "TM"} then
		set targetWidth to 1020
		set targetHeight to 1385
	else if brandID is equal to "ES" then
		set targetWidth to 1280
		set targetHeight to 1740
	else if brandID is in {"DV", "DJ", "RA"} then
		set targetWidth to 1000
		set targetHeight to 1360
	else if brandID is in {"FR", "WA", "NN"} then
		set targetWidth to 1020
		set targetHeight to 1530
	else if brandID is in {"MA", "MB", "MC", "MF", "MH", "FI"} then
		set targetWidth to 1000
		set targetHeight to 1400
	end if
	

if brandID is not equal to "TM" then
			if brandID is equal to "TM" and ItemType is not equal to "NW" then
				do action "TightCrop" from "NEW CROP SET"


File labels are as below and how each file should be treated

TM15NW is equal to TM and is equal to NW this should avoid the script
TM15ER is equal to TM but not equal to NW therefore do the script
FR10NW is not equal to TM, do the script
FR10ER is not equal to ER do the script

I hope this make sense, but essentially the only top file listed should bypass the script.?

Can you help with my logic?

I thought this would work?

if brandID is equal to "TM" and ItemType is not equal to "NW" then 
do something

its the file listed as TM–NW that I need to avoid the script.

boolean expressions are evaluated from left to right.
In this case with OR operands the first true evaluation causes to skip the others.
You can combine expressions with parentheses


if (brandID = "TM" and ItemType ≠ "NW") or (brandID ≠ "TM") or (brandID ≠ "ER") then
	--  do action
end if

BTW you can replace


set the1stLetter to the first character of textName --> the 1st letter
   set the2ndLetter to the second character of textName --> the 2nd letter
   set the5thLetter to the fifth character of textName --> the 5th letter
   set the6thLetter to the sixth character of textName --> the 6th letter
   set ItemType to {the5thLetter, the6thLetter} as text
   set brandID to {the1stLetter, the2ndLetter} as text

with


   set ItemType to text 5 thru 6 of  textName
   set brandID to to text 1 thru 2 of  textName

This works, but possibly a lazy way

I added

set skipFile to {the1stLetter, the2ndLetter, the5thLetter, the6thLetter} as text

and then did this

if skipFile is not equal to "TMNW" then

You could write that down as:

tell textname to set skipFile to text 1 thru 2 & text 5 thru 6 = "TMNW"

skipFile is a boolean for later use.