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?

tell application "BBEdit"
activate
set doctitles to "" --  collect every document we handled
repeat with wnd in every text window
repeat with doc in every text document of wnd
if doc is modifiable and doc is modified and name of doc starts with 
"untitled text" then
set doctext to (text of doc) as string
if doctext is not equal to "" then
tell application "System Events" -- create a new note
tell process "BBEdit"
click menu item "Note" of menu of menu item "New" of menu "File" of menu 
bar 1
end tell
end tell
display dialog "text: " & doctext -- WITHOUT THIS SOME NOTES ARE EMPTY?!?
set contents of text document 1 to doctext
set doctitles to doctitles & name of doc & return
end if
delay 1
end if
end repeat
end repeat
-- put the list of handled documents into a new note.
tell application "System Events"
tell process "BBEdit"
click menu item "Note" of menu of menu item "New" of menu "File" of menu 
bar 1
end tell
end tell
set the clipboard to doctitles
paste
end tell

-- 
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/372761b5-5ed8-483d-82df-52c19fd10474n%40googlegroups.com.

Reply via email to