AutoHotkey Community

It is currently May 27th, 2012, 12:45 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: March 26th, 2010, 3:25 am 
Offline

Joined: August 4th, 2009, 3:58 am
Posts: 373
Hello,

Can you tell me how to launch an AHK macro by clicking a specific place on the screen or in a program rather than pressing a key on the keyboard? I know that is probably something really simple but I've been looking through commands and the forum for an hour and can't find it.

Specifically, here is what I am after. I'm a quadriplegic and as a result, everything on the computer takes me longer than an able-bodied user. Also, using a mouse is much easier than pressing a key(s). I have already created macros for some of my common or frequent processes but I have identified many more which would speed things up significantly.

The problem though is that I am already having trouble remembering all the triggering key combinations. I was going to make a chart (in Excel) of reminders but then it dawned on me it would be far easier to have a chart of the actual triggers (or links or whatever they are called) each of which, by clicking, would launch a different macro.

So, three questions:

1. Using an Excel spreadsheet, can I set up individual cells as the triggers for my macros and if so, how would I do that? It would be great if you could include a simple example (such as launching Google by clicking cell A1).

2. I chose Excel because I use it a lot and feel very comfortable with it but is there a different application that might be better?

3. Is there a way to keep a non-active window on top continuously similar to the way Help windows commonly are?

Thanks

[Moved from General Chat forum. ~jaco0646]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2010, 5:37 am 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
You could use a Gui
Code:
gui, font, s15 cBlue
Gui, Add, Text,gMsgOne,This opens Message One
Gui, Add, Text,gMsgTwo,This opens Message Two
Gui, Add, Text,gMsgThree,This opens Message Three
Gui ,Show,x0 y0,Messages
WinSet, AlwaysOnTop, On , Messages
Return

GuiClose:
ExitApp

MsgOne:
MsgBox This is Message One
Return

MsgTwo:
MsgBox This is Message Two
Return

MsgThree:
MsgBox This is Message Three
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2010, 6:14 am 
Offline

Joined: August 4th, 2009, 3:58 am
Posts: 373
Thanks for the quick response.

I copied/pasted your code and I can see how to create text in a small window and how to keep that on top (question #3) but I can't determine if there is a solution for my first two questions. Is that included in what you posted?

Thanks again.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2010, 6:25 am 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
The Gui I posted is also an answer to questiion 2. If you click on the text in the gui it opens the macros associated with the gLabels. It is much easier to make the program all AHK instead of attempting to interface with another program.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 28th, 2010, 7:42 pm 
Offline

Joined: August 4th, 2009, 3:58 am
Posts: 373
Is there a way to format the GUI as a grid rather text lines?

One reason I mentioned Excel is because I can put as much info (reminders, notes, etc.) in each cell as I want but have it hidden unless I want it?

Is there a way to do it in Excel (i.e. to cause a cell to become a trigger)?

Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: a grid for a start
PostPosted: March 29th, 2010, 1:45 pm 
Offline

Joined: September 25th, 2008, 9:33 am
Posts: 10
Location: Germany
Hi, dsavant,

I have no idea about Excel (using openOffice), and would shy away from employing
such a big program for those helper things.

This here gives you a grid of buttons for macro actions which can be edited and added-to quite easily.

EDITED:
Added Auto-Reload section: you could keep the script's text open, on editing & saving, use
your new macro instantly (...well, set to 4000ms...)
Now stays on top of not-onTop windows.
For windows manipulation: asks to indicate the window to handle.

---Oh yes, I finally bought a 5-Button mouse, so with the help of
this script: http://www.autohotkey.com/forum/topic55562.html
I finally have 6 more clicks (X1 & X2 each having long-, double-, and singleClick).
The tilde in here:
~$XButton2::
keeps those working. The DollarSign, I found out, keeps the buttons from issuing
BrowserBack or -Forward commands if this script is listening for clicks.


Code:
#Persistent
#SingleInstance force

; UPDATEDSCRIPT: http://www.autohotkey.com/forum/viewtopic.php?t=135

SetTimer,UPDATEDSCRIPT,4000
UPDATEDSCRIPT:
FileGetAttrib,attribs,%A_ScriptFullPath%
IfInString,attribs,A
{
  FileSetAttrib,-A,%A_ScriptFullPath%
  SplashTextOn,,,Updated script,
  Sleep,1500
  SplashTextOff
  Reload
}
Return

;http://www.autohotkey.com/forum/topic1771-15.html    -here I nicked the buttons.

~$XButton2::               
   Gui, Add, Button, x2  y2 w56 h36 , left`nhalf      ;`n to get a line feed on the button's face.
   Gui, Add, Button, x62  y2 w56 h36 , macro`n12      
   Gui, Add, Button, x122  y2 w56 h36 , macro`n13
   Gui, Add, Button, x182  y2 w56 h36 , macro`n14
   Gui, Add, Button, x242  y2 w56 h36 , on`nTop
   Gui, Add, Button, x2  y42 w56 h36 , righ`nthalf
   Gui, Add, Button, x62  y42 w56 h36 , macro`n22
   Gui, Add, Button, x122  y42 w56 h36 , macro`n23
   Gui, Add, Button, x182  y42 w56 h36 , macro`n24
   Gui, Add, Button, x242  y42 w56 h36 , tog`nTitle
   Gui, Color, f0f2c0
    Gui, Show, Noactivate h80 w300, ACTlONS   ;no coordinates: autocentered first, then remembering it's position.
    WinSet, AlwaysOnTop, On, ACTlONS      ;UNIQUE window title -different from script name- needed for this "onTop"
Return               ; Note: the cap "i" is really a lowerCase "L".
               ;Change if you'd use "actlons" in a file name.
;------------MACROS-------------


Buttonlefthalf: 
Progress, zh0 fs12, Click the window you want to move
KeyWait, LButton, D T8
Progress, Off
MouseGetPos, , , actID
    WinMove, ahk_id %actID%, ,0, 1,  512, 769
return

Buttonmacro12:
   msgbox, macro12
return

Buttonmacro13:
   msgbox, macro13
return

Buttonmacro14:
   msgbox, macro14
return

ButtononTop:
Progress, zh0 fs12, Click the window you want to toggle AlwaysOnTop off/on
KeyWait, LButton, D T1.5
Progress, Off
MouseGetPos, , , actID
    Winset, AlwaysOnTop, Toggle, ahk_id %actID%                 ; toggle Window topmost
    WinGet, ExStyle, ExStyle, ahk_id %actID%
    If (ExStyle & 0x8)    ; 0x8 is WS_EX_TOPMOST.
    WinSet, Transparent, 215, ahk_id %actID%      ;if topmost, make it transparent just a bit, as visual feedback for "topmost"
    else
    WinSet, Transparent, 255, ahk_id %actID%
return

Buttonrighthalf:   
Progress, zh0 fs12, Click the window you want to move
KeyWait, LButton, D T8
Progress, Off
MouseGetPos, , , actID
    WinMove, ahk_id %actID%, ,513, 1,  512, 769
return


Buttonmacro22:
   msgbox, macro22
return

Buttonmacro23:
   msgbox, macro23
return

Buttonmacro24:
   msgbox, macro24
return

ButtontogTitle:
Progress, zh0 fs12, Click the window you want to toggle Caption  off/on
KeyWait, LButton, D T8
Progress, Off
MouseGetPos, , , actID
 WinSet, Style, ^0x80800000, ahk_id %actID%
return




As it is now, the buttons just show their names. The names, prefixed by a "Button", make the macro handlers.

No time to look it up now, but I'm sure the button's faces can be edited to show icons or thumbnails instead of
text, or the text they show can be edited. Search for "button" in the ahk.chm,, open the GUI-related items.

Not sharing your burden, I am nonetheless interested in doing as much as possible with the mouse. You may want to
search the forum for "Hot Corners" for inspiration, and you may have a look at this thread:
http://kmeleon.sourceforge.net/forum/read.php?1,100290,100290#msg-100290
if you are interested in a slim & fast browser coming with configurable mouseGestures and
stunning overall configurability, namely, K-Meleon.[/url]

_________________
Cheers,
SoerenB


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2010, 3:25 pm 
Offline

Joined: August 4th, 2009, 3:58 am
Posts: 373
Thanks for the good response. My apologies for not saying so sooner.

Could you help me know how to use or what to do with the code you posted and how to get from what you have provided to what I'm trying to do. Although I use AHK commands constantly, most of them fall in a narrow range of steps. As a result, other than a couple of things like Sleep, LButton, MouseGetPos, etc., I don't really see anything that's familiar.

BTW, I don't believe in the lazy/brainless approach of just asking questions and not looking things up on my own. I have gone to the urls you included and also read about several of the commands, etc., in the documentation but I still don't know how to utilize what you posted.

I don't know if it is related to my accident or something else but I find myself having a tough time grasping the essence of things I read about and how to implement them. On the other hand, if I can get through the first step and see how something works then I am off and running and finding many different ways to modify what I have learned for multiple different purposes.

With that in mind, I'm hoping that you can tell me a couple of (probably very basic) things to get the ball rolling. (Please don't feel like you need to answer or comment on all of them but maybe just the ones that you think will enable me to get going):

1. I created a new AHK script, pasted all of your code into it and saved it with the name GridMacros. I then double-clicked to open/run it. Should something happen at that point because nothing did?

2. Usually when I create a macro, I start with an initiation command like "$F5::" . Do I need to do that here or should something just start when I run it?

3. What do I do to just get the grid (or whatever) to show up on the screen?

4. If you could tell me specifically what to do in order to display the grid of buttons and then create a simple macro for one of the buttons, I think that will do the trick (e.g. click a particular button, such as Buttonmacro13, and have it launch Google in a new browser or a new tab in a browser that is already open).

5. Regarding this example from your code:

Buttonmacro13:
msgbox, macro13
return

How do I assign which grid button is macro 13?
Is msgbox for writing something like a label to display on the button or having a message display when the macro is activated?
How/where do I enter the message I want?
How/where do I enter the code for macro13 -- (i.e. RunWait, www.goggle.com)

6. Here are some specific things, in no particular order, which I don't understand:

#Persistent

#SingleInstance force

the word "nicked" in "-here I nicked the buttons."

~$XButton2::

`n

, left`nhalf

;`n to get a line feed on the button's face.

actID

"~~2" in "return~~2"


Thanks again for your earlier response and a second big thanks if you can take a minute to answer anything here.

dsavant


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: chaosad, jrav, MSN [Bot] and 24 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