Find Next in Skim

I have this for me very useful script:


set textToFind to get the clipboard
tell application "Skim"
	set foundText to find front document text textToFind
	select foundText with animation
end tell

This script would even be more useful if I could also use a Find Next feature (triggered via Keyboard Maestro).

Would that be possible at all?

Thank you for your feedback!

It made me have another look at Skim and … I found a feature that I should have thought of right away: CMD+G to select the next instance of the Find string (or: to repeat the search).

However, I noticed that this cannot be used when ‘my’ script has been used.

Luckily there is another feature: CMD+E to set the Find string to the current selection.

So I’d need something like:

  1. Execute my script.
  2. Simulate CMD+E to set the Find string to the current selection.
  3. Simulate CMD+G to repeat the search.

I guess that I can achieve this in Keyboard Maestro but I’d be interested to see the AS approach too.

This works for me:


tell application "System Events"
	tell process "Skim"
		set frontmost to true
		click menu item "Use Selection For Find" of menu of menu item "Find" of menu "Edit" of menu bar 1
		click menu item "Find Next" of menu of menu item "Find" of menu "Edit" of menu bar 1
	end tell
	activate application "CafeTran"
end tell