Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 16, 2005, 12:08 AM   #1
Moof1904
macrumors 6502a
 
Join Date: May 2004
Launch Applescript with Key Command?

I've found an Applescript that seems to do what I need (print a bunch of files from the Finder all at once) but the Applescript (which is saved as an application) must be launched with a keyboard command. The authors technote said to use DragThing or Butler or "your favorite keyboard shortcut utility" to launch the Applescript.

I've looked at these recommended apps (and a few others) and they all seem to do way too much. I don't want any more floating menus or something to take exert influence over my entire UI experience, I just want some teenie utility that will launch my Applescript when I execute a keyboard command.

(BTW, it's absurd, I think, that I can't program a keyboard shortcut in the System Preferences to launch whatever I want.)

Any suggestions on suitable inocuous utility to accomplish this?

(BTW, I'm running 10.3.9.)
Moof1904 is offline   0 Reply With Quote
Old Oct 1, 2007, 02:52 PM   #2
danpritts
macrumors newbie
 
Join Date: Sep 2007
Quote:
Originally Posted by Moof1904 View Post
Any suggestions on suitable inocuous utility to accomplish this?

(BTW, I'm running 10.3.9.)
A really old thread here but i found it while googling for the same question, so perhaps my answer will be useful to someone else.

FastScripts Lite is free and lets you assign up to 10 key combos to applescripts. The non-Lite version costs some money but removes this and some other limits. not too horribly heavyweight (10M rss).
danpritts is offline   0 Reply With Quote
Old Oct 3, 2007, 08:43 PM   #3
HiRez
macrumors 601
 
HiRez's Avatar
 
Join Date: Jan 2004
Location: Western US
Not sure if this is possible, but can you maybe install it as a system service? Some of those have key equivalents and the Services submenu is universally available.
__________________
Go outside, the graphics are amazing!
HiRez is offline   0 Reply With Quote
Old Oct 3, 2007, 10:16 PM   #4
Poeben
macrumors 6502
 
Join Date: Jul 2004
Perhaps what you are looking for is this.
__________________
ćActual post may vary from original thought.
Poeben is offline   0 Reply With Quote
Old Nov 18, 2010, 04:59 PM   #5
daehl
macrumors newbie
 
Join Date: Dec 2009
Quote:
Originally Posted by Moof1904 View Post
I just want some teenie utility that will launch my Applescript when I execute a keyboard command.

(BTW, it's absurd, I think, that I can't program a keyboard shortcut in the System Preferences to launch whatever I want.)

Any suggestions on suitable inocuous utility to accomplish this?
I happened to be looking for this exact same thing today. I came across this thread, and even though a variety of solutions are listed. I've found what I believe to be the answer to the original question:

Use Automator to create a general service that performs an Applescript, then assign a Keyboard shortcut to that service.

Worked for me with Automator 2.1 on Snow Leopard (10.6.5). Here's how I did it.

1. Create a new Automator workflow. Choose a "Service" template.
2. Configure it so that Service received "no input" in "any application". This will ensure that this service is always visible in any application (you might want to limit the service to a specific app, but I won't for this example)
3. Add a "Run AppleScript" object into the workflow.
4. Enter the Applescript you want (In my case I pasted some UI scripting code that I want available at a keypress)
5. Save the Service and name it something descriptive, short, and unique so that it will work as a Keyboard Shortcut.

6. Open the Keyboard Preference and select the "Services" item in the left side of the Keyboard Shortcuts pane.
7. Scroll down to the "General" heading at the bottom of the list on the right side of the Keyboard Shortcuts pane.
8. Find your new Service and activate it (by checking it's checkbox).
9. Assign a keypress shortcut by clicking on rightmost part of that row and pressing the key you want (I chose F1).

Voila! It works.

Now in any application, you can press your shortcut and it will activate the service (and run your Applescript). It's free, and seems a bit faster than using FastScript (which I also tried) because it doesn't have to launch the script and update the Dock.

Hope that helps others who are looking for a similar solution.
I've never been a big fan of Automator (though I've used it a few times for some simple things), but this worked pretty slick in my opinion!

Last edited by daehl; Nov 18, 2010 at 05:15 PM.
daehl is offline   0 Reply With Quote
Old Sep 11, 2012, 09:58 AM   #6
xefned
macrumors newbie
 
Join Date: Mar 2010
worked swimmingly

Quote:
Originally Posted by daehl View Post

...

Hope that helps others who are looking for a similar solution.
I've never been a big fan of Automator (though I've used it a few times for some simple things), but this worked pretty slick in my opinion!
Thanks for the detailed instructions Daehl - I got it up and running in just a couple minutes. And it's going to save me countless hours over this workweek and beyond...
xefned is offline   0 Reply With Quote
Old Sep 12, 2012, 01:09 PM   #7
Mark FX
macrumors member
 
Join Date: Nov 2011
You can set up a keyboard shortcut to your app from the Keyboard pane in system preferences, go to the keyboard shortcut tab, and then the application shortcuts item in the list provided, you can select any app on your system, or enter an app name, and then any key combination to start it.

Regards Mark

Last edited by Mark FX; Sep 12, 2012 at 01:17 PM.
Mark FX is offline   0 Reply With Quote
Old Jun 9, 2013, 06:11 PM   #8
dcool
macrumors newbie
 
Join Date: Jun 2013
I am trying to do exactly what was described for the service shortcut to use F11 and F12 as shortcuts for volume down and volume up code respectively. They appear under the service menus in every application, but do not work. The code worked fine when I ran it in Automator, but the shortcuts for some reason arent working. Any help would be great. Thank you.

OS X Version 10.8.2

Volume Down Code:
set vol to output volume of (get volume settings)
if vol < 10 then # 0 is min
set volume output volume 0
else
set volume output volume (vol - 10)
end if

Volume Up Code:
set vol to output volume of (get volume settings)
if vol > 90 then # 100 max
set volume output volume 100
else
set volume output volume (vol + 10)
end if
dcool is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Help, my Control key maps to my Command key pacman1176 Mac OS X 10.7 Lion 2 Jan 22, 2013 05:37 PM
Very basic Applescript to run command bjbyers Mac Programming 1 Nov 27, 2012 04:03 PM
Can I launch programs via key command? (with caveat) JT3Jon Mac OS X 10.7 Lion 1 Sep 1, 2012 05:38 PM
command key sparkleblue MacBook Pro 4 Aug 13, 2012 03:37 PM
Left Command Key and TrackPad BNHabs MacBook Air 0 Jun 19, 2012 09:15 AM

Forum Jump

All times are GMT -5. The time now is 12:41 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC