Re: Passing ampersands through a shell script
Re: Passing ampersands through a shell script
- Subject: Re: Passing ampersands through a shell script
- From: hd <email@hidden>
- Date: Sun, 25 Oct 2009 09:04:30 +0000
That's done it! (Changing --data-binary to --data-urlencode.)
Many thanks for your help!
HD
On 25 Oct, 2009, at 8:54, LuKreme wrote:
On 24-Oct-2009, at 19:34, hd wrote:
set twitter_status to quoted form of ("status=" & tweet)
display dialog twitter_status
set results to do shell script "curl -u
twittername:twitterpassword" & " --data-binary " & twitter_status
& " http://twitter.com/statuses/update.json"
If there's an ampersand (as in Kraak & Smaak) then the output is
posted to twitter, but the tweet ends just before the ampersand.
Other non-alphanumeric characters (",' etc) appear to be passed
correctly.
this worked:
property twittername : "myid"
property twitterpassword : "mypas<uT&u48#JG"
tell application "iTunes"
set thisTrack to current track
set trackName to thisTrack's name
set trackArtist to thisTrack's artist
end tell
set tweet to "is listening to " & trackName & " by " & trackArtist
set curlIt to "curl -u \"" & twittername & ":" & twitterpassword &
"\""
set results to do shell script curlIt & " --data-urlencode
\"status=" & tweet & "\" http://twitter.com/statuses/update.json"
(note the biggest change is using --data-urlencode, but I also made
sure to quote-escape everything.)
--
Hudd: 'I've just done this radio show where I never met any of the
other actors and I didn't understand what any of it was about'
Moore: 'Ah, yes I expect that's the thing I'm in.'
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden