Reading Data from Text Window into a Shell Worksheet
Hey Folks, Today I was prototyping some shell stuff for an Applescript, which I sometimes do in a BBEdit worksheet due to the extra quoting necessary in Applescript. I like to get it working before I have to futz with the quoting. Anyway. Today I didn't feel like bothering to save my test data to a file and working from that, so I thought there has to be a better way... I thought about using text from an unsaved window, and after a few minutes of wrestling to get the syntax right I came up with this: WIN=untitled text 11 echo -e tell application \BBEdit\\nreturn text of text window \$WIN\\nend tell 21 | osascript \ | tr '\r' '\n' \ | awk '/src=.+\.jpg/ { print }' \ | sed -En '/a href=.+nyet/{ s/.+(http:.+\.jpg).+/\1/p }' I thought the general principle might be of use to someone, and I'm interested in better ways to accomplish this task if there are any. -- Best Regards, Chris -- -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit
Re: Reading Data from Text Window into a Shell Worksheet
At 04:54 -0500 9/22/12, Christopher Stone wrote: Today I was prototyping some shell stuff for an Applescript, which I sometimes do in a BBEdit worksheet due to the extra quoting necessary in Applescript. I like to get it working before I have to futz with the quoting. Anyway. Today I didn't feel like bothering to save my test data to a file and working from that, so I thought there has to be a better way... I thought about using text from an unsaved window, and after a few minutes of wrestling to get the syntax right I came up with this: WIN=untitled text 11 echo -e tell application \BBEdit\\nreturn text of text window \$WIN\\nend tell 21 | osascript \ | tr '\r' '\n' \ | awk '/src=.+\.jpg/ { print }' \ | sed -En '/a href=.+nyet/{ s/.+(http:.+\.jpg).+/\1/p }' I thought the general principle might be of use to someone, and I'm interested in better ways to accomplish this task if there are any. Have a look at shell tools pbcopy and pbpaste. They can copy stdin into the clipboard and copy the clipbnoard to stdout. I miss them on my Linux box. date | pbcopy cat somefile | pbcopy pbpaste | tcsh Are a particularly useful things to keep around in a bbedit worksheet. -- -- From the U S of A, the only socialist country that refuses to admit it. -- -- -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit