I really dislike having to manually find my place again.
This script defaults to finding SD's native marker '--»', but you can set it to anything you like.
The script will find the next marker character(s). It will wrap if needed. It will fail silently if there is no marker in the script.
The next thing to do is to write a script to emplace a temporary mark like '--» ••••••••••'. The advantage of this string is that it can be seen from navigation pop-up menu in addition to the find-mark script.
So I'll have one script to navigate to the next mark and another to navigate to a temporary mark (so I can easily save my place).
I guess I need to write another script to navigate backwards, but that'll have to wait for another day.
---------------------------------------------------------------------
# Created: 2012-09-14 : 06:55
# Modified: 2012-09-14 : 07:16
# Application: Script Debugger
# Purpose: Find the next Marker
# Dependencies: Satimage.osax
---------------------------------------------------------------------
on fnd(findStr, srcData, startPos, caseSensitive, allOccurrences, stringResult)
try
set findResult to find text findStr in srcData ¬
starting at startPos ¬
case sensitive caseSensitive ¬
all occurrences allOccurrences ¬
string result stringResult ¬
with regexp
return findResult
on error
return false
end try
end fnd
---------------------------------------------------------------------
on fndBool(findStr, srcData, caseSensitive, allOccurrences, stringResult)
try
set findResult to find text findStr in srcData ¬
case sensitive caseSensitive ¬
all occurrences allOccurrences ¬
string result stringResult ¬
with regexp
return true
on error
return false
end try
end fndBool
---------------------------------------------------------------------
try
set _mark to "--»"
tell application "Script Debugger"
if document 1 exists then tell document 1
set _SRC to source text
if (fndBool(_mark, _SRC, false, false, false) of me) = true then
try
set {startPos, null} to character range of selection
set fRec to fnd(_mark, _SRC, startPos, false, false, false) of me
set selection to {(matchPos of fRec) + 1, matchLen of fRec}
on error
set startPos to 1
set fRec to fnd(_mark, _SRC, startPos, false, false, false) of me
set selection to {(matchPos of fRec) + 1, matchLen of fRec}
end try
end if
end tell
end tell
on error eMsg number eNum
# stdErrAS(eMsg, eNum, true, true) of me
stdErrAS(eMsg, eNum, true, false) of me
end try
---------------------------------------------------------------------