I allways open textedit with plain text, and the I just change when I need rich text, command shift T.
Talking about open souce and such, one of the funniest things to play with is sketch, which is Apples demo program for scriptability. You can actually script diagrams with it.
Well, it should work with plain text now, there are several backup schemes for the save handler, you have overwrite, save the previous version to a new name with supplied extension, or save the file with the next higher number.
The properties are set on the docs, so, whatever extension you choose, they should open by default in TextEdit.
Thatās right. I forgot about the open source TextEdit example. Iāll look into it. I Hope itās in AppleScript ObjC.
Hi McUsr,
That Command + Shift + T works very well with a new document. Didnāt think of that. Iāve seen the Sketch example also. And I was thinking about making a simple text editor from scratch!
One thing I was thinking about was AXRaise. Iām quite sure that in os10.8 AXRaise only brought the front window frontmost and not any others from that app. Here in os10.9 it brings every window above those of other apps.
I proclaim I can make the AXRaise work precisely as I want it to, in just bringing the first window to front, (at least until Iām proven wrong ).
Edit AXRaise works perfectly if you use system events, to address the application process TextEdit, which then must address the window, by its index before performing action āAXRaiseā
One thing Iāve wanted to do a lot lately was making the table. So, just for fun I got this. With a blank rtf document in front:
set t to linefeed & "a b c d
e f g h
i j k l" & linefeed
--
tell application "TextEdit"
launch
activate
set text of front document to t
end tell
tell application "System Events"
tell process "TextEdit"
key code 123
key code 123 using {command down, shift down}
key code 123 using shift down
key code 123 using {command down, shift down}
key code 123 using shift down
key code 123 using {command down, shift down}
tell menu bar 1
tell menu bar item "Format"
tell menu "Format"
tell menu item "Table."
perform action "AXPress"
end tell
end tell
end tell
end tell
end tell
end tell
This is the English version. Iām not very good at making it international.
In Xcode the thing that takes a lot of time is reading through the documents.
Your script looks nice, Iāll localize for my lingo and play with it.
Another way, that requires less UI scritping is to generate html with the help of sed, Iām not sure if you can make empty table cells, or have to fill them with something, but empty tables are fairly easy to make with TextEdit, and with Yvanās and Nigelās brilliant scripts (post #14 and #2) , you can pretty much UI Script anything that is localized.
Well, you can generate a table with sed,(embedded with html) open it in Safari, keystroke cmd - C, and then paste it into TextEdit, (Then you can even have coloured background , styled with help of css, when you generate the html with sed!
That looks cool, Iāll give it a try, I think Shane Stanley also posted a post, with a link to scripting Notes in Code Exchange a year ago or so. I think Regulus 6633 participated, if that can help you to reveal the thread. (If memory serves right then the thread was Reguluās, but I donāt bet on it.)
Edit
The Notes script worked fine, but the TextEdit script I couldnāt make to work perfectly, did all the characters in it go into a cell of their own for you?
Yes, the ui scripting script works consistently on my computer. It first enters the tab delimited table data with linefeeds before and after. Then it selects the table data without the linefeeds at the ends. Then it selects the Table⦠menu. The data shows in different fields. Itās not good for the Library.
I like your html hint though. The modifiable table looks much better than the TextEdit table.
Iāll search and see into those discussions that you mentioned. Also, I really want to look into the TextEdit open source.
I have debugged the Output library the first time around, and the basic functionality seems to work, and I have written the docs, so I think Iāll delete the posts concerning it in this thread in a short while, just so it is consistent.