 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
geor
Joined: 16 Jun 2008 Posts: 45
|
Posted: Sat Jul 19, 2008 7:16 pm Post subject: Crude script-hack for Paint - any better Ideas? |
|
|
`
I'll say it again - MS Paint is small, fast, & gets out of my way,
letting me create/edit my own style of Image/Text-box tutorial documents the way I want.
However, a major annoyance to me has been that Paint opens with the drawing tool/pencil selected by default -
'cause that's obviously the 1st usage anyone would open Paint for, right?
Until today I had not found a way to make Paint open w/ the 'Select' tool as default -
no one could point me to a Registry tweak,
& I have a hunch that I could hack it eventually with Reshack or Resource Tuner,
but I just haven't put in the time to fool around with it.
That said, with Thanks to help from @scottmattes, I adapted his script from here
| Code: | | http://www.autohotkey.com/forum/viewtopic.php?t=33756 |
and figured out a way to make my hotkey #V open Paint maximized, w/ 'Select' as the focus -
by means of 'Alt+E' to open the Edit menu,
then 'A' to 'Select All',
then 'Esc' to Escape & leave the focus in the 'Select' box function.
I also wanted a 1-key hotkey to make the Toolbox show/hide (gives full-screen working ability),
& a 1-key hotkey to make the 'Attributes' box show/hide (used to change dimensions),
because I use both those functions alot within any session.
So I used the same approaches there,
by sending Alt+I/A to open Image - select Attributes,
and Alt+V to open View - show/hide Tool Box.
| Code: |
#V::
Run mspaint, ,max
WinWait, untitled - Paint,
IfWinNotActive, untitled - Paint, , WinActivate, untitled - Paint,
WinWaitActive, untitled - Paint,
Send, !EA{Esc}
return
#IfWinActive, ahk_class MSPaintApp
F5::Send, !IA
return
F6::Send, !VT
return
#IfWinActive |
I'm sure this is an extremely crude beginner's way to accomplish this,
& would be joyous if someone would help me with a more direct way.
I first tried, but could not figure out how to
::Send, ^E to open Attributes directly or
::Send, ^T to show/hide Tool Box directly .......
so that's why/when I resorted to this other hack that DOES work !
thx for listening  |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 666 Location: MN, USA
|
Posted: Sun Jul 20, 2008 7:49 pm Post subject: |
|
|
| Code: | #V::
Run, mspaint,,max,PID
WinWait, ahk_pid %PID%
PostMessage,0x111,620,,,ahk_pid %PID%
return
#IfWinActive, ahk_class MSPaintApp
F5::Send, ^e
F6::Send, ^t |
It's possible to choose the tools via PostMessage. For reference, their numbers are as follows. | Code: | Free-Form 621
Select 620
Eraser 637
Fill 623
Pick 639
Magnifier 638
Pencil 636
Brush 640
AirBrush 627
Text 622
Line 624
Curve 628
Rectangle 641
Polygon 632
Ellipse 643
Rounded_Rect 634 |
The menu items have message codes as well; however the keyboard shortcuts are equally effective. The answer to your trouble is documented in the fine print of the Send command.
| AHK Help File wrote: | | Note: ^A produces a different effect in some programs than ^a. This is because ^A presses CONTROL+SHIFT+A and ^a presses CONTROL+a. If in doubt, use lowercase. |
_________________ http://autohotkey.net/~jaco0646/ |
|
| Back to top |
|
 |
geor
Joined: 16 Jun 2008 Posts: 45
|
Posted: Sun Jul 20, 2008 10:11 pm Post subject: |
|
|
Thanks for this help jaco0646 ~
I appreciate your pointer to the Help file mention of lower- vs upper-case,
so I've gone back to change some things in my scripts just to be safe.
Now these work fine :
| Code: |
F5::Send, ^e
F6::Send, ^t |
And I'm also learning more about the use of Messages.
However, the 1st part of the code is NOT working for me,
as Paint still opens w/ the default pencil-tool selected .
Carefully studying your script,
I thought it might be that spaces were missing after each comma in the line
| Code: |
PostMessage,0x111,620,,,ahk_pid %PID% |
but adding commas does not change anything.
Would you mind having another look at it?
'cause I know this is the better/more direct way than my mangled way!
Also, How can I get those "message codes" information -
with the Spy tool ? or ..... ? |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 666 Location: MN, USA
|
Posted: Mon Jul 21, 2008 2:43 am Post subject: |
|
|
Try this: | Code: | #V::
Run, mspaint,,max
WinWait, ahk_class MSPaintApp
PostMessage,0x111,620,,,ahk_class MSPaintApp
return
#IfWinActive, ahk_class MSPaintApp
F5::Send, ^e
F6::Send, ^t |
The help file warns that the PID may be blank when system verbs are used, but since it worked for me I posted it that way. Using ahk_class works as well (for me at least); I simply used the PID to be more precise in case multiple Paint windows were open. EDIT: If you use the complete path to run paint (%A_WinDir%\System32\mspaint.exe) then the PID should work.
I got the message codes from Winspector. _________________ http://autohotkey.net/~jaco0646/
Last edited by jaco0646 on Tue Jul 22, 2008 1:13 am; edited 1 time in total |
|
| Back to top |
|
 |
geor
Joined: 16 Jun 2008 Posts: 45
|
Posted: Mon Jul 21, 2008 4:17 am Post subject: |
|
|
Bingo!Bang!Beautiful!
that one does it, thx very much jaco0646 ~
I happened to find & install Winspector just a day ago,
so now it's homework to learn it by using it, eh?
........................
so this solution avoids the momentary on-screen flash of the menus unfolding by my crude method -
are there any 'Quiet' or 'Hide' type switches that can be used even with crude type methods that try to trigger events through the menus like I did
(might come in handy for SOMEthing !?
(ps - Friday-7_18/The Wilderness @ Fortune Bay/70*_sunny & 42out/41in = 83 )
. |
|
| Back to top |
|
 |
lorenh
Joined: 15 Oct 2008 Posts: 1
|
Posted: Thu Oct 16, 2008 2:28 pm Post subject: |
|
|
I have been trying without much success to uncheck Menu-Image-Draw Opaque using postmessage. With winspector I found the ID number 6868.
The following toggles the selection:
| Code: | | PostMessage,0x111,6868,,,ahk_class MSPaintApp |
Is there a way of setting this to unchecked regarless of its current status or to ascertain the current status to determine if it should be toggled?
I have been able to do this by sending a mouseclick to the Tool Box but would like to do it without opening the Tool Box. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|