Scripting an Insert File Contents operation

45 views
Skip to first unread message

PDeL

unread,
Nov 9, 2023, 8:28:08 PM11/9/23
to BBEdit Talk
I’m trying to create an AppleScript that will do the following in BBEdit:
1. From the Edit menu (in an open file), choose Insert » File Contents…
2. In the resulting dialog, navigate to a given folder
3. Once at the desired folder, select all of the listed files
4. Insert the contents of the files

I’m encountering the following difficulties (I’ve tried both recording the steps and just coding them):
• “File Contents…” is not recognized as a menu item (must use the more brittle “menu item 1”)
• Don’t know how to navigate the dialog to the desired directory.
• Can’t find how to select all files in the dialog’s current directory.

Any guidance anyone could give would be most welcome ;-)

Roland Küffner

unread,
Nov 20, 2023, 5:20:05 PM11/20/23
to bbe...@googlegroups.com
I don't know all your premises, but if you can live without Applescript, why not simply use Text > Run Unix Command… with this:

cd /path/to/folder; cat *.txt

You could even just write cd and drag your folder from the Finder into the Shell Worksheet (while holding cmd). BBEdit will insert the file path for you.

Maybe worth a try.
Regards
Roland

--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://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 view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/23e05ce0-4b81-4ee9-bd00-1a6a17e24c20n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages