AppleScript and Shortcut Problems
  • I'm trying to set up an AppleScript to run with a keyboard shortcut. If I select the item from the scripts menu, it works fine, but it doesn't if I use a keyboard shortcut. The applescript simply runs a Ruby script through the shell. So far I've found two problems:

    -Using a complicated shortcut like cmd-opt-ctrl-shift-\ makes the AppleScript display the dialog "Press Run to run this script, or Quit to quit."

    -Using a more simple shortcut, the Ruby script is opened with an editor rather than being executed.

    I'm wondering why the script would behave differently in these situations. Thanks for your help!
  • Maybe this is a related problem or maybe I'm doing something stupid. I installed FastScripts on my laptop and it worked beautifully. Now I install it on my iMac at the office, put in the same keyboard shortcuts for the same scripts, and nothing happens. I can still trigger the scripts the way I did before via Launchbar, but cannot get FastScripts to react to the keyboard shortcuts at all. Is this a bug or am I missing some key step in the set up?
  • mwean - I believe you have contacted me separately by email so I'll continue to follow up with you through that channel.

    blipman - if the keyboard shortcuts are outright not doing anything, then it makes me wonder if there is something system-wide on your Mac that is preventing FastScripts from being able to install the shortcuts. Also, is it possible that the shortcuts in question are somehow being "overridden" by another app on your Mac that is trying to register the same shortcuts?
  • Yes, you're interpreting correctly that the shortcuts are "outright not doing anything." It occurred to me that I might have some conflict on that computer. I looked at the Keyboard Shortcuts preference pane and didn't see anything. I think I have pretty much the same programs on the two computers, so I'm not sure what app or settings to check. Any suggestions? Thanks!
  • I would be curious to know if, when you look at the system console for this Mac, do you find anything being printed out by FastScripts when you try to press the keyboard shortcuts?


    1. Open /Applications/Utilities/Console
    2. Type "FastScripts" into the search box to filter the output.
    3. Copy/paste the resulting log messages.

    Thank you!
    Daniel
  • I won't be back to that computer till Monday but will check then and let you know. Thanks again.
  • Got back to it sooner than expected. I see nothing at all on the console when I filter for FastScripts. I don't understand Console particularly, so I tried using the keyboard shortcuts with Console open and also with Console closed and then opening to see what it had recorded. Nothing either way. What does this tell me?

    Thanks!
  • I experimented a bit more. I was able to set a keyboard shortcut which worked for one of the Mail Scripts, but still cannot do so for the scripts I was trying to set up. These are scripts for use with Omnifocus which work fine with FastScripts on my Powerbook.

    The Console doesn't show any message when I use the keyboard shortcut to access the Mail Script successfully.

  • Hi - unfortunately it doesn't say much. Can you try using a different keyboard shortcut than what you're trying now? I'd really like to get it nailed down whether this has to do with the shortcuts you're choosing, the scripts, or the target application (OmniFocus).

    You said you had one Mail Script shortcut that worked. If you unset that shortcut on the mail script, and then set it on the OmniFocus script, does it work?

    If the OmniFocus scripts are currently in the Applications/OmniFocus folder (so they only appear when OmniFocus is active), can you experiment with moving one out of there so it's in the main FastScripts menu, and try to assign a shortcut to it? If it doesn't work when OmniFocus is active, does it work when OmniFocus is NOT active?

    Sorry, I know there's a lot of requests here but the fact that the Mail script shortcut is working indicates to me that FastScripts is basically working. I think we have to zero in on why the shortcuts are not working as expected for the scripts in question.

    Daniel
  • One other thing: is it possible that the scripts *are* running, but because you still have keyboard shortcuts held down, this is somehow altering their behavior?

    You might try adding a "delay 1.0" to the beginning of one of the affected script. This will give you time to be sure you've released the keyboard shortcut that fired the script with FastScripts, as a test, to see if that is part of the problem.
  • I appreciate all your suggestions. I'm traveling now but will try these ideas when I get back to the iMac. It could well be an Omnifocus issue or even a keyboard issue. Given how much I like what FastScript has been doing for me on my laptop, I'm eager to sort it out and be able to do likewise on the iMac.

    Thanks!
  • Thanks, let me know what you find out after you get home!
  • Very odd results -- I hope this makes more sense to you than it does to me!

    First, I tried a variety of the Mail and other scripts and had no problems assigning keyboard shortcuts to them. Then I removed these shortcuts and tried using the same ones for Omnifocus without success.

    Next, I followed your suggestion of moving the Omnifocus scripts into /Library/Scripts. Suddenly, the shortcuts work fine! I find this very confusing since I did not need to do this on my laptop.

    Do you think it's safe to assume this has solved the problem or might I run into problems having the scripts outside of Library/Scripts/Applications/Omnifocus?

    (Aside: Given that this seemed to answer the question, I did not try adding the delay you suggested, but please do let me know if I should try that.)

    Thanks again.
  • blipman:

    The downside to moving the scripts out of the "Applications" subfolder is that the shortcuts will be active all the time, and not only when OmniFocus is the active application. But perhaps this is what you want?

    Scripts in the Applications subfolder are meant to be "context-sensitive" to the application they are to be used in.

    Daniel
  • That seems like a small price to pay. But it does puzzle me that the scripts work fine in the Omnifocus folder on one computer but not the other. Is there some setting, either in FastScripts or elsewhere, that might affect this?

    If it's too difficult to sort this out, I'm fine living with this solution, so please don't spend a lot of time thinking about this, but it would be a little nicer to be able to move the scripts back.
  • Two things occur to me as possible differences:

    1. Is it possible the version of OmniFocus on one machine is different from the other?

    2. Is it possible the name of the OmniFocus scripts folder (In ~/Library/Scripts/Applications) is different, e.g. in letter case, one one machine than the other?

    Daniel
  • Both computers have the most recent version of OmniFocus. I'll check if there's a difference in the names of the folders. If there is, it's probably OmniFocus versus Omnifocus. Could that do it? My laptop (where I am now) has the name of the folder as OmniFocus.
  • It does seem possible that the case spelling might have something to do with it! I recommend always using the FastScripts "Create" menu items to make sure the name matches exactly what the application identifies itself as.
  • Mystery solved! I can't believe I made such a bone-headed mistake, but... I changed the name from Omnifocus to OmniFocus, moved the scripts, restarted the computer (didn't work till I did this), and then all worked perfectly. Thanks so much for your help and my apologies for taking up your time with such a silly error.

    One last question: I don't see the "Create" option. How do I get to that?

    Thanks again!
  • It's either "Create" or "Open" depending on whether the folder exists already. It should be under the "FastScripts" submenu at the top of FastScripts's menu.
  • Got it. Thanks again!
Start a New Discussion

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!