Author Topic: A person who shall remain nameless ...  (Read 19464 times)

0 Members and 1 Guest are viewing this topic.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
A person who shall remain nameless ...
« on: April 05, 2005, 03:35:43 PM »
... in a forum similarly unnamed posted a response to another poster, all in annoying uppercase.

A lengthy paragraph of BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA ...

I responded with this --

Code: [Select]
Private Declare Sub keybd_event _
    Lib "user32" _
    (ByVal virtualKeyCode As Byte, _
    ByVal stubbed As Byte, _
    ByVal flags As Long, _
    ByVal pointerToExtraInfo As Long)

Private Declare Function MapVirtualKey _
    Lib "user32" _
    Alias "MapVirtualKeyA" _
    (ByVal virtualKeyCode As Long, _
    ByVal translate As Long) _
    As Long

Private Declare Function GetKeyState _
    Lib "user32" _
    (ByVal virtualKeyCode As Long) _
    As Long
   
Private Const _
    VKC_CAPSLOCK = &H14, _
    TRANSLATE_TO_SCANCODE = 0, _
    SCANF_KEYUP = &H2, _
    SCANF_KEYEXT = &H1, _
    SCANF_KEYNOTEXT = &H0, _
    NULL_POINTER = 0
   
Sub StopShouting()
    If (GetKeyState(VKC_CAPSLOCK) And 1) Then
        Call keybd_event( _
            VKC_CAPSLOCK, _
            MapVirtualKey(VKC_CAPSLOCK, TRANSLATE_TO_SCANCODE), _
            SCANF_KEYEXT Or SCANF_KEYNOTEXT, _
            NULL_POINTER)
        Call keybd_event( _
            VKC_CAPSLOCK, _
            MapVirtualKey(VKC_CAPSLOCK, TRANSLATE_TO_SCANCODE), _
            SCANF_KEYEXT Or SCANF_KEYUP, _
            NULL_POINTER)
    End If
End Sub

Sub Main()
    Call StopShouting
End Sub

Person sends me an email, "NOT TO SOUND MORE STUPID THAN I ALREADY AM ... WHAT DID ALL THAT CODING STUFF MEAN?"

True story.

An aside, if you propeller heads are curious ... keybd_event, MapVirtualKey and GetKeyState.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
A person who shall remain nameless ...
« Reply #1 on: April 05, 2005, 03:46:00 PM »
Bawahahah! Thats funny!

Hey BTW, thats perdy cool, did you write that MP?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
A person who shall remain nameless ...
« Reply #2 on: April 05, 2005, 06:05:27 PM »
I found a couple links using google. Neither of them did exacty what I wanted and / or worked under XP, but it was enough that when I went to MSDN I knew what I was looking for which enabled me to write what I wanted. Funny code (in the context that it was provided) but it does work.

I write my VB similar to my LISP, insomuch as the vertical style is concerned.

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
A person who shall remain nameless ...
« Reply #3 on: April 05, 2005, 06:43:04 PM »
Thanks for the code bit, that will be really helpful. I am thinking about putting it into a module that will take off caps lock when the browser has focus. That should prevent me from shouting at everyone ...
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
A person who shall remain nameless ...
« Reply #4 on: April 05, 2005, 07:36:44 PM »
Glad you can use it for something Keith. I wrote and posted it as a joke - when the lads at work found out it was actually functional they lost it. Admittedly, we're a weird bunch. :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
A person who shall remain nameless ...
« Reply #5 on: April 05, 2005, 09:34:10 PM »
That's when i found i the funniest. I teied it out and i almost wet my pants laughing!

Keith, make it so that anytime you launch TEXT, DTEXT it turns caps on.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
A person who shall remain nameless ...
« Reply #6 on: April 05, 2005, 11:12:33 PM »
I can do that ... Look for a neat little VBA app coming soon to a swamp near you..
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
A person who shall remain nameless ...
« Reply #7 on: April 08, 2005, 09:20:41 AM »
Ok, boys and girls ... here is the very first incarnation ... well if you count the code above, it is the second. I had to do alot of changes to the code so it would work properly in other Windows platforms, but credit for the original idea goes to MP.

The premise is that when a window becomes active it notifies the OS, we can intercept those calls with a simple timer, get the active window, determine what application it is from, and if it is AutoCAD, turn Caps Lock ON if it is a browser window, turn Caps Lock OFF. Well, that is how it is SUPPOSED to work.

I don't have FireFox installed here unfortunately so I am not able to verify it working properly with it. If anyone has a problem with it working properly send me a screenshot of the browser window or AutoCAD window and I will attempt to resolve the problem.

And give me some feedback ...

Enjoy .. I know that I am going to use it...
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

daron

  • Guest
A person who shall remain nameless ...
« Reply #8 on: April 08, 2005, 09:25:57 AM »
It works just fine in Firefox and Autocad. That is sweet.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
A person who shall remain nameless ...
« Reply #9 on: April 08, 2005, 09:41:30 AM »
Did you see that it puts a little icon in the systray? To close the app, simply right click on the icon and select EXIT, otherwise it stays running in the background.
Total memory usage in my tests has been observed between 3 and 5 megs, while it is a little high for the size of the app, I think most of it can be attributed to the overhead needed to run in the systray.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
A person who shall remain nameless ...
« Reply #10 on: April 08, 2005, 09:51:46 AM »
Well, it works fine going to FireFox, but does not work going to Autocad(Actually LandDesktop3 which is based on R2002)

How hard would it be to add options for email/newsgroup clients?

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
A person who shall remain nameless ...
« Reply #11 on: April 08, 2005, 09:59:41 AM »
*lol* Awesome! I love it!

What about this option. (Maybe this will be easier) In Acad; Toggle the caps on before the Text is typed and after the command is over, toggle it off.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
A person who shall remain nameless ...
« Reply #12 on: April 08, 2005, 10:05:11 AM »
It shouldn't be too difficult to add email and newsreaders. I was thinking of making it so that the user could add their own apps and state of CapsLock for those apps, but that was a whole lot more coding than I found myself wanting to do on a project that might amount to nothing.

I didn't have access to LDD or any of the other add-on packages offered by Autodesk, as a result I was not able to determine what criteria to use in order to properly manage it.

I'll see what I can do, in the meantime, if you can let me know which ones you want to add or simply send me a screenshot of each app you would like it to work with.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
A person who shall remain nameless ...
« Reply #13 on: April 08, 2005, 10:28:48 AM »
Quote from: Keith

I'll see what I can do, in the meantime, if you can let me know which ones you want to add or simply send me a screenshot of each app you would like it to work with.

Thanks Keith.
Here's a pic of what I use other than Firefox.

daron

  • Guest
A person who shall remain nameless ...
« Reply #14 on: April 08, 2005, 10:50:18 AM »
I think Se7en's idea would be ideal, since there are a few areas that would be useful to have them off, such as login after screensaver was activated.