Re: scripting font change in TextEdit / NoteTaker, etc
Re: scripting font change in TextEdit / NoteTaker, etc
- Subject: Re: scripting font change in TextEdit / NoteTaker, etc
- From: Michael Cytrynowicz <email@hidden>
- Date: Thu, 22 Jul 2004 12:22:34 +0200
Hi list!
First, many thanks to Deivy, Martin Crisp and Emmanuel, who've been very
generous in helping me out with this problem.
I found a few things about attribute runs, and even managed to write a
few scripts, but they are behaving in a strange way, and I sure
appreciate your further assistance ;-)
Recalling, I wanted to
"In NoteTaker... I need to be able to select some entries and
change them all to say, Georgia 14."
The script I wrote:
with timeout of 10 seconds -- I added this because the script was
misbehaving
tell application "NoteTaker"
set n to number of entries of current page of current notebook
repeat with i from 1 to n
set font of characters of entry i of current page of current
notebook to "BitstreamVeraSans-Roman"
end repeat
end tell
end timeout
What happens when I run the script:
1. If there's one entry in the NoteBook page, script runs fine, and font
gets changed.
2. If there are 2 or more, usually the first entry will get changed OK,
but not the others, or, a few entries get changed but not all.
3. The script times out, and NoteTaker hangs. I go to Activity Monitor,
its name is displayed in red. I press "inspect", then "sample" - there's
a pretty large output, and NoteTaker comes back to life.
What I _do_ know:
1. NoteTaker understands "n", the number of entries of current page
2. NT understands the complete path to an entry, be it the first, or the
nth - if I script it to a safer "get text" instead of "set font" it
works OK
3. I can set programatically the font of entry 1, but I can't set the
font of entry 2. If I move entry 2 up making it now the first entry, the
script will work OK (for that entry). So the problem is a recursion one?
Hypotheses???
looks like NoteTaker is being fed more than it can digest. Now why would
this be, and what are the workarounds?
I appreciate any additional input on this - being able to change
font/size of the character runs this way is immensely useful to me -
what with thousands of entries in all sorts of fonts and colors, I found
out that the script I use (if it worked OK) could do something quite
useful, which is respect the colors (e.g., AppleScript pretty colors)
but change just the font (e.g. Vera)
best,
Mike
_______________________________________________
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.