Hello
I apologizes but when I run the script, I get:
tell application “Pages”
get character offset of every character of body text of document 1 whose contents = “s”
“Erreur dans Pages09 : NSReceiverEvaluationScriptError: 3”
I wanted to test this variant:
set exceptionList to {"f", "b", "k", " ", ".", ",", "/", "?", "!", "~", "-", "“", "”", "'", "\"", "'", """, "*", ")", "}", "]", ":", ";", ">", "\\", " ", "
", "
"}
tell application "Pages"
activate
with timeout of 300 seconds --5 minutes
tell body text of document 1
set offsetList to character offset of every character whose contents is "s"
repeat with anOffset in offsetList
if contents of character (anOffset - 1) is not "f" and contents of character (anOffset + 1) is not in exceptionList then
if my isitAlowercases(character (anOffset)) then set character (anOffset) to "?" --lowercase "s" = ascii number 115
end if
end repeat
end tell
end timeout
end tell
on isitAlowercases(c)
considering case
set flag to c = "s"
end considering
return flag
end isitAlowercases
Alas, even this bare one:
tell application "Pages"
activate
with timeout of 300 seconds --5 minutes
tell body text of document 1
set offsetList to character offset of every character whose contents is "s"
end tell
end timeout
end tell
fails (I’m running Pages '09 under 10.4.11)
Yvan KOENIG (from FRANCE mardi 3 février 2009 22:36:46)