I have a script to allow myself to update my Facebook status using a dialog box and a direct email to my Facebook account. I wrote a script to accept the text from a dialog box and use this for the subject of the email to be sent to my Facebook account so the status can be updated. The script works flawlessly when only used on its own.
However, I am now trying to add the script into a bigger project and this is throwing up some issues.
here is the code for the bigger project’s Facebook portion:
-- FACEBOOK STATUS
if myCommand contains "new status" then --mycommand is a variable that should be like this: "new status status goes here"
set jarvisTag to " (sent by Jarvis)" -- this is to let people know it was automated.
set newstatus to text returned of util's replaceText("new status ", "", myCommand) as string --this will remove the "New status" portion of mycommand and return it as newstatus.
set theRecipient to "Facebook email goes here"
set theSubject to {(newstatus as string) & jarvisTag} --combines the status and automation message so it would look like 'status goes here (sent by Jarvis)'
tell application "Mail" --sending the message
activate
set statusmessage to make new outgoing message
tell statusmessage
set the subject to string of theSubject
make new to recipient at end of to recipients with properties {address:theRecipient}
end tell
send statusmessage
end tell
set response to "Facebook has been updated."
return response
end if
My problem is that whenever I try to send the message then it will not send, instead just returns “can’t make <> of “status goes here” into type string”. I have googled this and ttxt is just a plain text variable. I have changed all the “as string” to “as text” and it still flags up the problem, even though variable “myCommand” will only return text to the script. some people have said to try and return the variable as “Rich text”, but my compiler (applescript editor on lion) doesn’t recognise this command and thinks the word rich is a variable.
How can i fix this problem?
John
Model: iMac
AppleScript: Version 2.4.3 (131.2)
Browser: Safari 534.56.5
Operating System: Mac OS X (10.7)