Your attempt is close. Here's a script that is working for me. You cn comment out the "do shell" line with -- at the beginning of the line and uncomment the line above it to see the file path that it will try to open for testing.
tell application "BBEdit" set _file to file of front window --display dialog "File: " & quoted form of (POSIX path of _file) do shell script "open -a TextEdit " & quoted form of (POSIX path of _file) end tell -Kendall On Jul 2, 4:33 pm, TJ Luoma <luo...@gmail.com> wrote: > {Let me preface this by saying that I don't know jack about > AppleScript. I've been googling around (and even checked the manual) > and can't find anything like this, so I'm guessing it's so basic no > one thinks anyone has to be told how to do this.} > > Problem: I want to open the front-most file in BBEdit in another > application by pressing some keyboard command. > > Let's say the other application is TextEdit, but it could be any > application. > > On page 322 of the manual (see, I read it :-) it says: > > > Although BBEdit still supports the “active document” property, this is no > > longer necessary. Instead, if a text window is frontmost: > > > document 1 of application "BBEdit" > > document 1 of text window 1 of application "BBEdit" > > active document of text window 1 of application "BBEdit" > > > now all refer to the same document. > > So, cobbling together that with other stuff from around the web (lots > of which is old and confusing) > > I tried this: > > tell application "BBEdit" > set thefile to document 1 of application "BBEdit" > set thepath to POSIX path of thefile > end tell > > do shell script "open -e " & thepath > > I also tried it without the tell / end tell lines > > But I always get an error such as this: > > https://skitch.com/luomat/f8had/bbedit-as-error > > "BBEdit got an error: Can't make POSIX path of text document into type > POSIX path of text document 1." > > which tells me absolutely nothing helpful. > > Can someone: > > 1. point me in the right direction? > > 2. recommend a good "AppleScript for beginners" book? -- 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>