Author Topic: turn caps lock on when typing in acad  (Read 2132 times)

0 Members and 1 Guest are viewing this topic.

andrew_nao

  • Guest
turn caps lock on when typing in acad
« on: September 04, 2013, 02:49:38 PM »
has anyone ever tried this?
i type in all caps in cad. when i have to send emails i hit the caps lock and type in lower case.
when i go back into cad i forget to turn caps lock back on when putting text on the screen.

i was thinking if there could be a way to detect when typing in acad if the caps lock isnt on, turn it on.

is this possible?

dos lib has a function to do it... maybe ill try to make something like that
« Last Edit: September 04, 2013, 03:01:44 PM by andrew_nao »

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: turn caps lock on when typing in acad
« Reply #1 on: September 04, 2013, 03:09:59 PM »
There was a thread here with one of Keith's very sweet routine that did this.  But in searching for it I am getting broken links. Maybe Mark will now what is going on.  :-(

Might want to check out this thread. Caps Lock
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

BlackBox

  • King Gator
  • Posts: 3770
Re: turn caps lock on when typing in acad
« Reply #2 on: September 04, 2013, 03:14:38 PM »
Not exactly what you've requested, but this may help... I use the CAPSLOCK LispFunction in concert with a Command Reactor to automagically turn on CAPSLOCK when a specific Command is started (i.e., *EDIT, etc.), but I can see where adding a secondary layer of when switching to another application might present an issue (I rarely, if ever switch apps while in a Command).



Methinks one might need to register an Application.AcadApplication.AppDeactivate Event handler (as Norman demonstrates here) to truly accomplish what you're after. If I have some time this week, I'll make this available, and post back.
"How we think determines what we do, and what we do determines what we get."

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: turn caps lock on when typing in acad
« Reply #3 on: September 04, 2013, 04:04:01 PM »
There was a thread here with one of Keith's very sweet routine that did this.  But in searching for it I am getting broken links. Maybe Mark will now what is going on.  :(

Might want to check out this thread. Caps Lock
I could not find it but do have a copy of the routine.
Maybe Keith is lurking.  :)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CottageCGirl

  • Guest
Re: turn caps lock on when typing in acad
« Reply #4 on: September 04, 2013, 04:50:52 PM »
BUT YELLING AT YOUR COWORKERS IS SOOO MUCH FUN

BlackBox

  • King Gator
  • Posts: 3770
Re: turn caps lock on when typing in acad
« Reply #5 on: September 05, 2013, 01:37:18 AM »
Alright, so I've got a working draft of a .NET plug-in (based on the my code [linked above], only ported to C#) which successfully turns on/off CAPSLOCK when AutoCAD got/lost focus respectively (thanks again, to Norman's guidance! [also linked above])... Additionally, I've added a CAPSLOCKAUTO CommandMethod, which allows the user to turn the plug-in on/off at will, and this setting is stored to the Registry for the current Profile, so one can have a different setting for each Profile (if desired, default setting is on).

Works great for activating another application window with left mouse click (even from taskbar), but in my testing, has undesired behavior when using Alt+Tab (which I use often)... Basically, the thumbnails that popup with Alt+Tab for one to scroll (tab) through cause the got/lost focus events to cycle (when they shouldn't, IMO)... I incorporated a test expression to first check for ((Control.ModifierKeys & Keys.Alt) == Keys.Alt), which prevents the unintended cycling of the got/lost focus events, but does not catch the lost focus event if the user does 'land' on another application window thumbnail via Alt+Tab.

... So it appears that I may need to create a WH_KEYBOARD_LL global keyboard hook (to incorporate an additional test expression [replacing the ... Keys.Alt bool test expression] in the plug-in's lost focus event handler, before actually executing further). *not sure*



If anyone has experience with this (catching Alt+Tab, etc. in such context), suggestions welcome... As soon as I can work this out, I'll create an Autoloader .bundle.

Cheers
"How we think determines what we do, and what we do determines what we get."

NOT SURE

  • Guest
Re: turn caps lock on when typing in acad
« Reply #6 on: September 05, 2013, 09:54:34 AM »
I use this in acad.dvb, it's not Lisp, but maybe it'll help:

Code: [Select]
Option Explicit
Private Const VK_CAPITAL = &H14

Private Type KeyboardBytes
    kbByte(0 To 255) As Byte
End Type

Private kbArray As KeyboardBytes

Private Declare Function GetKeyState Lib "user32" _
  (ByVal nVirtKey As Long) As Long

Private Declare Function GetKeyboardState Lib "user32" _
  (kbArray As KeyboardBytes) As Long

Private Declare Function SetKeyboardState Lib "user32" _
  (kbArray As KeyboardBytes) As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long

Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
 If CommandName = "TEXT" Or CommandName = "DTEXT" Or _
 CommandName = "DDEDIT" Or CommandName = "MTEDIT" Or _
 CommandName = "ATTEDIT" Or CommandName = "EATTEDIT" Or _
 CommandName = "DIMLINEAR" Or CommandName = "QLEADER" Or _
 CommandName = "MTEXT" Then
 'add any other command names you want caps on for
 'be sure to add them to the endcommand section below as well
   GetKeyboardState kbArray
   kbArray.kbByte(VK_CAPITAL) = 1
   SetKeyboardState kbArray
 End If
End Sub

Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
 If CommandName = "TEXT" Or CommandName = "DTEXT" Or _
 CommandName = "DDEDIT" Or CommandName = "MTEDIT" Or _
 CommandName = "ATTEDIT" Or CommandName = "EATTEDIT" Or _
 CommandName = "DIMLINEAR" Or CommandName = "QLEADER" Or _
 CommandName = "MTEXT" Then
   GetKeyboardState kbArray
   kbArray.kbByte(VK_CAPITAL) = 0
   SetKeyboardState kbArray
 End If
End Sub

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: turn caps lock on when typing in acad
« Reply #7 on: September 05, 2013, 09:56:16 AM »
I use the AutoCAPS option in the text editor.

I used to use Keiths program. I think it was a VBA program rather than a lisp though.
Thanks for explaining the word "many" to me, it means a lot.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst