|
Why Doesn’t My Script Debug Properly?
|
|
There are some known cases where a script that runs fine normally will generate a spurious error when you’re in debug mode, thus making it impossible to debug it.
If you run into this sort of situation, try changing any repeat with … in blocks to normal repeat with loops. For example, this script chokes in debug mode:
tell application "BBEdit"
tell document 1
set L to (get every word where its text begins with "t")
repeat with aWord in L
tell contents of aWord
change case of it making capitalize words
end tell
end repeat
end tell
end tell
But this version works fine:
tell application "BBEdit"
tell document 1
set L to (get every word where its text begins with "t")
repeat with i from 1 to (count L)
tell (item i of L)
change case of it making capitalize words
end tell
end repeat
end tell
end tell
Let us know if you run into any other cases.