Codeplus Posted March 31, 2016 Posted March 31, 2016 Hello, I have a simple workflow that searches a folder, within PDF files, for a term. Alfred will list each file that has that term in its results. Preview.app opens when a result has been chosen. This works as expected. Does anyone know of a way to take my search term and put it in the search field in Preview.app, to filter down the results to show just the pages with that term? I have been doing it manually. It would be great to automate it. Searching this forum and Google provided no results for a shell script, commandline switches or AppleScript that will do this. Thanks for reading my post.
FroZen_X Posted March 31, 2016 Posted March 31, 2016 (edited) Is this what you're looking for? activate application "Preview" tell application "System Events" tell process "Preview" tell window 1 set value of text field 1 of group 3 of tool bar 1 to "testsearch" end tell end tell end tell Edit: Just saw you also want to jump to the page. This puts the search term into the search field, gotta check how the rest is done. Edit2: Found another way which was posted here: http://www.alfredforum.com/topic/2522-search-in-pdf-files/ tell application "Preview" activate tell application "System Events" tell process "Preview" click menu item "Find…" of menu "Find" of menu item "Find" of menu "Edit" of menu bar item "Edit" of menu bar 1 keystroke "{query}" end tell end tell end tell Edited March 31, 2016 by FroZen_X
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now