Hello I am hitting a wall.
On my imac (Intel inside) running 10.5.7,
this script is able to switch the document's format
from the default "Plain Text" to the required "Rich Text".
Alas, on the machine used by the asker for which I wrote it, it doesn't do the trick.
The status of the "Format > Bold" item is correctly read as false but the menu item is not switched from
"Make Rich Text" to "Make Plain Text" as it must be.
--[SCRIPT]
set CPUtype to CPU type of (system info)
tell application "TextEdit"
activate
make new document
-- set TEname to get name of document 1
tell application "System Events" to tell process "TextEdit" to tell menu bar 1 to tell menu bar item 5 to tell menu 1
tell menu item 1 to tell menu 1 to set liste1 to name of menu items
tell menu item 1 to tell menu 1 to set flag to enabled of menu item 2
set liste2 to name of menu items
if flag is false then click menu item 4
tell menu item 1 to tell menu 1 to set flag2 to enabled of menu item 2
end tell -- System Events
end tell -- TextEdit
set liste1 to my recolle(liste1, ", ")
set liste2 to my recolle(liste2, ", ")
set the clipboard to CPUtype & return & return & liste1 & return & return & flag & return & return & liste2 & return & return & flag2
on recolle(l, d)
local t
set AppleScript's text item delimiters to d
set t to l as text
set AppleScript's text item delimiters to ""
return t
end recolle
--[/SCRIPT]
to be continued
Yvan KOENIG (from FRANCE lundi 25 mai 2009 19:03:28)