Accessing Application menus for my own shortcuts

General discussions about LaunchBar
SpiralOcean
Posts: 19
Joined: Mon Nov 13, 2006 1:13 am

Accessing Application menus for my own shortcuts

Post by SpiralOcean » Sun Dec 31, 2006 8:09 pm

Hoping that LB will allow menu access of applications in the future.

Example:
I'm in Mail
open launchbar
type gm
the menu mailbox->get new mail
is selected

This is just an example. I would want to use it for other more complex applications. I already use the Applescript for get new mail which I love!

I found this article
http://theappleblog.com/2006/11/01/quic ... menus-too/

That has quicksilver doing it. So tried out QS... again... and am again using LB. There are too many freakin' steps in QS to do anything. Maybe I haven't figured it out as well as LB. I think LB is much more intuitive.

One of the problems with the QS menu access is you can't go backwards in the menu to select something else.

egrieco
Rank 1
Rank 1
Posts: 27
Joined: Sun Jul 22, 2007 5:29 pm
Location: Arizona

RE: Accessing Application menus for my own shortcuts

Post by egrieco » Wed Sep 26, 2007 7:14 pm

I would love to see Application menu traversal in LanuchBar. This is probably the single biggest feature that I would like to see in the next version.

dblatner
Posts: 4
Joined: Tue Nov 18, 2008 7:07 pm

Re: RE: Accessing Application menus for my own shortcuts

Post by dblatner » Tue Nov 18, 2008 7:28 pm

egrieco wrote:I would love to see Application menu traversal in LanuchBar.



Totally agree. This is the only major shortcoming I've encountered in switching from QuickSilver to LB.

egrieco
Rank 1
Rank 1
Posts: 27
Joined: Sun Jul 22, 2007 5:29 pm
Location: Arizona

Re: Accessing Application menus for my own shortcuts

Post by egrieco » Thu Oct 22, 2009 8:29 pm

This was originally posted in December 2006. I posted in September 2007, two years ago. Any progress here?

In my opinion, menu traversal is still the biggest feature that LaunchBar is lacking.

iRounak
Rank 4
Rank 4
Posts: 191
Joined: Fri Oct 23, 2009 7:11 pm
Contact:

Re: Accessing Application menus for my own shortcuts

Post by iRounak » Tue Oct 27, 2009 7:20 pm

This was originally posted in December 2006. I posted in September 2007, two years ago. Any progress here?
In my opinion, menu traversal is still the biggest feature that LaunchBar is lacking.

If you are really desperate, then see this:
viewtopic.php?f=24&t=3403

egrieco
Rank 1
Rank 1
Posts: 27
Joined: Sun Jul 22, 2007 5:29 pm
Location: Arizona

Re: Accessing Application menus for my own shortcuts

Post by egrieco » Wed Oct 28, 2009 8:29 pm

iRounak wrote:If you are really desperate, then see this:
viewtopic.php?f=24&t=3403

I took a look at the other thread.

iRounak wrote:I have just switched from Quicksilver. Personally, I never felt the need of that feature in Quicksilver because you always tend to know the keyboard shortcuts of menu items of the applications you use frequently. However, your needs may differ than mine.

Yes, it's true that I tend to memorize the keybindings of frequently used commands. However many commands do not have keybindings and are used just infrequently enough that it's not worth the time to go and assign a keybinding which will be forgotten anyway. This is where the power of LaunchBar's abbreviation search truly shines.

iRounak wrote:How to use:

1. bring up script 1 in LaunchBar
2. press return (or do instant send by holding the abbreviation)
3. press right arrow key
you will then be able to search menu items just like you did in Quicksilver
4. press tab and run script 2 applescript which will execute the action of those menu items

or it could be done be like this:

1. bring up the text file from the temporary folder which is same as the name of the application that you are using
2. press right arrow key to browse its lines which are menu items
3. press tab
4. run script 2 to execute the action of the menu item

Remember:
For every application, when you run the script for the first time, it will take a lot of time. That will happen only one time for each application and never ever again. From the second time, it will be instantaneous.

That seems like a lot more trouble than the usual "command-space -> abbreviation -> return". One of the main reasons I use LaunchBar is to reduce mousing and keystrokes. Thus any implementation of menu traversal should also strive to use the fewest steps/keystrokes possible.

iRounak wrote:There is still a lot of scope for improvement in this script.

Yes and no. I think this is something that LaunchBar should support natively or through a robust plugin API.

P.S. I'm surprised no one has chimed in with the help menu search in 10.5. Although that is not a great solution anyway since it is substring search, not abbreviation based. Also, it does not remember which command you select most as LaunchBar does.

iRounak
Rank 4
Rank 4
Posts: 191
Joined: Fri Oct 23, 2009 7:11 pm
Contact:

Re: Accessing Application menus for my own shortcuts

Post by iRounak » Thu Oct 29, 2009 4:38 am

As I said, I have never used this feature in Quicksilver but you had to do something this:
1. Current Application
2. tab
3. Show Menu items
4. return
you get list of menu names
5. press "/" or right arrow for seeing contents of each menu
6. swith back and forth with "/" and shift+"/" to see contents of other menu of the same application

Whereas, in the script that i wrote, you have to
1.directly bring the text file generated by script 1 by assigning it an abbreviation.
2.press right arrow
3. select any menu item of any menu
4. press tab
5. hold an abbreviation to execute it

I had Quicksilver in mind while trying to write a workaround not LaunchBar.

I think this is something that LaunchBar should support natively or through a robust plugin API.

You have been waiting for years. You can continue waiting.
Or you can think over how to speed up the applescript. For example, using a trigger (via some other application) to run an applescript to directly save you from doing this:

1. bring up the text file in lb by writing an applescript like tell app lb, set selection to (path to text file as alias)
--the name of the text file (and hence its path) need not be hardcoded, you can use this
tell application "System Events"
set {name:theApp, bundle identifier:theIdentifier} to (get 1st application process whose frontmost is true)
end tell
where theApp willl be the name of Current application.


2. pressing the right arrow or whatever to browse the contents of the text file (by using UI scripting)

Then assign a trigger to a second applescript which takes selection from LaunchBar (LB dictionary has this feature) and executes the Script 2.
If you do this, all you will have to do is:
1. run the trigger
2. start selecting the menu item
3. run the second trigger
which is closest to "command-space -> abbreviation -> return"

Remember a workaround is a workaround, not a solution.

iRounak
Rank 4
Rank 4
Posts: 191
Joined: Fri Oct 23, 2009 7:11 pm
Contact:

Re: Accessing Application menus for my own shortcuts

Post by iRounak » Thu Oct 29, 2009 7:04 am

if you this Script 1 instead of earlier Script 1, you will have to do this:
activate launchbar
hold abbreviation for script 1
select the menu item
tab
hold abbreviation for Script 2

Code: Select all

try
   tell application "LaunchBar" to hide
   tell application "System Events"
      set {name:theApp, bundle identifier:theIdentifier} to (get 1st application process whose frontmost is true)
   end tell
   set ifolder to "path:to:Library:Application Support:LaunchBar:Actions:Temporary:"
   
   set ifile to ifolder & theApp & ".txt"
   set qifile to quoted form of (POSIX path of ifile)
   set flag to false
   try
      set flag to alias ifile
      set thecmd to do shell script "cat " & qifile
      
      tell application "LaunchBar"
         
         set selection as text to thecmd
         activate
         tell application "System Events"
            tell process "LaunchBar"
               keystroke space
            end tell
         end tell
         
         (*
tell application "System Events"
            delay 2
            tell process "LaunchBar"
               key code (ASCII character 124)
               keystroke "l" using {"control down"}
            end tell
         end tell
*)
      end tell
      
   end try
   if flag is not false then return
   tell application theApp
      tell application "System Events"
         tell process theApp
            set thecount to count of every menu bar item of menu bar 1
            
            
            
            set thelist to {}
            
            set thedisplaylist to {}
            tell menu bar 1
               repeat with i from 3 to thecount
                  
                  set x to name of menu i
                  set x to x as text
                  tell menu x
                     
                     try
                        set thec to count of every UI element
                        repeat with i from 1 to thec
                           try
                              set themenuitem to name of UI element i as text
                              if themenuitem is not "" then
                                 set end of thelist to x & "," & themenuitem
                                 set end of thedisplaylist to themenuitem
                              end if
                           end try
                        end repeat
                        
                     end try
                     
                     
                  end tell
               end repeat
            end tell
         end tell
      end tell
   end tell
   
   --set thelist to thelist as text
   set thelist2 to {}
   repeat with aitem in thelist
      
      
      set aitem to return & aitem as text
      
      set end of thelist2 to aitem
   end repeat
   
   
   set qthelist2 to quote & thelist2 & quote
   do shell script "echo " & qthelist2 & " >> " & qifile
   
   tell application "LaunchBar"
      set thecmd to do shell script "cat " & qifile
      set selection as text to thecmd
      activate
      tell application "System Events"
         tell process "LaunchBar"
            keystroke space
         end tell
      end tell
end tell
on error e
   tell me to activate
   display dialog e
end try

iRounak
Rank 4
Rank 4
Posts: 191
Joined: Fri Oct 23, 2009 7:11 pm
Contact:

Re: Accessing Application menus for my own shortcuts

Post by iRounak » Thu Oct 29, 2009 8:15 am

I would like to know if you think that this can be done with lesser steps when it is integrated in LaunchBar than the updated Script 1 above and Script 2 posted earlier. Because it is easy to say that you want:
"command-space -> abbreviation -> return".
But think about it: what exactly will the abbreviation be for? Do you expect LaunchBar to dynamically change the item requested by the abbreviation depending on your current application? You don't even know the name of menu items which you use infrequently or those which are unique to an application.
Tell me only about the number of steps. Other things like ranking frequently used items can be added later in the applescript. Also, instead of the text file "property" function of applescript can be used with different property for each application.

aristidesfl
Rank 3
Rank 3
Posts: 120
Joined: Sat Feb 27, 2010 12:54 am

Re: Accessing Application menus for my own shortcuts

Post by aristidesfl » Sat Sep 25, 2010 11:01 pm

+1

Please add this feature !!!

aristidesfl
Rank 3
Rank 3
Posts: 120
Joined: Sat Feb 27, 2010 12:54 am

Re: Accessing Application menus for my own shortcuts

Post by aristidesfl » Sat Sep 25, 2010 11:06 pm

iRounak any way of hiding the disabled menu items?
BTW, great job with the script! Thank you a lot!

aristidesfl
Rank 3
Rank 3
Posts: 120
Joined: Sat Feb 27, 2010 12:54 am

Re: Accessing Application menus for my own shortcuts

Post by aristidesfl » Sat Sep 25, 2010 11:12 pm

If you replace the path in your script with:

Code: Select all

set ifolder to {path to home folder as string, "Library:Application Support:LaunchBar:Actions:Temporary:"} as string


The users wont need to edit the script and it will work if you have the actions synced between different accounts

aristidesfl
Rank 3
Rank 3
Posts: 120
Joined: Sat Feb 27, 2010 12:54 am

Re: Accessing Application menus for my own shortcuts

Post by aristidesfl » Wed May 30, 2012 11:19 pm

I've been using the help menu's search functionality with great success with the bonus of the nice menu animation.
You just have to assign a shortcut (like shift+lauchbar shortcut) to "Show help menu" in the keyboard system preferences.

The shortcomings however are:
1. It's currently impossible to access the search functionality via keyboard shortcut using Lion fullscreen applications.
2. The topmost result isn't selected by default, so you have to press down before pressing return in order to select the result.



Report this to apple

If you want to see this issues fixed, help by submitting feedbacks to apple (http://www.apple.com/feedback/macosx.html) and creating a bug reports (http://bugreport.apple.com/) with the following texts.

Issue 1

"Show help menu" action not accessible while in fullscreen mode

Summary:
It's currently impossible to access the search functionality via keyboard shortcut while using fullscreen applications.

Steps to Reproduce:
1. Be in a fullscreen application.
2. Invoke "Show help menu" using a keyboard shortcut.

Expected Results:
The Menubar should appear and the focus should be set in the help menu's search field.

Actual Results:
Nothing happens

Related with problem ID: 11559398



Issue 2

Help menu search - topmost result should be selected by default

Summary:
Unlike Spotlight search, when searching using the Help menu the topmost result isn't selected by default, and pressing return does nothing.

Steps to Reproduce:
- Search something in the help menu.
- Press return

Expected Results:
- Topmost result should be accepted

Actual Results:
- Nothing happens

Related with Problem ID: 11559767

s.newave
Posts: 9
Joined: Tue Jun 16, 2009 7:56 am

Re: Accessing Application menus for my own shortcuts

Post by s.newave » Fri Mar 11, 2016 9:14 am

Any chance this feature has been rolled into an Action?

Has anyone come across an Action that does something similar?

jordi
Posts: 13
Joined: Thu Feb 19, 2009 6:43 pm

Re: Accessing Application menus for my own shortcuts

Post by jordi » Mon Mar 21, 2016 9:03 pm

I've "ported" an Alfred workflow: http://www.packal.org/workflow/menu-bar-search. So totally not my work and for my personal use only. I binded the action to a keyboard shortcut using Keyboard Maestro, but it would work without one too. It took a while to port to Launchbar but works quite well. I could ask the original creator whether I could share the action, but in any case don't have the time to support it.

Screen Shot 2016-03-21 at 20.00.46.png

Post Reply