⌘F
Find Next

Script key: Find Next

Posted by Xor

Install

Details

Label ⌘F
Voice Over Find Next
Script
var text = getText()
var n = text.length
var selRange = getSelectedRange()

if (selRange[1]) {

  var p = selRange[0]
  var q = p + selRange[1]
  
  var s = text.substring(p, q)
  
  if (!search(s, q)) {
    search(s, 0)
  }
}

function search(s, j) {
  var i = text.indexOf(s, j)
  
  if (i !== -1) {
    p = i
    q = i + selRange[1]
  
    setSelectedRange(p, q - p)

    return true
  } else {
    return false
  }
}

Advanced

Keyboard shortcut None
Hide key Yes

Discussion

comments powered by Disqus