Condition Rule ignored?
I can't work this out but for some reason I can get it to see this rule
When it gets to
ifthisBrandisequal to "Kids" then
it seams to ignore it?
I can't see where the logic goes wrong?
This was the outcome
tell application "Mail"
makenewoutgoing messagewith properties {subject:"Week 33 images", visible:false}
--> outgoing messageid 1
(*Kids*)
display dialog "2"
Thanks in advance!
tell application "Mail" to quit
--while mail is closed, add in the default Reply-To key in a UserHeaders dictionary
do shell script "defaults write com.apple.mail UserHeaders '{\"Reply-To\" = \"me@company.com, you@@company.com\"; }'"
display dialog "Please enter the current week number." default answer ""
set weekNumber to text returned of the result
set brandsToUse to choose from list {"Adult", "Kids", "Baby"} with prompt "Choose brands to send out." default items {"Kids"} with multiple selections allowed
-- get the html template
set htmlTemplate to read "Users/StudioD/WorkFlow/EMAIL PROJECT/content.html"
considering case
-- this section splits the template text at every XX, then rejoins it using the week number
set htmlTemplate to tid(htmlTemplate, "XX")
set htmlTemplate to tid(htmlTemplate, weekNumber)
end considering
tell application "Mail"
set subjectLine to "Week " & weekNumber & " images"
repeat with thisBrand in brandsToUse
considering case
-- this section adds the brand name, done inside the loop because it's different for each email
-- the 'my' keyword is needed because you're calling a handler from within a tell block
set htmlContent to my tid(htmlTemplate, "*LOGO*")
set htmlContent to my tid(htmlContent, thisBrand as list) -- thisBrand is an item in the full list
end considering
-- create a new message. visible must be false for the 'html content' line to work correctly
set newMessage to makenewoutgoing messagewith properties {subject:subjectLine, visible:false}
tell newMessage
-- create a variable recipient address based on brand name
logthisBrand
-- Here is the issue!!!!!!!!!!!
if thisBrand is equal to "Kids" then
display dialog "Option A"
else
display dialog "Option B"
end if
set html content to htmlContent
-- send the email
send
end tell
end repeat
end tell