Another option of note … 😃 … 😶… anyway. The BBEdit command line utility has a
note flag.
So this should work
tell application "BBEdit"
set docList to text documents whose name starts with "untitled" and on
disk is false
repeat with theDoc in docList
if (length of theDoc's text > 0) then
set theContent to theDoc's text
do shell script "echo " & quoted form of theContent & "
| /usr/local/bin/bbedit --note"
close theDoc
end if
end repeat
end tell
This will leave a bunch of open notes.
Mostly I mention it because it’s good to know that `bbedit --note` exists.
> On Jul 23, 2021, at 9:06 AM, Christopher Stone <[email protected]>
> wrote:
>
>> On Jul 23, 2021, at 10:03, Jim Straus <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> I've created a script to convert all my untitled text documents to notes
>> (kind of surprised something like this wasn't provided with the release of
>> BBEdit 14). It generally works, but for some notes the body is empty. If I
>> put in a dialog with the text, it works, but that means I have to respond to
>> each dialog.
>>
>> Any thoughts on how to fix this?
>
> Hey Jim,
>
> It would be nice if Rich added a make new note command to the AppleScript
> dictionary, but this should work for now.
>
> I recommend commenting-out close theDoc until you're confident the script
> works as intended.
>
> --
> Best Regards,
> Chris
>
>
> --------------------------------------------------------
> # Auth: Christopher Stone
> # dCre: 2021/07/23 10:57
> # dMod: 2021/07/23 10:57
> # Appl: BBEdit, System Events
> # Task: Convert Unsaved Documents into Notes.
> # Libs: None
> # Osax: None
> # Tags: @Applescript, @Script, @BBEdit, @System_Events, @Convert, @Unsaved,
> @Documents, @Notes
> # Test: Only on macOS 10.14.6 Mojave
> # Vers: 1.00
> --------------------------------------------------------
>
> tell application "BBEdit"
>
> set docList to text documents whose name starts with "untitled" and on
> disk is false
>
> repeat with theDoc in docList
> if (length of theDoc's text > 0) then
> select theDoc
> select theDoc's text
> saveSelectedTextAsNote() of me
> close theDoc
> end if
> end repeat
>
> end tell
>
> --------------------------------------------------------
> --» HANDLERS
> --------------------------------------------------------
> on saveSelectedTextAsNote()
> tell application "System Events"
> tell application process "BBEdit"
> tell menu bar 1
> tell menu bar item "File"
> tell menu 1
> tell menu item "Save as Note"
> perform action "AXPress"
> end tell
> end tell
> end tell
> end tell
> end tell
> end tell
> end saveSelectedTextAsNote
> --------------------------------------------------------
>
>
> --
> This is the BBEdit Talk public discussion group. If you have a feature
> request or need technical support, please email "[email protected]"
> rather than posting here. Follow @bbedit on Twitter:
> <https://twitter.com/bbedit <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 [email protected]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/B908AB4C-47D5-48D6-9033-3ED67CED4584%40gmail.com
>
> <https://groups.google.com/d/msgid/bbedit/B908AB4C-47D5-48D6-9033-3ED67CED4584%40gmail.com?utm_medium=email&utm_source=footer>.
--
This is the BBEdit Talk public discussion group. If you have a feature request
or need technical support, please email "[email protected]" 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/5E325107-E9FB-40B6-92C2-581DBD469BF3%40rustydogink.com.