AutoHotkey Community

It is currently May 27th, 2012, 7:39 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Quick Toolbar
PostPosted: August 31st, 2006, 11:06 pm 
Offline

Joined: January 1st, 2006, 6:26 pm
Posts: 55
[updated with new version & screenshot at the bottom]

This is a script that will create a small toolbar with 3 rows (or more if you need) of buttons right where your mouse is and each of the buttons can be configured to send a shortcut to the app you need.

Before I post the code I want to clarify the reason for this script's existence. Imagine that you use a program like Photoshop or Autocad that have dozens of commands that you use often and at the same time is very mouse-heavy. You can use keyboard shortcuts along with the mouse, but coordinating them together for a long stretches of time can be tiring. Most people will often use the in-program toolbars to run common commands. The only trouble with that is - the toolbar is fairly far off from the mouse cursor and sometimes performing one action in the program will involve pressing a toolbar button, clicking in the middle of window somewhere, pressing another button, clicking in another spot in the middle of window, repeat a few times, etc etc.

This script is meant to cut down on the time it takes you to go to the toolbar - it will put the toolbar right where the cursor is, and it will disappear when you click one of the buttons. In other words, the work cycle will look like: click middle button (for example), click on a button that is a few pixels away, click in the program again, click middle button and then another button that is a few pixels away, etc.

The added benefit is that the buttons will always be in the same relation to location of cursor, therefore you will memorize the location; as opposed to toolbar buttons which are always in a different location relative to the cursor (because cursor is always in a different spot).

The setup of the script involves placing some buttons using SmartGui in a window, then editing the script and setting up keyboard shortcuts for each button, then setting up the program to perform corresponding actions on these shortcuts (well actually this is best done as a first step), then you set up these buttons to activate your program and send it the keyboard shortcut.

This takes some work but well worth it I think if you use any program of this sort for a few hours each day.

The last step is to set up another script that always runs and that will bind middle button (or something else) to launch this program.

My example script will create about a dozen buttons for use with Autocad. You can use it as an example to set up other programs, too.

Please let me know if you think this is a good idea.. I only wrote this today and I haven't used it in action yet. I will refine it and post updates as I work on it. I also would like some feedback on the code itself, I'm very much an ahk newb and I bet I did some things stupidly. Let me know.

Autocad Quick Toolbar:

Shown as it would appear around the cursor, with autocad drawing underneath.

Image

Download:
http://www.silmarill.org/acad2.ahk

_________________
-AK


Last edited by Rainy-Day on September 12th, 2006, 7:52 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 1st, 2006, 7:49 am 
Offline

Joined: August 8th, 2006, 3:55 pm
Posts: 49
Quote:
I also would like some feedback on the code itself
Some lines shorter:
Code:
SetTitleMatchMode, 2
gosub init
Gui, +AlwaysOnTop +ToolWindow -Caption
Gui, Font, S7 CDefault, Verdana
Gui, Add, Button, x6 y40 w30 h20 +BackgroundTrans +Buttons gaction, Line
Gui, Add, Button, x6 y0 w30 h20 gaction, Mv
Gui, Add, Button, x36 y0 w20 h20 gaction, Cp
Gui, Add, Button, x56 y0 w30 h20 gaction, Del
Gui, Add, Button, x86 y0 w40 h20 gaction, Mirror
Gui, Add, Button, x126 y0 w40 h20 gaction, Rotate
Gui, Add, Button, x6 y20 w50 h20 gaction, Stretch
Gui, Add, Button, x56 y20 w30 h20 gaction, Trim
Gui, Add, Button, x86 y20 w50 h20 gaction, Extend
Gui, Add, Button, x36 y40 w40 h20 gaction, Leader
Gui, Add, Button, x136 y20 w40 h20 gaction, Undo
Gui, Add, Button, x76 y40 w60 h20 gaction, Dimension
Gui, Add, Button, x136 y40 w40 h20 gaction, Osnap
Gui, Add, Button, x46 y60 w50 h20 gaction, TextEd
Gui, Add, Button, x96 y60 w30 h20 gaction, Pan
; Generated using SmartGUI Creator 4.0
CoordMode, Mouse, Screen
MouseGetPos, x, y
x := x-90
y := y-30
Gui, Show, x%x% y%y% h82 w178, Acadkey
Return

GuiClose:
 ExitApp

action:
 WinActivate, CAD 200
 WinWait, CAD 200
 send % %a_guicontrol%
 ExitApp

init:
 Line      = ^+{F5}
 Mv        = ^+h
 Cp        = ^+g
 Del       = ^+{F9}
 Mirror    = ^+b
 Rotate    = ^+{F12}
 Stretch   = ^+a
 Trim      = ^+m
 Extend    = ^+l
 Leader    = ^+z
 Undo      = ^z
 Dimension = ^+j
 Osnap     = ^f
 TextEd    = ^+k
 Pan       = {F7}
 return


Last edited by robiandi on September 1st, 2006, 1:21 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 1st, 2006, 12:07 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
robiandi wrote:
Some lines shorter


Nicely optimised! :D

Regards, :)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject: amazing!
PostPosted: September 1st, 2006, 1:51 pm 
Offline

Joined: January 1st, 2006, 6:26 pm
Posts: 55
Thanks a ton, this makes it so much easier to add new commands.. This is better than what I hoped for.

_________________
-AK


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2006, 8:44 pm 
Offline

Joined: January 1st, 2006, 6:26 pm
Posts: 55
I posted a new much improved option and a screenshot. It will now work very quickly and only in the target window & it will work by holding the mouse down and releasing it over the button you need to press...

Note that it uses Xbutton1 by default, which is the left-side button on 4-button mice; you need to change a few instances in the script from Xbutton1 to Rbutton or Mbutton, or some keyboard shortcut if you have a 2-button mouse.

_________________
-AK


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2006, 9:00 pm 
Offline

Joined: April 26th, 2006, 4:10 am
Posts: 657
Location: New Mexico, USA
Nice script. Looks really good.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2006, 9:19 pm 
Offline

Joined: January 1st, 2006, 6:26 pm
Posts: 55
Thanks AHK :P

_________________
-AK


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 22nd, 2010, 12:51 pm 
Offline

Joined: June 1st, 2007, 2:00 pm
Posts: 180
The link is broken.

Can anyone give me that script please ?

Best Regards.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 22nd, 2010, 1:15 pm 
Offline

Joined: June 1st, 2007, 2:00 pm
Posts: 180
I am trying the code adjunted , but I don't understand the options.

Click and the menu dissapear.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 22nd, 2010, 1:39 pm 
New link:

http://lightbird.net/files/acad2.ahk

The way it works is that you have to hold the button down, then move mouse on top of command you want and then release it and it will be run, if I remember right.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 22nd, 2010, 9:11 pm 
Offline

Joined: June 1st, 2007, 2:00 pm
Posts: 180
trying and will comment
:P


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: nothing, Yahoo [Bot] and 10 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group