Re: scripting font change in TextEdit / NoteTaker
Re: scripting font change in TextEdit / NoteTaker
- Subject: Re: scripting font change in TextEdit / NoteTaker
- From: Michael Cytrynowicz <email@hidden>
- Date: Fri, 23 Jul 2004 01:00:10 +0200
Solved!
with many thanks to Emmanuel, martin Crips, Deivy
The problem was to change the font or fint size of the text in entries
of NoteTaker, without necessarily changing their colors (e.g., to avoid
losing applescript prettyprint colors).
The (fastest and less error-prone) solution was to go through the
attribute one one by one of each entry in the page, change font and
size.
I found out that I had first to delete the entries which had broken
externalk links, and I had to bypass entries with images - the reason
being that one or more of the runs refer to those images, with weird (at
least at first glance) data such as:
{{size:1.59065649540935E-10, color:{0, 0, 0}, font:missing value,
class:text}
That acomplished, the script (below) runs pretty nicely, and I am quite
happy with the amount of negentropy generated.
;-)
Change NoteTaker font, font size , color in all entries of a page
(can easily be change to selected entries, etc...)
------------------------------------------------------
tell application "NoteTaker"
try -- because it may bomb now and then
set n to count every entry of current page of current notebook
repeat with i from 1 to n
if category of entry i of current page of current notebook
is not "IMAGE" then -- process
set attributeRuns to attribute runs of entry i of
current page of current notebook -- create a list of attribute runs
set noCounts to the count of items in attributeRuns --
count the attribute runs
repeat with j from 1 to noCounts
set font of attribute run j of entry i of current
page of current notebook to "BitstreamVeraSans-Roman"
set size of attribute run j of entry i of current
page of current notebook to 12
-- set color of attribute run j of entry i of
current page of current notebook to {65535, 0, 0}
-- the above color is red
end repeat
end if -- image entries are not processed
end repeat
end try
end tell
---------------------------------------------------------
I warmly welcome improvement suggestions!
Cheers to all,
Mike Cytrynowicz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.