I think I could write up a script that does this pretty easily. The only
problem is that BBEdit only provides two methods for unix scripts, 'filters'
and 'scripts'. Scripts run in Terminal, so it's kind of difficult to get
the output of said script into a new BBEdit window in an automated fashion.
Filters run on an existing window and replace the contents.
A third option is to call a unix script from an Applescript. Applescript
can obviously open new BBEdit windows, etc., but its kind of kludgy to have
a parent Applescript call on separate unix script. You'd have to install
two files, etc. Of course, the obvious solution would be to write a 100%
Applescript script, but for the life of me I can't master Applescript.
So, I can provide you with a Python script that you can run from the command
line. You feed it a directory and it will make an index page for the html
files in that directory. Would that be useful?
I wish there was tighter integration between BBEdit and scripting languages,
like Python and Perl. But there isn't. If there was, extending BBEdit to
do tasks like this would be so much easier. Instead, you have to wrestle
with Applescript to do anything of the sort. It's one of the features I'm
really jealous that Textmate has.
> On Jan 15, 2011 at 12:02 AM -0800, BBunny wrote:
>> The "Misc" menu in previous versions of BBEdit contained an "index"
>> feature, which generated a hierarchical index—in other words, a sitemap
>> —of a Web site, with live links to the pages. With version 9.6, that
>> feature has been eliminated. Can anyone suggest a script or other easy
>> way of replacing that function? Thanks much.
Probably not exactly what you want (and may require a web server) but you might look at this:
There are many other spiders out there and nearly all of them produce some kind of report that could be tweaked to make a sitemap (I think).
Ted
On 20/03/11 at 12:05 PM -0400, Tim Gray <tg...@125px.com> wrote:
>I wish there was tighter integration between BBEdit and
>scripting languages, like Python and Perl. But there isn't.
>If there was, extending BBEdit to do tasks like this would be
>so much easier. Instead, you have to wrestle with Applescript
>to do anything of the sort. It's one of the features I'm
>really jealous that Textmate has.
What sort of integration is missing? What does Textmate do that
BBEdit doesn't? I run unix scripts (perl in my case) from BBEdit
every day. Between the Run Script command and worksheets (&
filters as you mentioned) I don't feel like I'm missing any functionality.
Charlie
--
Ꮚ Charlie Garrison ♊ <garr...@zeta.org.au>
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠 http://www.ietf.org/rfc/rfc1855.txt
I donno if it's intended or not but I regularly run perl and shell scripts that muck with a file that BBEdit has open. BBEdit recognizes that the underlying file has been changed and modifies its display automatically when you make the BBEdit window active again.
BBEdit may complain under some conditions like editing changes that were in effect but not saved before you do that so it's a good idea to save before running such a script but it's not required and there may be reasons not to.
--
--> Give me liberty or give me Obamacare <--
I'd love to be able to call a Unix script (not a filter) that picks what the
active file is and does something with it. I don't mean munge the files
contents, but use the open text file as an argument to a command line
utility (or whatever else you might do in shell script). Maybe this is a
feature that has been added - the last time I checked, scripts were passed
no real information about what was going on in the GUI. As far as I know,
the only way to do this is to write a wrapper Applescript that calls your
Unix script, with any BBEdit interaction takes place in the Applescript
layer.
For example, I write a lot of Latex files. I prefer to do that in BBEdit.
When it comes time to run the file I'm working on through pdflatex, I can't
just write a shell script that uses the active document's file path as an
argument while calling pdflatex.
If you are interested in seeing more, CompileTeX is a suite that someone
wrote a while back that does exactly this. The core of the interaction with
latex is through a shell script, but it has many Applescript bits that call
the main shell script with various options.
Another example - what if you wanted to copy the currently open file to a
specified location using a shell script (I know you can do this via
Applescript). How would you go about doing that with either Unix filters or
scripts?
I wish I had more examples ready for you, but over the years I've tried to
do various things, ran into this, gave up, and forgotten about them. I will
say that I am happy with filters and scripts for 90% of the stuff I do.
Hopefully I'm wrong and this kind of thing can now be done...
On 21/03/11 at 12:25 AM -0400, Tim Gray <tg...@125px.com> wrote:
>I'd love to be able to call a Unix script (not a filter) that
>picks what the active file is and does something with it. I
>don't mean munge the files contents, but use the open text file
>as an argument
OK, I missed that part of your question. When I run a script I
want the script itself to be the active file, so it's a
no-brainer. I seem to recall needing to run a script ages ago
that got the front document (which wasn't the script) and I just
called some AppleScript to do that; pretty easy to add. Assuming
a shell script (adjust for other languages); it should just be a
matter of something like:
FRONT_DOC=`osascript -e 'tell application "BBEdit" to get POSIX
path of ((file of front document) as string)'`
So, not built-in to BBEdit, but just a one-liner to add to
existing scripts.
Yes, I remember thinking of this solution. Unfortunately (at the time at
least), BBEdit locks out this kind of behavior when called from a script run
from the Unix menu. I'll try it again tomorrow.
I seem to recall having a discussion about this with support at some point,
but can't find the email in my archive.
>FRONT_DOC=`osascript -e 'tell application "BBEdit" to get POSIX
>path of ((file of front document) as string)'`
>
>So, not built-in to BBEdit, but just a one-liner to add to existing scripts.
When you run a script or filter from the #! menu, BBEdit sets up
some variables in the environment, one of which is BB_DOC_PATH,
the path to the front document. (This was introduced in 9.3, so
you can find more details in the 9.3 change notes at
<http://www.barebones.com/support/bbedit/arch_bbedit93.html>, as
well as in the user manual.)
If you're running a script outside of BBEdit, then the example
above is definitely useful and helpful.
R.
--
Rich Siegel Bare Bones Software, Inc.
<sie...@barebones.com> <http://www.barebones.com/>
Someday I'll look back on all this and laugh... until they
sedate me.
What's more, the above will probably not return if called in a script
which is invoked from the #! menu. BBEdit does not process AppleEvents
while running #! scripts - this includes using appscript from python or
ruby.
if [ -z "$BB_DOC_PATH' ]
then
FRONT_DOC=$(osascript -e 'tell application "BBEdit" to get POSIX
path of ((file of front document) as string)')
else
FRONT_DOC=$BB_DOC_PATH
fi
(and yes, there are more fancy methods with {}?!- and other characters
thrown in for good measure. This is somewhat readable ;-)
Maarten
As far as I can tell, these variables are only implemented for filters and
not scripts. Note, I run my scripts in Terminal, which might affect this.
Scratch that - if I set scripts to not run in Terminal, I do indeed pick up
the right variables. Thanks.
Works for me
Sent from my iPad
Not if you run your script from the #! menu in BBEdit and have it "Run in
Terminal" set.
Sent from my Apple ][
> --
> 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 bbe...@googlegroups.com
> To unsubscribe from this group, send email to
> bbedit+un...@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 "sup...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
______________________________________________________________________
Hey Tim,
http://appscript.sourceforge.net/
You can bridge all of BBEdit's Applescript dictionary to Python or Ruby.
I haven't fooled with this, but others have extolled the virtues of appscript.
--
Best Regards,
Chris
On 21/03/11 at 2:41 AM -0500, Christopher Stone
<listm...@thestoneforge.com> wrote:
>http://appscript.sourceforge.net/
>
>You can bridge all of BBEdit's Applescript dictionary to Python or Ruby.
It doesn't seem to be listed at the above site, but there is
also an AppleEvents (which is really what AppleScript is) bridge
for Perl. And I think there is another for Obj-C which pretty
much any scripting language should be able to tie in to.
So yes, one is certainly not limited to AppleScript in order to
talk to and control other apps.
Here a bunch of other links that a colleague collected a while back:
1. Server-side tool kits available for 32/64 bit OS for Windows and Linux, written in PHP, Perl and Python. Two examples:
a. Paid: http://www.softswot.com/sitemapinfo.php
b. Free: http://www.smart-it-consulting.com/article.htm?node=154&page=82
2. Extensions and plugins for CMS, development platforms and publishing platforms such as .Net, Drupal and WordPress. Two examples:
a. Paid: http://www.pc4people.com/products.php?cat=57
b. Free: http://drupal.org/project/xmlsitemap
3. Applications that can be downloaded for free, or for a fee. Two examples:
a. Paid: http://www.sitemappro.com/
b. Free: http://www.vigos.com/products/gsitemap/
4. On-line services that will ingest your web site and create an XML-Sitemap. Two examples:
a. Paid: http://www.autositemap.com/
b. Free: http://www.xml-sitemaps.com/
5. Class libraries available for Java, Perl, ASP and PHP. Two examples:
a. Free: http://www.phpclasses.org/browse/package/2612.html
b. Free: http://www.iteam5.net/francesco/sitemap_gen/
Cheers
François
> please email "sup...@barebones.com" rather than posting to the group.
--
This is the BBEdit Talk public discussion group. If you have a
feature request or would like to report a problem, please email
"sup...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To post to this group, send email to bbe...@googlegroups.com.