Add all open files to a project?

34 views
Skip to first unread message

Barbara Snyder

unread,
Aug 22, 2018, 7:06:49 PM8/22/18
to BBEdit Talk
I have a bunch of open files. I'd like to create a project that includes all open files (without me having to add them individually). Is there a way to do this? Or do I have to enter a feature request?

Also, the list of currently open documents near the bottom of the project pane for a new project is blank, and the little clock icon at the bottom (which I assume means recent documents) shows me a single random file that is currently open. So even if I wanted to manually add all the currently open files to the project, I have to do it from the + menu and just select them in the finder, correct? I can't find any other way to add other currently open files to the project. Is there a way?

Thanks -- Barbara

Rich Siegel

unread,
Aug 23, 2018, 10:12:23 AM8/23/18
to bbe...@googlegroups.com
On 8/22/18 at 7:06 PM, bar...@signalfx.com (Barbara Snyder) wrote:

>I have a bunch of open files. I'd like to create a project that
>includes all open files (without me having to add them
>individually). Is there a way to do this? Or do I have to enter
>a feature request?

The shortest number of steps (assuming that the files are all in
the same window, which you can accomplish by drag-and-drop):
choose "Save Project" from the File menu, which will create a
project containing the current set of files in the window's sidebar.

Enjoy,

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.

Christopher Stone

unread,
Aug 23, 2018, 10:45:40 AM8/23/18
to BBEdit-Talk
On 08/22/2018, at 18:06, Barbara Snyder <bar...@signalfx.com> wrote:
I have a bunch of open files. I'd like to create a project that includes all open files (without me having to add them individually). Is there a way to do this? Or do I have to enter a feature request?


Hey Barbara,

Save this Bash script to a file here:

~/Library/Application Support/BBEdit/Scripts/



#!/usr/bin/env bash

read -r -d '' asCmdStr <<'EOF'

    tell application "BBEdit" to set fileList to file of text windows whose on disk is true

    repeat with i in fileList
        set contents of i to quoted form of (POSIX path of (contents of i))
    end repeat

    set AppleScript's text item delimiters to linefeed
    set fileList to fileList as text

    return fileList

EOF

fileList=$(osascript -e "$asCmdStr");

shCMD="bbedit --project $fileList"
eval $shCMD



Give it a keyboard shortcut or run it by selecting it from the script menu.

Only windows that have been saved to disk will be placed in the new project.

The windows will NOT be closed after the project is created.  At this time that's an exercise for the user, although it's doable.

The project will NOT have been saved anywhere, so you'll have to do that manually.

Also, the list of currently open documents near the bottom of the project pane for a new project is blank, and the little clock icon at the bottom (which I assume means recent documents) shows me a single random file that is currently open. So even if I wanted to manually add all the currently open files to the project, I have to do it from the + menu and just select them in the finder, correct? I can't find any other way to add other currently open files to the project. Is there a way?

You can drag files OR BBEdit windows into a project using their icon proxy.

--
Best Regards,
Chris

Christopher Stone

unread,
Aug 24, 2018, 2:00:18 PM8/24/18
to BBEdit-Talk
On 08/23/2018, at 09:45, Christopher Stone <listm...@suddenlink.net> wrote:
On 08/22/2018, at 18:06, Barbara Snyder <bar...@signalfx.com> wrote:
I have a bunch of open files. I'd like to create a project that includes all open files (without me having to add them individually). Is there a way to do this? Or do I have to enter a feature request?

Save this Bash script to a file here:


Hey Barbara,

Here's an AppleScript alternative to the shell script I posted.

Save as a compiled script using the Apple Script Editor.app to:

~/Library/Application Support/BBEdit/Scripts/

Similarly to the Bash script you can assign it a keyboard shortcut or just run it from the script menu.

--
Best Regards,
Chris

----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2018/08/24 12:35
# dMod: 2018/08/24 12:35 
# Appl: BBEdit
# Task: Create Synthic Project from Open Text Documents.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Create, @Synthic, @Project, @Open, @Text, @Documents
----------------------------------------------------------------

tell application "BBEdit"
    set fileList to file of text windows whose on disk is true
    set winList to text windows whose on disk is true
end tell

repeat with i in fileList
    set contents of i to quoted form of (POSIX path of (contents of i))
end repeat

set AppleScript's text item delimiters to " "
set fileList to fileList as text

set shCMD to "
export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:$PATH;
bbedit --project " & fileList & "&> /dev/null &"
do shell script shCMD without altering line endings

set closeOldWindows to true -- set to false if you don't want to close the old windows.

if closeOldWindows then

    

    tell application "BBEdit"
        repeat with theWin in winList
            close theWin
        end repeat
    end tell

    

end if

----------------------------------------------------------------

Barbara Snyder

unread,
Aug 24, 2018, 2:08:25 PM8/24/18
to bbe...@googlegroups.com
Thanks to everyone for all the suggestions. I will definitely try them out as time allows.

-- Barbara


--
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 a topic in the Google Groups "BBEdit Talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bbedit/WZPkpq7BlsE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bbedit+un...@googlegroups.com.
To post to this group, send email to bbe...@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.

Reply all
Reply to author
Forward
0 new messages