set AppleScript's text item delimiters to ASCII character 34
set theItemList to every text item in Tweet
set FormattedTweet to every item in theItemList as string
set AppleScript's text item delimiters to ""
But it didn’t work. Frankly, though, even after reading the MacScripter tutorial about text item delimiters, I’m not sure I totally get it, so I’m probably doing something wrong here.
I believe you also need to URL Encode the message text. I did not write the following which encodes the message.
set textToEncode to "The folks at MacScripters BBS have moved my script to the \"Code Exchange\": [url=http://tinyurl.com/67d33a]http://tinyurl.com/67d33a"[/url]
do shell script "python -c 'import sys, urllib; print urllib.quote(sys.argv[1])' " & quoted form of textToEncode
I believe it still needs URL Encoding. I have quoted below the information for the ‘data’ (-d) option in the cURL man pages. This clearly states that The data is expected to be “url-encoded”.
Boy, it was fun watching two very smart minds come to the right solution. Thank you both so much for your help. This is the AppleScript I had come up with based on the previous post
-- In order for all kinds of text to work in cUrl, the Tweet must be "URL-encoded"
set FormattedTweet to do shell script "python -c 'import sys, urllib; print urllib.quote(sys.argv[1])' " & quoted form of Tweet
-- Then format the Tweet so we can send it out to Twitter using cURL
set TwitterUpdate to "curl -u " & TwitterUser & ":" & TwitterPassword & " -d status=\"" & FormattedTweet & "\" [url=http://twitter.com/statuses/update.xml]http://twitter.com/statuses/update.xml"[/url]
-- Now try sending the Tweet to Twitter
try
set TwitterResponse to do shell script TwitterUpdate
but I think Bruce’s is smarter since it ensures that the quoted form of the Tweet will be used in the shell command.
Thank you again both for your help! Exactly what I needed and educational too!