The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniOutliner 3 for Mac (http://forums.omnigroup.com/forumdisplay.php?f=9)
-   -   Applescript Automatic Find (http://forums.omnigroup.com/showthread.php?t=7122)

vhikida 2008-02-09 11:56 AM

Applescript Automatic Find
 
Basically the way I want to organize my document is to have some nodes as definition nodes. These would be prefixed by a # (e.g. #xyzzy). There will be other nodes in my outline which refer back to xyzzy. I want to have my cursor on xyzzy and automatically have it take me to #xyzzy. Of course there are many other things I want to do but that is the first step. The following is what I've done so far.

set searchText to "xyz"
tell application "OmniOutliner Professional"
activate
(*set searchText to item of value of cell of selected row of document 1
*)
set searchText to "#" & value of cell 2 of selected row of document 1
end tell

(* set x to "a" & "b" --> "ab"
*)

tell application "System Events"
tell process "OmniOutliner Professional"
click menu item "Find..." of menu 1 of menu item "Find" of menu 1 of menu bar item "Edit" of menu bar 1
delay 1
repeat until exists window "Find"
end repeat
set value of text field 1 of group 1 of window "Find" to searchText
click button "Next" of window "Find"
end tell
end tell


If I have my cursor on xyzzy and run this script from Script Editor, this works as I want. Obviously running from script editor is not saving me any keystrokes. I've attached this script to my omni outliner menu. I think it is failing because as soon as I click on the menu item it loses the fact that I was on xyzzy.

First how do I set a cursor in a cell and then have applescript keep that information when I click on the script in the menu. Second how do I attach a shortcut to the menu item.


Vincent


All times are GMT -8. The time now is 06:19 PM.

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