The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Searching in AppleScript (http://forums.omnigroup.com/showthread.php?t=7085)

jcater 2008-02-06 11:14 AM

Searching in AppleScript
 
Is there a proper way to search for tasks/projects in AppleScript containing a string (much like the Search toolbar item), short of looping through projects/folders and manually checking each task?

RobTrew 2008-02-07 11:58 AM

Provided that that the toolbar has a search panel, you can set the search term using Applescript. e.g.

[CODE]tell application "OmniFocus"
tell front window
try
set search term to "tax"
end try
end tell
end tell
[/CODE]

a11en 2008-08-29 09:03 PM

When running the above script, you need to run it from inside Omnifocus, so that the front window call gets you the front window. Alternatively, you can use the description "first" window (assuming that is the topmost) which will work within script-editor.

Note that "first window" will give you an error unless the script is run within omnifocus.

-Allen

ps- remove "try" commands to see the errors that get thrown otherwise.

Update: I'm using the following subprogram in a project I'm working on right now...
[CODE]on SetSearch(searchstring)
tell application "OmniFocus"
tell front document
tell document window 1
set search term to searchstring
end tell
end tell
end tell
end SetSearch[/CODE]


All times are GMT -8. The time now is 09:20 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.