The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   FAQ: Installing & running an OF applescript (http://forums.omnigroup.com/showthread.php?t=7453)

RobTrew 2008-03-09 01:45 PM

FAQ: Installing & running an OF applescript
 
(This comes up quite often, so it may be worth having a post to refer to whenever it arises)

OF applescripts can be run from the OF toolbar, from the OF Script menu, or from tools like [URL="http://www.obdev.at/products/launchbar/index.html"]LaunchBar[/URL], [URL="http://www.keyboardmaestro.com/main/"]Keyboard Maestro[/URL], or [URL="http://www.red-sweater.com/fastscripts/"]FastScripts[/URL].

[I]Since [B]OmniFocus 1.8[/B] it has been possible to use AppleScript applications as toolbar items (in addition to Automator workflows, and scripts stored in text, compiled, and script bundle format).[/I]

[I]To install an applescript to be run from the OF Scripts menu:[/I][LIST=1][*][B]Check that the Script menu icon appears on the OS X menu bar[/B]
If it doesn't:[LIST][*]OS X 10.6:
Run the Applescript Editor from the Utilities folder within the Application folder, and ensure that the following settings are checked:
Applescript Editor > Preferences > General > Show script menu in menu bar
Applescript Editor > Preferences > General > Show computer scripts[*]OS X 10.5:
Run the Applescript Utility from the Applescript folder within the Applications folder, and ensure that "Show Script menu in menu bar" is checked[/LIST][*][B]Place the script in the appropriate folder[/B][LIST][*]Start OmniFocus[*]Click the Script menu icon in the OS X menu bar[*]Choose Open Scripts Folder/Open OmniFocus Scripts Folder[*]Copy your script into the OmniFocus scripts folder, which should now have opened.[/LIST][*]When OmniFocus is running, your script can now be run from the [B]OmniFocus scripts[/B] section of the Script menu.[/LIST]

[I]To install an applescript to be run from the OF toolbar:[/I]
[LIST=1][*][B]Place the applescript in the OF scripts folder[/B][LIST][*](see previous section)[/LIST][*][B]Optionally choose an icon for the script[/B][LIST][*]Select the .scpt file in the Finder[*]Choose [I]File > Get Info[/I] in the Finder menu (or Cmd I)[*]Select the icon in the dialog
[IMG]http://farm5.static.flickr.com/4130/4996097640_a88ba8313e_o.jpg[/IMG][*]Copy a simple image into the clipboard from any graphic source[*]Past the image onto the icon in the file Info dialogue.
[IMG]http://farm5.static.flickr.com/4126/4996160624_97015e2159_o.jpg[/IMG][/LIST][*][B]Get the applescript onto the OF toolbar[/B]

In OmniFocus, choose [B]View>Customize_Toolbar[/B].

The dialog which appears will now enable you to drag your applescript onto the OF toolbar.

Close the dialog, and experiment with running your applescript by clicking its icon in the toolbar.
[/LIST]

librarymonkey27 2008-03-11 06:40 PM

finding folder
 
A way to find the folder for me is to go up to the script icon in the top menubar

pull it down to a folder (do not highlight a file)


For example: I pull down to the 'applications' folder, slide over to the 'OmniFocus' folder

at that point I let go of the mouse and the folder opens

if there wasn't an OmniFocus folder I would let go on applications and then (as you indicated) create one.

this is a great idea ---- an applescript FAQ

RobTrew 2008-03-12 03:03 AM

[QUOTE=librarymonkey27;34343]A way to find the folder for me is to go up to the script icon in the top menubar[/QUOTE]

Yes, me too - I didn't choose that route for the FAQ because the [B]Show script menu in menu bar[/B] option will sometimes be un-checked in the Applescript Utility.

librarymonkey27 2008-03-12 12:39 PM

In that case, People should go and click that button, if only to have easy access to scripts

RobTrew 2008-03-12 01:29 PM

Yes - FAQ amended accordingly.

JohnJ80 2008-04-14 07:48 AM

Can't make this work.
 
I'm doing something wrong here. I've got my script in the finder scripts menu (no problem). I open the Customize toolbar window as described, but I can't drag any script onto it. I can't drag anything onto . All I can do is access the icons that are there.

What I'm trying to do is put the most excellent "Reveal" Applescript onto the toolbar.

J.

Brian 2008-04-14 11:19 AM

You shouldn't need to drag anything to the customize sheet. If the applescript has been installed into the correct folder, you should see the icon in the sheet.

What you want to do is drag the icon for the script [B]from[/B] the sheet and [B]to[/B] your OmniFocus toolbar.

JohnJ80 2008-04-14 11:44 AM

[QUOTE=Brian;35715]You shouldn't need to drag anything to the customize sheet. If the applescript has been installed into the correct folder, you should see the icon in the sheet.

What you want to do is drag the icon for the script [B]from[/B] the sheet and [B]to[/B] your OmniFocus toolbar.[/QUOTE]

Is there an explicit name for the folder or something? I've named the folders simply "OmniFocus" and that is how it appears in the finder script menu.

The folder's path is Users->john(me)->Library->Scripts->Omnifocus

Is that correct?

J>

RobTrew 2008-04-14 01:18 PM

[QUOTE=JohnJ80;35719]The folder's path is Users->john(me)->Library->Scripts->Omnifocus[/QUOTE]

Users->john(me)->Library->Scripts->[B]Applications[/B]->Omnifocus

i.e.

~/Library/Scripts/Applications/Omnifocus/

(which can be pasted into the Finder's [B]Go>Go_to_Folder[/B] dialog)

JohnJ80 2008-04-14 04:42 PM

Work now. Folder is important.

J.

iNik 2008-06-19 07:15 PM

I cannot help but point people to my favorite little Applescript utility: FastScripts ([url]www.red-sweater.com[/url]) and it's free sibling, FastScripts Lite. Both exceed the AppleScript Utility's script menu in a variety of ways, and both let you assign keyboard shortcuts to scripts.

bpwhistler 2009-08-19 07:50 AM

I have the script icon in my menubar...but when I drill down through it, it doesn't show an Applications folder. When I go to my scripts folder in finder, it shows: Applications, DEVONthink, Personal, myscript.scpt

In the menubar drop down...it shows DEVONthink, Personal, and myscript

How do I get Applications to show up? I ran the AppleScript Utility and played with all the preferences with no success.

lbergren 2009-11-18 04:03 PM

I have the same question as bpwhistler.

I'm a recent Mac/iPhone convert who just bought OmniFocus a few days ago. I got all the MobileMe stuff working. I've done a massive brain dump into the OF Inbox, assigned everything to Projects and Contexts, and got everything syncing just like it ought to. So far, so good.

But there's more and more and more to dump (I've been waiting 25 years for this, after all). So I got reQall, which is an ideal capture tool for me. I love it. Now all I want to do is (A) get the OF email rule working, and (B) understand the AppleScript process.

As a PC user, I knew how to write a script and what to do with it. As a Mac user, I'm a complete scripting noob all over again and having a hard time figuring out where to start. When I read a thread like this, it all makes perfect theoretical sense, but then (like the previous poster) I go looking for the Applications folder and... it's not there.

Any recommendations for a straightforward, easy to wrap your head around, nuts and bolts, AppleScript tutorial geared toward to new OF users?

'Cuz I'm not, um... getting things done. ;-)

Thanks!

RobTrew 2009-11-20 02:13 AM

[QUOTE=lbergren;69903](like the previous poster) I go looking for the Applications folder[/QUOTE]

In order to ... ?

lbergren 2009-11-20 09:55 AM

[QUOTE=RobTrew;69959]In order to ... ?[/QUOTE]

... get to the OmniForum Scripts folder (presumably). Of course, that may or may not make any sense, so here's the backstory.

I'm in this specific thread because I want to understand how and where to install OmniFocus scripts. As a new Mac user, I'm also new to AppleScript (scripting itself is not new to me, but all my experience is in Windows environments). I am also a new OmniFocus user (LOVE it!). Since I use reQall's voice to text service for keeping track of all the stuff I think of when it's better to talk than type, I thought an ideal way to start getting my arms around AppleScript generally would be to figure out how to get my reQall voice transcripts to forward themselves to OmniFocus, and automatically put themselves in the right Projects and Contexts.

I was delighted to find your very clear instructions for installing OmniFocus scripts at the top of this thread. So far, so good. Here's what I did:[INDENT]
1. Following the directions in your OP, I checked to see whether the scripts icon was visible in my menu bar (it was). But when I selected "Open Scripts Folder," the list of options included only these three folders: Safari Scripts, User Scripts, and Computer Scripts. There was no OmniFocus Scripts option to select. So I read on...

2. The first reply to your OP, as well as some of the other replies, led me to think that the Omnifocus Scripts folder is actually in an "Applications" folder somewhere under the script icon. I assume this is the folder that the poster in the reply prior to mine was looking for without success. Like him/her, I didn't have one, either.

3. Since I couldn't figure it out, I left my own reply.[/INDENT]
One problem for new Mac users who come from the PC universe as geeky, successful do-it-yourself, script writing, power users is that we don't have a feel for what the Mac scripting landscape is "supposed to" look like. As a result, troubleshooting is inefficient, because we don't know how to tell whether something is missing, installed in the wrong place, or just invisible. To use the current issue as an example, I have no way of knowing whether there should or should not be an "Applications" folder somewhere under my script icon... all I know is that (A) there ISN'T one, and that (B) this may (or may not) be a problem.

The corollary problem is that when something DOES work, it's hard for us to be certain WHY and HOW it works so that we can apply the principles to other situations going forward.

Again, using my current issue as an example, I found a test reQall voice message from early yesterday in my Omnifocus Inbox this morning, which indicates that at least the forwarding portion of my "Send to Omnifocus" Rule is/was working, even though I have no idea what (if anything) the Rule is doing with regard to the "Run AppleScript" instruction. Meanwhile, a subsequent test message from last night has NOT appeared in Omnifocus... yet... although it showed up in the Mail inbox on my Mac and iPhone about 12 hours ago. Between the first and second tests, I changed the Omnifocus Mail Preferences by selecting the Archiving option. So....

Besides determining how and where to install the Omnifocus AppleScript since I can't find an OmniFocus folder under my scripts icon (I'm assuming that it did not install itself when I activated the Mail rule), I also need to figure out whether (A) the Rule is not working at all anymore, (B) the Rule needs the AppleScript installed (even for forwarding reQall email to the OmniFocus Inbox without Project/Context assignments); (C) there's a syncing issue with Omnifocus, (D) there's a syncing issue with my Mac/iPhone/MobileMe, (E) I'd have better results with Jott, (F) there's some other issue, or (G) all or some of the above.

Obviously only the AppleScript installation part of that set of questions is on topic in this thread - so if someone can shed some light on why I don't have an OmniFocus Scripts folder (and how to get one) I'd appreciate it. Once I get that figured out, I'll see if it resolves the other questions and ask them elsewhere if it doesn't.

Meanwhile, as stated in my previous post, it would be so helpful if anyone could recommend any good, general AppleScript learning resources for former PC geeks who want to get up to speed fairly quickly on the basics, in order to develop reasonably efficient troubleshooting methodologies.

Which would, in turn, enable people like me to ask better questions when we get here... :D

Thanks,
Laurie

[I]System Info: MacBookPro (OS X version 10.5.8), iPhone 3Gs, MobileMe, OmniFocus 1.7.5 [/I]

whpalmer4 2009-11-20 01:57 PM

The Applications folder in question lives in ~/Library/Scripts (~ being Unix shorthand for the name of your home directory). If in the Finder, you use the Go->Go To Folder... command and enter ~/Library/Scripts/Applications, you'll end up in the right place, if the Applications folder exists. To create the Applications folder, the easiest way is to use the Applescript Utility program found in /Applications/Applescript. Click the option to show the Script menu in the menu bar. Now, start up the application for which you want to install a script, and select Open Scripts Folder -> Open <app> Folder from the menu bar Scripts menu. That will create the folder if it doesn't already exist. Put your script in that folder and you're all set. I think the problem was that you didn't have OmniFocus as the frontmost application when you went to the Scripts menu.

So, to sum up, there is an Applications folder in the ~/Library/Scripts folder, and it has folders for however many applications you have scripts for. It doesn't appear as "Applications" in the scripts menu, but its contents are (selectively) shown in the menu. If you follow Rob's instructions exactly, it works, but seemingly insignificant deviations can lead to frustration, as you've found.

lbergren 2009-11-21 11:28 AM

[DUH] Ohhhhh, it's context sensitive! [/DUH] :rolleyes:

My scripts icon was already in the menu bar, so all I had to do was make OmniFocus active before I clicked the scripts icon. Voila! OF Scripts Folder, right where it was supposed to be.

It all makes perfect sense... now. :o

Thanks so much - you did a great job figuring out what I was missing!

Laurie

whpalmer4 2009-11-21 12:01 PM

It was a learning experience for both of us! I've always just made the various directories by hand, and only after I wrote up the procedure and went to test it did I happen to notice that Rob's directions would do it automatically. At that point, it was easy to realize what must have gone wrong for you, because I'd been doing it all along :)

malisa 2010-08-22 07:47 AM

This should be stickied!

Thanks.

Oogiem 2010-09-04 05:40 AM

[QUOTE=RobTrew;34246]([*]Choose Open Scripts Folder/Open Omnifocus Scripts Folder
[/QUOTE]

I was following along until this... There is no Omnifocus Scripts Folder when I do an Open Scripts Folder on my system.

Do I need to create the folder first? If so, where? In user scripts or computer scripts?

whpalmer4 2010-09-04 06:57 AM

[QUOTE=Oogiem;84890]I was following along until this... There is no Omnifocus Scripts Folder when I do an Open Scripts Folder on my system.

Do I need to create the folder first? If so, where? In user scripts or computer scripts?[/QUOTE]

You have to follow the instructions [B]exactly[/B] which includes being in the right application when you do some things that would appear to work in any application :)

If you are in OmniFocus as the frontmost application (menu bar will say OmniFocus, not Finder or Safari or whatever), then when you do the Open Scripts Folder from the Scripts menu, it will create that folder for you automatically if it did not exist.

Oogiem 2010-09-04 08:08 AM

OK got the folder opened but got stuck with errors in the script. Can't save it to put the resulting file into that folder

Getting frustrated here

RobTrew 2010-09-04 08:15 AM

[QUOTE=Oogiem;84895]OK got the folder opened but got stuck with errors in the script. Can't save it to put the resulting file into that folder

Getting frustrated here[/QUOTE]

Sounds like either part of the script is missing or has new lines in the wrong place (a problem arising in pasting it into the editor), or it is for OF 1.8 and it is being run on an earlier version.

Best to separate issues of installation from those of script correctness, so lets continue this from your thread in the main OmniFocus forum.

RobTrew 2010-09-16 06:35 AM

Added a section to the FAQ (first post in this thread) on choosing an icon for a script.

schakwin 2011-01-20 06:32 PM

Rob -
This is super. It worked perfectly and made OO as perfectly usable as I needed it to be! My aging eyes thank you.

Stephen

RobTrew 2011-01-20 11:36 PM

[QUOTE=schakwin;92019]Rob -
This is super. It worked perfectly and made OO as perfectly usable as I needed it to be! My aging eyes thank you.

Stephen[/QUOTE]

The OmniOutliner [URL="http://forums.omnigroup.com/showthread.php?t=16554"]font size toggle script[/URL] ?

Good :-)

(My eyes need it too)

SpiralOcean 2011-10-09 06:21 PM

Here's a script that will move a selected file to the OmniFocus script folder:

Mdrudy 2012-02-04 11:08 AM

Still can't figure out AppleScripts
 
I've read thru this thread and tried all the suggestions, but i still can't get it to work. I am very new to Mac but pretty familiar with PC....maybe that's my problem.

Anyway, i keep getting this error: error "File Untitled:Users:Mike:Library:Scripts:Applications:OmniFocus wasn’t found." number -43 from "Untitled:Users:Mike:Library:Scripts:Applications:OmniFocus"

I've looked and looked and i do NOT have the same file structure as what's listed above so i can't create the new folder. I am running Lion 10.7.3 ...... do the scripts and folder hierarchy the same on Lion as others?

Please help...thanks in advance.

UPDATE: I think i figured it out but not sure how really....thanks.

SpiralOcean 2012-02-04 11:42 AM

1 Attachment(s)
If you've never put a script in that folder the folder doesn't exist yet.

Modified the script to create the folder before trying to put a file in it.

RobTrew 2012-02-06 01:10 AM

[QUOTE=Mdrudy;107008]I've looked and looked and i do NOT have the same file structure as what's listed above so i can't create the new folder. I am running Lion 10.7.3 ...... [/QUOTE]

I wonder if Apple's eccentric (and frankly rather unhelpful) decision to hide the user's library folder [B](~/Library)[/B] in Lion is causing grief here.

The way to fix this 'helpful' cosmetic change is to open Terminal.app and enter the line:
[INDENT][I]chflags nohidden ~/Library [/I][/INDENT]
There is more discussion in a Tidbits article [URL="http://tidbits.com/article/12306"]here[/URL].

[COLOR="White"]--[/COLOR]

hydrostarr 2012-09-05 06:03 PM

Runnging MacOS 10.6.8, OF 1.10.3.

Followed directions in initial post (on this thread) as precisely as I could, no 'Scripts' menu appears in OF (if that's what's supposed to happen...?) even after MacOS reboot. Customized Toolbar: can't find a way to make this work.

I've also put a script ( Clear Dates.scpt from bylr.net -- can't post the url 'cause I'm a new forums.omnigroups.com registrant ) into into ~/Library/Application Support/OmniFocus/Scripts (which the documentation post doesn't mention), still not working (also after reboot).

Frustrating. Experienced Linux & MacOS server sysadmin + software developer here. Not a "newbie" user. Why is this so hard?

whpalmer4 2012-09-05 07:24 PM

The instructions work. You do have to follow them exactly, and one easy way to screw up is by switching applications before the Open Scripts Folder step — it opens (and creates, if necessary) a folder specific to the active application when the menu is invoked, so if you've switched to the Finder, for example, you won't get the OmniFocus folder created.

The Scripts menu is not a menu with the label "Scripts" on it — rather, it looks like a little partly unrolled scroll:

[URL=http://imageshack.us/photo/my-images/59/screenshot20120905at807.png/][IMG]http://img59.imageshack.us/img59/8075/screenshot20120905at807.png[/IMG][/URL]

It does not appear with the application's menus, but over on the right side of your menu bar. Open Applescript Editor, open the preferences, and click on the checkbox for Show Script menu in menu bar repeatedly while watching the menu bar. You'll see it appear and disappear. Once it has appeared, launch OmniFocus. While in OmniFocus, go to the Script menu and select Open Scripts Folder > Open OmniFocus Scripts Folder. This will create your scripts folder for OmniFocus in the correct place. The correct place for 10.6.8 is not the path you mentioned, btw, but rather ~/Library/Scripts/Applications/OmniFocus.

No need for rebooting to get any of this to work.

malisa 2013-05-18 06:31 AM

Can I assign a keyboard shortcut to a script? If so, how?

RobTrew 2013-05-18 11:36 PM

I would use KeyBoard Maestro or Fastscripts.

(The latter is free for up to 10 keystroke assignments)

Either the forum software has a glitch this morning, or my account permissions have been reset – I am no longer allowed to add hyperlinks – but you should be able to find both quickly enough.


All times are GMT -8. The time now is 03:22 AM.

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