Author Topic: Caps Lock  (Read 18495 times)

0 Members and 1 Guest are viewing this topic.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Caps Lock
« on: April 09, 2012, 03:52:12 PM »
Needed this the other day for something that I was working on.  Couldn't find anything online so I cobbled this together.  Why Autocad doesn't have this property?

Code: [Select]
;; Toggle = T/nil - T = Turns ON CAPS / nil = Turns OFF CAPS
(defun CAPSLOCK (Toggle / MS-Word)
;; Get the word application
(if (setq MS-Word (vlax-get-or-create-object "Word.Application"))
;; If word exists set
(progn
;; Check for CAPS LOCK
(cond
;;Toggle is T and CAPS LOCK is off
((and (= Toggle T)(= (vlax-get MS-Word 'CapsLock) 0))
(vlax-invoke-method  (vla-getInterfaceObject (vlax-get-acad-object) "WScript.Shell") 'SendKeys "{CAPSLOCK}")
)
;;Toggle is nil and CAPS LOCK is on
((and (= Toggle nil)(= (vlax-get MS-Word 'CapsLock) -1))
(vlax-invoke-method  (vla-getInterfaceObject (vlax-get-acad-object) "WScript.Shell") 'SendKeys "{CAPSLOCK}")
)
)
;; Exit word
(vlax-invoke-method MS-Word 'Quit)
;; Release object
(vlax-release-object MS-Word)
;; Quite exit
(princ)
)
;; Send nil
nil
)
)
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: Caps Lock
« Reply #1 on: April 09, 2012, 05:26:22 PM »
Seems useful, but I'm not advanced enough to know how to use it!  I used (capslock T) and (capslock nil) successfully in CAD, but I don't know about Word usage.

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Caps Lock
« Reply #2 on: April 09, 2012, 05:27:48 PM »
I wouldn't have thought to use MSWord, nice one Tim  :-)

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Caps Lock
« Reply #3 on: April 09, 2012, 05:29:28 PM »
I wouldn't have thought to use MSWord, nice one Tim  :-)
x2!
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

BlackBox

  • King Gator
  • Posts: 3770
Re: Caps Lock
« Reply #4 on: April 09, 2012, 05:43:45 PM »
FWIW - For fun:

Code - vb.net: [Select]
  1. Imports Autodesk.AutoCAD.ApplicationServices
  2. Imports Autodesk.AutoCAD.DatabaseServices
  3. Imports Autodesk.AutoCAD.EditorInput
  4. Imports Autodesk.AutoCAD.Runtime
  5.  
  6. Imports System
  7.  
  8. <Assembly: CommandClass(GetType(Foo.Foo))>
  9.  
  10. Namespace Foo
  11.  
  12.     Public Class Foo
  13.  
  14.         <LispFunction("CapsLock-p")> _
  15.         Public Function CapsLock_P(ByVal args As ResultBuffer)
  16.             If My.Computer.Keyboard.CapsLock = True Then
  17.                 Return True
  18.             Else
  19.                 Return Nothing
  20.             End If
  21.         End Function
  22.  
  23.     End Class
  24.  
  25. End Namespace
  26.  

** Returns T if CapsLock is on, Nil if off. Tested using Civil 3D 2011, 2012.
"How we think determines what we do, and what we do determines what we get."

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Caps Lock
« Reply #5 on: April 09, 2012, 05:52:29 PM »
Seems useful, but I'm not advanced enough to know how to use it!  I used (capslock T) and (capslock nil) successfully in CAD, but I don't know about Word usage.

MS Office applications (some of them) have a "CapsLock" property that can be checked, Autocad does not.  I couldn't find any good references (dll) that had a good way of checking for CapsLock.  This was the best "lisp" only way that I could come up with (after almost 2 days searching / playing)

If some one has a better way, I would love to see it.  (lisp only, I not very versed in much else   :roll:
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

BlackBox

  • King Gator
  • Posts: 3770
Re: Caps Lock
« Reply #6 on: April 09, 2012, 06:19:21 PM »
Tim - I've successfully tested an enhanced version of the LispFunction posted above (now simply named "CapsLock"), and am able to successfully toggle the CapsLock and not just test for current status.

Before I post, I just have to revise my IF statement to allow for user-specified On (T) / Off (Nil), as currently either T or Nil as Argument will toggle (which is not what we want). I will post back source and compiled code for your use.
"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: Caps Lock
« Reply #7 on: April 09, 2012, 06:40:22 PM »
** Edit - Code updated in this post.


Update: "CapsLock" LispFunction

When called without an argument, the CapsLock status is returned as T (True) for ON, or Nil for OFF.

When called with a single argument as T (True) the CapsLock status is evaluated, and turned ON if presently OFF. Single argument as Nil evaluates the current CapsLock status, and turns OFF is presently ON.


Here's the revised source code for those, like me, that prefer to compile yourself:


Code - vb.net: [Select]
  1. ' Code updated in another post


... Here's the compiled code (attached). I compiled to .NET 3.5 for use in 2010 and newer drawings. Please let me know if you have any problems (I don't usually distribute to others outside of my work).


HTH
« Last Edit: April 10, 2012, 12:40:02 PM by RenderMan »
"How we think determines what we do, and what we do determines what we get."

GDF

  • Water Moccasin
  • Posts: 2081
Re: Caps Lock
« Reply #8 on: April 09, 2012, 06:55:00 PM »
Good one Tim, I'll add it to my ANNO routine. To make sure the caps are always on when inserting text. Thanks for sharing it.
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Caps Lock
« Reply #9 on: April 09, 2012, 07:29:34 PM »
Update: "CapsLock" LispFunction

When called without an argument, the CapsLock status is returned as T (True) for ON, or Nil for OFF.

When called with a single argument as T (True) the CapsLock status is evaluated, and turned ON if presently OFF. Single argument as Nil evaluates the current CapsLock status, and turns OFF is presently ON.

Here's the revised source code for those, like me, that prefer to compile yourself:

... Here's the compiled code (attached). I compiled to .NET 3.5 for use in 2010 and newer drawings. Please let me know if you have any problems (I don't usually distribute to others outside of my work).

HTH

This is great! ( i haven't tried it yet) , I will try when I get back to work tomorrow.  Maybe we can get a complete set exposed  to autocad caps, num, scroll?  A total package would be a great resource.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

BlackBox

  • King Gator
  • Posts: 3770
Re: Caps Lock
« Reply #10 on: April 09, 2012, 07:42:15 PM »
I'm glad this is of interest to you, Tim.

Funny enough, it dawned on me after posting that the other locks may be of use too! I've already brought my laptop home to tinker. LoL if I get enough together I may just incorporate this into my VLX-* (Visual Lisp Xpanded) LispFunction library.
"How we think determines what we do, and what we do determines what we get."

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Caps Lock
« Reply #11 on: April 09, 2012, 07:53:15 PM »
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.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Caps Lock
« Reply #12 on: April 09, 2012, 08:37:33 PM »
It would be great to use in a reactor for text and such (my plan anyway).  I hate having to go from autocad to outlook and start typing and there is an entire email in CAPS.  This has been a small thorn in a lisp developer's side for years.  It would be nice to have a great solutions.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

Rod

  • Newt
  • Posts: 185
Re: Caps Lock
« Reply #13 on: April 10, 2012, 02:31:17 AM »
Two options I can think of is
doslibs dos_capslock see http://www.en.na.mcneel.com/doslib/system_functions/dos_capslock.htm
for setting the caplock state
Eg. (dos_capslock nil) (dos_capslock T)

and the express utility (acet-sys-keystate keycode) see http://www.afralisp.net/archive/lisp/acet-utils.htm
Eg. (acet-sys-keystate 14) for checking the capslock state
I'm not in front of autocad now so you will have to check yourself.
Rod

"All models are wrong, some models are useful" - George Box

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Caps Lock
« Reply #14 on: April 10, 2012, 07:16:48 AM »
Two options I can think of is
doslibs dos_capslock see http://www.en.na.mcneel.com/doslib/system_functions/dos_capslock.htm
for setting the caplock state
Eg. (dos_capslock nil) (dos_capslock T)

and the express utility (acet-sys-keystate keycode) see http://www.afralisp.net/archive/lisp/acet-utils.htm
Eg. (acet-sys-keystate 14) for checking the capslock state
I'm not in front of autocad now so you will have to check yourself.
Rod

I know about both of those options, but we don't have Doslib here (stuff like that is prohibited  :ugly:)
The express tools is a great idea but you can not ensure that everyone has the express tools loaded, and it takes an act of Congress to get things loaded from IT around here.  So I try not to develop applications around them.  The express tools is a great option, it should be part of the vlsip com.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Caps Lock
« Reply #15 on: April 10, 2012, 08:17:47 AM »
99% of what we type in AutoCAD is MText and so we simply toggle on the AUTOCAPS option for MText (right-click --> Autocaps).

My two cents....
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Caps Lock
« Reply #16 on: April 10, 2012, 08:43:13 AM »
@ Matt

I agree with the MTEXT autocaps, but we also do plain text as well as edit attributes.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Caps Lock
« Reply #17 on: April 10, 2012, 08:50:26 AM »
99% of what we type in AutoCAD is MText and so we simply toggle on the AUTOCAPS option for MText (right-click --> Autocaps).

My two cents....
The other downfall of that is, if you paste anything into an MText object (something typed from word) that isn't in all caps, it capitalized everything.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: Caps Lock
« Reply #18 on: April 10, 2012, 09:56:29 AM »
MS Office applications (some of them) have a "CapsLock" property that can be checked, Autocad does not.  I couldn't find any good references (dll) that had a good way of checking for CapsLock.

So you silently invoke Word from ACAD to make the change...interesting!  I like the forward thinking!  :kewl:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Caps Lock
« Reply #19 on: April 10, 2012, 12:05:35 PM »
Someone suggested this http://www.eventghost.org/
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.

BlackBox

  • King Gator
  • Posts: 3770
Re: Caps Lock
« Reply #20 on: April 10, 2012, 12:34:43 PM »
Again, FWIW - I'm mainly doing this for fun... There's definitely some additions that I'd like to incorporate, and some streamlining I'd like to do, but sadly this is all I have time for at the moment.

Here are three LispFunction Methods (so far) aptly named CapsLock, NumLock, and ScrollLock.

Each LispFunction can be invoked on it's own without an argument, and the function serves as a check, returning T for ON, Nil for OFF.

When a single argument is supplied as either T for ON, or Nil for OFF the status is checked, and if needed, the status is changed per the supplied argument.

Example (CapsLock shown):

Code - Auto/Visual Lisp: [Select]
  1. Command: (capslock)
  2. nil
  3.  
  4. Command: (capslock t)
  5. T
  6.  
  7. Command: (CAPSLOCK)
  8. T
  9.  
  10. Command: (CAPSLOCK NIL)
  11. nil
  12.  
  13. Command: (capslock)
  14. nil
  15.  


The compiled code is attached (at the bottom of this post), and was compiled to .NET 3.5 to work with 2010 and newer, and has tested successfully with Civil 3D 2011, and 2012.

I hope someone will have use for this - Enjoy!


Here's the source code for those interested:



** Update - 2012-08-17

Additional 'LispException' Classes added for completeness (thanks Gile!), and attached the following assembly versions:

LispKeys2010.dll (compiled to .NET 3.5 for 2010 database format)
LispKeys2013.dll (compiled to .NET 4.0 for 2013 database format)

... Next enhancement will streamline, adding Methods (sub-functions) to remove duplicate code.



Code - vb.net: [Select]
  1. Imports Autodesk.AutoCAD.Runtime
  2. Imports Autodesk.AutoCAD.ApplicationServices
  3. Imports Autodesk.AutoCAD.DatabaseServices
  4. Imports Autodesk.AutoCAD.Geometry
  5. Imports Autodesk.AutoCAD.EditorInput
  6.  
  7. Imports System
  8. Imports System.Windows.Forms
  9.  
  10. Namespace LispKeys
  11.  
  12. #Region "myFunctions"
  13.  
  14.     Public Class MyFunctions
  15.  
  16.         Implements IExtensionApplication
  17.  
  18.         Public Sub Initialize() Implements IExtensionApplication.Initialize
  19.             Autodesk.AutoCAD.ApplicationServices.Application. _
  20.                 DocumentManager.MdiActiveDocument.Editor.WriteMessage(
  21.                     vbLf & "LispKeys Loaded. " & vbLf
  22.                     )
  23.         End Sub
  24.  
  25.         Public Sub Terminate() Implements IExtensionApplication.Terminate
  26.             ' Do plug-in application clean up here
  27.         End Sub
  28.  
  29.         Private Shared ed As Editor = Autodesk.AutoCAD.ApplicationServices. _
  30.             Application.DocumentManager.MdiActiveDocument.Editor
  31.  
  32.         Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
  33.                                                       ByVal bScan As Byte, _
  34.                                                       ByVal dwFlags As Integer, _
  35.                                                       ByVal dwExtraInfo As Integer)
  36. #Region "CapsLock"
  37.  
  38.         Shared Sub ToggleCapsLock()
  39.             keybd_event(System.Windows.Forms.Keys.CapsLock, &H14, 1, 0)
  40.             keybd_event(System.Windows.Forms.Keys.CapsLock, &H14, 3, 0)
  41.         End Sub
  42.  
  43.         <LispFunction("CapsLock")> _
  44.         Public Function CapsLock(ByVal args As ResultBuffer)
  45.             Try
  46.                 If args Is Nothing Then
  47.                     If My.Computer.Keyboard.CapsLock = True Then
  48.                         Return True
  49.                     Else
  50.                         Return Nothing
  51.                     End If
  52.                 End If
  53.  
  54.                 Dim myArgs As Array = args.AsArray
  55.  
  56.                 If myArgs.Length > 1 Then
  57.                     Throw New TooManyArgsException()
  58.                 End If
  59.  
  60.                 Dim arg As TypeCode = myArgs(0).Typecode
  61.  
  62.                 If arg = LispDataType.T_atom Then
  63.                     If My.Computer.Keyboard.CapsLock <> True Then
  64.                         ToggleCapsLock()
  65.                     End If
  66.                     Return True
  67.                 End If
  68.  
  69.                 If arg = LispDataType.Nil Then
  70.                     If My.Computer.Keyboard.CapsLock <> False Then
  71.                         ToggleCapsLock()
  72.                     End If
  73.                     Return Nothing
  74.                 End If
  75.  
  76.                 Throw New ArgumentTypeException("atom", myArgs(0))
  77.                 Return Nothing
  78.  
  79.             Catch ex As LispException
  80.                 ed.WriteMessage(vbLf & "LISP error: {0}" & vbLf, ex.Message)
  81.                 Return Nothing
  82.  
  83.             Catch ex As Autodesk.AutoCAD.Runtime.Exception
  84.                 ed.WriteMessage(vbLf & "AutoCAD error: {0}" & vbLf, ex.Message)
  85.                 Return Nothing
  86.  
  87.             Catch ex As System.Exception
  88.                 ed.WriteMessage(vbLf & "System error: {0}" & vbLf, ex.Message)
  89.                 Return Nothing
  90.  
  91.             End Try
  92.  
  93.         End Function
  94.  
  95. #End Region
  96.  
  97. #Region "NumLock"
  98.         Shared Sub ToggleNumLock()
  99.             keybd_event(System.Windows.Forms.Keys.NumLock, &H90, 1, 0)
  100.             keybd_event(System.Windows.Forms.Keys.NumLock, &H90, 3, 0)
  101.         End Sub
  102.  
  103.         <LispFunction("NumLock")> _
  104.         Public Function NumLock(ByVal args As ResultBuffer)
  105.             Try
  106.                 If args Is Nothing Then
  107.                     If My.Computer.Keyboard.NumLock = True Then
  108.                         Return True
  109.                     Else
  110.                         Return Nothing
  111.                     End If
  112.                 End If
  113.  
  114.                 Dim myArgs As Array = args.AsArray
  115.  
  116.                 If myArgs.Length > 1 Then
  117.                     Throw New TooManyArgsException()
  118.                 End If
  119.  
  120.                 Dim arg As TypeCode = myArgs(0).Typecode
  121.  
  122.                 If arg = LispDataType.T_atom Then
  123.                     If My.Computer.Keyboard.NumLock <> True Then
  124.                         ToggleNumLock()
  125.                     End If
  126.                     Return True
  127.                 End If
  128.  
  129.                 If arg = LispDataType.Nil Then
  130.                     If My.Computer.Keyboard.NumLock <> False Then
  131.                         ToggleNumLock()
  132.                     End If
  133.                     Return Nothing
  134.                 End If
  135.  
  136.                 Throw New ArgumentTypeException("atom", myArgs(0))
  137.                 Return Nothing
  138.  
  139.             Catch ex As LispException
  140.                 ed.WriteMessage(vbLf & "LISP error: {0}" & vbLf, ex.Message)
  141.                 Return Nothing
  142.  
  143.             Catch ex As Autodesk.AutoCAD.Runtime.Exception
  144.                 ed.WriteMessage(vbLf & "AutoCAD error: {0}" & vbLf, ex.Message)
  145.                 Return Nothing
  146.  
  147.             Catch ex As System.Exception
  148.                 ed.WriteMessage(vbLf & "System error: {0}" & vbLf, ex.Message)
  149.                 Return Nothing
  150.  
  151.             End Try
  152.  
  153.         End Function
  154.  
  155. #End Region
  156.  
  157. #Region "ScrollLock"
  158.  
  159.         Shared Sub ToggleScrollLock()
  160.             keybd_event(System.Windows.Forms.Keys.Scroll, &H91, 1, 0)
  161.             keybd_event(System.Windows.Forms.Keys.Scroll, &H91, 3, 0)
  162.         End Sub
  163.  
  164.         <LispFunction("ScrollLock")> _
  165.         Public Function ScrollLock(ByVal args As ResultBuffer)
  166.             Try
  167.                 If args Is Nothing Then
  168.                     If My.Computer.Keyboard.ScrollLock = True Then
  169.                         Return True
  170.                     Else
  171.                         Return Nothing
  172.                     End If
  173.                 End If
  174.  
  175.                 Dim myArgs As Array = args.AsArray
  176.  
  177.                 If myArgs.Length > 1 Then
  178.                     Throw New TooManyArgsException()
  179.                 End If
  180.  
  181.                 Dim arg As TypeCode = myArgs(0).Typecode
  182.  
  183.                 If arg = LispDataType.T_atom Then
  184.                     If My.Computer.Keyboard.ScrollLock <> True Then
  185.                         ToggleScrollLock()
  186.                     End If
  187.                     Return True
  188.                 End If
  189.  
  190.                 If arg = LispDataType.Nil Then
  191.                     If My.Computer.Keyboard.ScrollLock <> False Then
  192.                         ToggleScrollLock()
  193.                     End If
  194.                     Return Nothing
  195.                 End If
  196.  
  197.                 Throw New ArgumentTypeException("atom", myArgs(0))
  198.                 Return Nothing
  199.  
  200.             Catch ex As LispException
  201.                 ed.WriteMessage(vbLf & "LISP error: {0}" & vbLf, ex.Message)
  202.                 Return Nothing
  203.  
  204.             Catch ex As Autodesk.AutoCAD.Runtime.Exception
  205.                 ed.WriteMessage(vbLf & "AutoCAD error: {0}" & vbLf, ex.Message)
  206.                 Return Nothing
  207.  
  208.             Catch ex As System.Exception
  209.                 ed.WriteMessage(vbLf & "System error: {0}" & vbLf, ex.Message)
  210.                 Return Nothing
  211.  
  212.             End Try
  213.  
  214.         End Function
  215.  
  216. #End Region
  217.  
  218. #Region "VolumeMute"
  219.  
  220.         ' More to come
  221.  
  222. #End Region
  223.  
  224.     End Class
  225.  
  226. #End Region
  227.  
  228. #Region "myExceptions"
  229.  
  230.     ''' <summary>
  231.     ''' Special thanks to Gile for help with 'LispExceptions'
  232.     ''' More info here: http://www.theswamp.org/index.php?topic=41509.msg466232#msg466232
  233.     ''' </summary>
  234.     ''' <remarks></remarks>
  235.     Public Class LispException
  236.         Inherits System.Exception
  237.  
  238.         Public Sub New(ByVal msg As String)
  239.             MyBase.New(msg)
  240.  
  241.         End Sub
  242.  
  243.     End Class
  244.  
  245.  
  246.     Public Class TooFewArgsException
  247.         Inherits LispException
  248.  
  249.         Public Sub New()
  250.             MyBase.New("Too few arguments")
  251.  
  252.         End Sub
  253.  
  254.     End Class
  255.  
  256.  
  257.     Public Class TooManyArgsException
  258.         Inherits LispException
  259.  
  260.         Public Sub New()
  261.             MyBase.New("Too many arguments")
  262.  
  263.         End Sub
  264.  
  265.     End Class
  266.  
  267.  
  268.     Public Class ArgumentTypeException
  269.         Inherits LispException
  270.  
  271.         Public Sub New(ByVal s As String, ByVal tv As TypedValue)
  272.             MyBase.New(String.Format("Bad argument type: {0} {1}", s, (tv.TypeCode = CType(LispDataType.Nil, Integer))))
  273.  
  274.         End Sub
  275.  
  276.     End Class
  277.  
  278. #End Region
  279.  
  280. End Namespace
  281.  
« Last Edit: August 17, 2012, 10:21:13 AM by RenderMan »
"How we think determines what we do, and what we do determines what we get."

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Caps Lock
« Reply #21 on: April 11, 2012, 10:31:59 AM »
@ RenderMan

Works great thanks for the help.  It's a great resource for a lisper.  :mrgreen:
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

BlackBox

  • King Gator
  • Posts: 3770
Re: Caps Lock
« Reply #22 on: April 11, 2012, 10:37:20 AM »
@ RenderMan

Works great thanks for the help.  It's a great resource for a lisper.  :mrgreen:

That is kind of you to say, and you're welcome, Tim.   :kewl:
"How we think determines what we do, and what we do determines what we get."

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: Caps Lock
« Reply #23 on: April 11, 2012, 03:00:33 PM »
I'm going to try to use this as a reactor for editing attributes to make sure caps are on.  so.    uh.       look out.
Just wanted to post my light bulb moment.

*EDIT*
It would be great to use in a reactor for text and such

Just wanted to RE-post Tims light bulb moment.
I'm always a little too late.
Too late, too late <-anybody get the song reference? it's obscure....
« Last Edit: April 11, 2012, 03:04:49 PM by Dommy2Hotty »

BlackBox

  • King Gator
  • Posts: 3770
Re: Caps Lock
« Reply #24 on: April 11, 2012, 03:08:41 PM »
Interesting... I can certainly understand why some would like to retain CapsLock = ON while working within AutoCAD, but I am curious as to what Event you're going to monitor on which to trigger your CallBack of (CapsLock T)...?  :?

Having not tested this myself (yet) obviously, I wonder just how 'taxed' the Environment would be if one were to use something basic, like a CommandReactor... Pseudo CallBack:

Code - Auto/Visual Lisp: [Select]
  1. ;;; CommandWillStart Event
  2. (defun CallBack:CapsLockTest (rea cmd / )
  3.   (if (not (CapsLock))
  4.     (CapsLock T))
  5.  
  6.   ;; <-- More
  7.   )
  8.  

... This is definitely something to tinker with after work.

** Edit - I wonder if there's something useful in either Grread, or vlr-Window-Reactor (for maintaining CapsLock = ON in AutoCAD, and OFF when in another application)...?
« Last Edit: April 18, 2012, 01:18:13 PM by RenderMan »
"How we think determines what we do, and what we do determines what we get."

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Caps Lock
« Reply #25 on: April 11, 2012, 03:53:37 PM »
I think using the command reactor will work fine.  I use one now for "grip_stretch" and it seems to work great.  I don;t have time to pen anything today but I will tomorrow.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Caps Lock
« Reply #26 on: April 11, 2012, 04:04:53 PM »
Just thought I'd throw this out there.   :roll:
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

BlackBox

  • King Gator
  • Posts: 3770
Re: Caps Lock
« Reply #27 on: April 11, 2012, 04:06:42 PM »
 :lmao:
"How we think determines what we do, and what we do determines what we get."

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Caps Lock
« Reply #28 on: April 12, 2012, 07:46:47 AM »
Looks like Neil Fallon (lead singer from Clutch).
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Caps Lock
« Reply #29 on: April 12, 2012, 09:54:06 AM »
Here is a command reactor for the caps lock.  If anyone can think of other commands that may apply let me know.

**EDIT - MODIFIED ATTACHMENT**
« Last Edit: April 12, 2012, 10:56:39 AM by TimSpangler »
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

BlackBox

  • King Gator
  • Posts: 3770
Re: Caps Lock
« Reply #30 on: April 12, 2012, 10:01:22 AM »
I'm glad you're able to use this, Tim.

FWIW - Rather than calling (car Plist) for each expression in the Or Statements for your callback(s), consider using vl-Postion instead:

Code - Auto/Visual Lisp: [Select]
  1.       (car Plist)
  2.       '("ATTEDIT" "DDEDIT" "DTEXT" "MTEXT" "TEXT" "TEXTEDIT"))
  3.   (CAPSLOCK ;| T/Nil |;)
  4.   )
  5.  
« Last Edit: April 12, 2012, 10:30:48 AM by RenderMan »
"How we think determines what we do, and what we do determines what we get."

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Caps Lock
« Reply #31 on: April 12, 2012, 10:20:06 AM »
Great suggestion, and a bit cleaner
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Caps Lock
« Reply #32 on: April 12, 2012, 10:51:13 AM »
I'd use wcmatch like so:  :-)

Code - Auto/Visual Lisp: [Select]
  1. (if (wcmatch (car plist) "*TEXT*,*EDIT")
  2.   (capslock ;| T/Nil |;)
  3. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Caps Lock
« Reply #33 on: April 12, 2012, 10:53:31 AM »
I'd use wcmatch like so:  :-)

Code - Auto/Visual Lisp: [Select]
  1. (if (wcmatch (car plist) "*TEXT*,*EDIT,MLEADER")
  2.   (capslock ;| T/Nil |;)
  3. )
added one
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Caps Lock
« Reply #34 on: April 12, 2012, 10:58:13 AM »
I updated the attached reactor code to add a few more and incorporated the wcmatch.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Caps Lock
« Reply #35 on: April 20, 2012, 10:07:06 AM »
Well I've been using this for over a week (with the reactor) and I have to say it is fabulous.  I never have to touch the caps lock key. No more shouting in my emails.

Thanks to all who were involved, great group effort.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

BlackBox

  • King Gator
  • Posts: 3770
Re: Caps Lock
« Reply #36 on: April 20, 2012, 10:23:02 AM »
I'm glad you're finding this tool useful, Tim - I am also happy with the result of this little collaboration.  :kewl:

I have also been using this in a reactor, and have only come across one situation where behavior is not what I expected... when editing a table. For example, double clicking a cell to enter text, the capslock is turned on correctly. It is when I Tab into the next cell.

I added a (Print (car cmd)) call at the top of my CommandWillStart, and CommandEnded Callback functions, and it appears that Tabbing into the next cell cycles the TableEdit Command. I've had different results when using Tab, and the arrow keys.

... Just thought I'd share.
"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: Caps Lock
« Reply #37 on: August 17, 2012, 10:24:33 AM »
Code updated here... Summary of changes:

** Update - 2012-08-17

Additional 'LispException' Classes added for completeness (thanks Gile!), and attached the following assembly versions:

LispKeys2010.dll (compiled to .NET 3.5 for 2010 database format)
LispKeys2013.dll (compiled to .NET 4.0 for 2013 database format)

... Next enhancement will streamline, adding Methods (sub-functions) to remove duplicate code.
"How we think determines what we do, and what we do determines what we get."