The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus 1 for Mac (http://forums.omnigroup.com/forumdisplay.php?f=38)
-   -   Some OmniFocus Scripts (http://forums.omnigroup.com/showthread.php?t=3880)

curt.clifton 2007-07-20 03:58 AM

[QUOTE=Keith]The "Add OmniFocus Action" script did nothing for me until I deleted the "on assistiveDevicesSupportEnabled()" by revising it to automatically return a "true" result:

on assistiveDevicesSupportEnabled()
-- check to see if assistive devices is enabled
return true
end assistiveDevicesSupportEnabled

It seems to have been choking on the "set UI_enabled to UI elements enabled" line. Now it works fine. (I already had assistive devices enabled, of course; could it have made a difference that I am running the Finder and all my other programs in Japanese?)[/QUOTE]

Thanks for that report. I suspected that non-English localizations might be affecting that code. It's a bit surprising though, since that code is based on an example provided by Apple.

[QUOTE=Keith]As for the "Open Linked Mail Message" script, it works when I run it from the Script menu or from ScriptEditor, but not when I run it by clicking it in the OmniFocus toolbar. Odd.[/QUOTE]

That is odd. It works fine from the toolbar for me. Have you tried restarting OmniFocus?

Keith 2007-07-22 07:03 PM

[QUOTE=curt.clifton]That is odd. It works fine from the toolbar for me. Have you tried restarting OmniFocus?[/QUOTE]

Thank you, yes, I have tried restarting. Puzzling, the script is running from the toolbar, it just isn't doing anything. When I click the script in the toolbar with nothing selected, I do get the "You must first select a project or action" message, so the script is definitely running. But when I select a project or action and click the toolbar, it doesn't seem to cause Mail to do anything.

A more significant problem (for me, anyway): the script does not recognize which window has the focus. I have three OmniFocus windows open on three monitors, but it seems that the "Open Linked Mail Message" script will only ever work in one window, namely, the first window opened when the program is launched (although if the other two windows are closed, then it becomes possible to run the script in the sole remaining window, even if it was not the first window opened when the program was launched). Even if the foremost window (the window with focus) contains a selected project or action, the script will act only based upon the selection (or lack of any selection) in the window which it believes has the focus, i.e., the first window opened when the program was launched.

In the script I tried changing "tell document window 1" to "tell front document window" but it didn't have any effect.

curt.clifton 2007-07-23 03:04 AM

[QUOTE=Keith]Thank you, yes, I have tried restarting. Puzzling, the script is running from the toolbar, it just isn't doing anything. When I click the script in the toolbar with nothing selected, I do get the "You must first select a project or action" message, so the script is definitely running. But when I select a project or action and click the toolbar, it doesn't seem to cause Mail to do anything.[/QUOTE]

The script is very likely triggering an error, which is swallowed by OmniFocus. To check, follow these steps:

1. When you get a situation where the script appears to do nothing, leave OmniFocus alone so that selections and focus don't change.
2. Open the script in Script Editor and run it from there.
3. Note any errors messages that are displayed.

[QUOTE=Keith]A more significant problem (for me, anyway): the script does not recognize which window has the focus. I have three OmniFocus windows open on three monitors, but it seems that the "Open Linked Mail Message" script will only ever work in one window, namely, the first window opened when the program is launched (although if the other two windows are closed, then it becomes possible to run the script in the sole remaining window, even if it was not the first window opened when the program was launched). Even if the foremost window (the window with focus) contains a selected project or action, the script will act only based upon the selection (or lack of any selection) in the window which it believes has the focus, i.e., the first window opened when the program was launched.

In the script I tried changing "tell document window 1" to "tell front document window" but it didn't have any effect.[/QUOTE]

That sounds like an OF bug. I've reproduced it and reported it.


All times are GMT -8. The time now is 07:50 AM.

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