Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hotkey macro 5

Status
Not open for further replies.

swforge

Mechanical
Jun 1, 2006
84
0
0
US
Hi all,
F9 hides feature manager, F10 hides toolbars, Crtl-F1 hides design library.
Can a macro do all three, and undo with one key? Not having luck creating. Thanks

SW2009 sp3.0
 
Replies continue below

Recommended for you

Or if you have a motion controller Spaceball and such you can create a custom function and type the keystrokes you want to record and assign them to a button on your device.

AutoHotKey is a great program and it's free. My brother uses it quite a bit and has hotkeyed a ton of stuff on keyboard. He can type my email address out by just entering my initials.

Or you can assign Design library key as F8 and press all three at once no need for a macro.

Michael
 
Thanks all,
Unfortunately T cant get to autohotkey and download beacause of company restrictions. ill have to use the three exiting keys for now, thanks
 
SendKeys is a base VBA function that emulates keystrokes. You could easily write a one line macro to send all of these keystrokes.

-handleman, CSWP (The new, easy test)
 
Code:
Sub main()
Dim wait As Double
wait = Timer
While Timer < wait + 0.5
    DoEvents
Wend
SendKeys "{F9}{F10}^{F1}", True
End Sub

Map this macro to a shortcut key.

There is an 0.5 second delay timer in there. The reason for it is to make sure you have let up on the shortcut key before the macro sends the keystrokes. If you are still holding down a modifier key (shift, ctrl, alt, etc) that modifier will be added to the keys sent by the macro, and the wrong key will be sent.

-handleman, CSWP (The new, easy test)
 
Thanks handleman
the macro works but the first three times I hit the shortcut hides each one at a time, the fourth time on the shortcut brings them all back.
I'm no API wizard but doesnt the code instruct all off at the same time?
 
Odd... it works for me. Perhaps breaking it up as Matt suggested. You can add more timers if you want to make sure each gets processed. Just make sure on the F1 you include the caret/hat (^) in front. That makes it Ctrl-F1.

-handleman, CSWP (The new, easy test)
 
Status
Not open for further replies.
Back
Top