Draygoes Posted November 15, 2017 Share Posted November 15, 2017 (edited) Hi all, I make this thread in reference to this help topic. Call it my "thank you" for the help. This actually came about as a random thought while I was taking a smoke break. I personally almost never use the capslock button, so why not find a way to make it more useful right? And yes, the title is a play on MAGA. No political attachment , just thought it funny. Anyway, here is code. Global Const $VK_CAPITAL = 0x14 $WshShell = ObjCreate("WScript.Shell") While 1 Sleep(100) If _Key_Is_On($VK_CAPITAL) Then Run("notepad.exe") $WshShell.SendKeys("{CAPSLOCK}") EndIf WEnd Func _Key_Is_On($nVK_KEY, $vDLL = 'User32.dll') Local $a_Ret = DllCall($vDLL, "short", "GetKeyState", "int", $nVK_KEY) Return Not @error And BitAND($a_Ret[0], 0xFF) = 1 EndFunc This is autoit that we are talking about, so you can probably come up with a number of functions and scripts to be fired on press. I hope someone finds this useful. Edited November 15, 2017 by Draygoes Xandy, Earthshine and sylremo 3 Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
Earthshine Posted November 15, 2017 Share Posted November 15, 2017 I use caplocks all the time. I type a lot. 😀 My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Draygoes Posted November 15, 2017 Author Share Posted November 15, 2017 29 minutes ago, Earthshine said: I use caplocks all the time. I type a lot. 😀 Then an alternate use for you might be to have it fire something upon switch on, but not switch it back off again. Earthshine 1 Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
Draygoes Posted November 16, 2017 Author Share Posted November 16, 2017 @Earthshine Here you go... modified version for you to use in case you want the capslock to do more than one thing yet still work normally. Global Const $VK_CAPITAL = 0x14 $WshShell = ObjCreate("WScript.Shell") $rancommand = 0 While 1 Sleep(100) If _Key_Is_On($VK_CAPITAL) Then If $rancommand = 0 Then Run( "notepad.exe");Place command to run when capslock is on here. $rancommand = 1 EndIf EndIf If Not _Key_Is_On($VK_CAPITAL) Then $rancommand = 0 EndIf WEnd Func _Key_Is_On($nVK_KEY, $vDLL = 'User32.dll') Local $a_Ret = DllCall($vDLL, "short", "GetKeyState", "int", $nVK_KEY) Return Not @error And BitAND($a_Ret[0], 0xFF) = 1 EndFunc coffeeturtle and Earthshine 2 Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
TheSaint Posted November 17, 2017 Share Posted November 17, 2017 (edited) Goodo. Personally, I find it rare to use Capslock, and usually I find it more trouble than it is worth ... when a dumb finger turns it ON without telling you, and you either don't notice the light (generally at far right and out of your central view) or just don't have one or it's stopped working. So the very rare times I might want to type continuously in UPPERCASE, mean the Capslock key is kind of mostly redundant, and I could easily live without it, so personally I would like to disable it or have it ONLY work for something else. Failing that, having something to keep tabs on it and turn it OFF if ON, would be great. P.S. Clearly I am not one of those very good typists, who keep their view on the screen and notice errors before much has been typed ... if only. And YES, I have done some typing courses ... I did work in a Communications Center once ... but unless you regularly type on pages, and are not constantly doing Form like material, it is hard to maintain a rhythm, and I find rhythm is key (sic) to success with good typing. Edited November 17, 2017 by TheSaint Draygoes 1 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Earthshine Posted November 17, 2017 Share Posted November 17, 2017 (edited) my keyboard is programmable anyway. lol. Love my mechanical keyboards, I do like it though. running notepad is a good idea, i do that a ton to look through log files and whatnot Edited November 17, 2017 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Draygoes Posted November 18, 2017 Author Share Posted November 18, 2017 (edited) The Run('notepad.exe') is just filler for another function that I use. My thinking was simple. Everyone has notpad, so its a fast way to test the script.@TheSaint Oh I know right? More often than not it was an aggravation. My theory was that one forgets its there due to lack of use, thus making it easier to accidentally hit. Over the last few days the code above has become an interical part in my normal command set (I have a list of scripts that run on startup based entirely on includes in a main autoit script, thus making it modular...), and I have not had a problem with accidentally hitting it sense then. Ultimately the small amount that I type in all caps can be mitigated by holding SHIFT, leaving the capslock key redundant at best. Edited November 18, 2017 by Draygoes TheSaint 1 Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
argumentum Posted November 19, 2017 Share Posted November 19, 2017 (edited) The truly useless key nowadays, is the "Scroll Lock". So I use as a "play a macro ON" key. In this case for speaker volume control. expandcollapse popup#include <WinAPIvkeysConstants.au3> Global $hDLL = DllOpen("user32.dll") OnAutoItExitRegister("OnAutoItExit") Func OnAutoItExit() DllClose($hDLL) EndFunc main() Func main() Local $iScrollState = BitAND(_WinAPI_Key_GetState($VK_SCROLL, $hDLL), 1) If Not $iScrollState Then Send("{SCROLLLOCK}") $iScrollState = BitAND(_WinAPI_Key_GetState($VK_SCROLL, $hDLL), 1) If Not $iScrollState Then Exit MsgBox(262144+16, StringTrimRight(@ScriptName,4), 'failed to turn on "Scroll Lock"',5) If $iScrollState Then Send("{SCROLLLOCK}") $iScrollState = BitAND(_WinAPI_Key_GetState($VK_SCROLL, $hDLL), 1) If $iScrollState Then Exit MsgBox(262144+16, StringTrimRight(@ScriptName,4), 'failed to turn off "Scroll Lock"',5) ; the above code is to make sure we are affecting the keyboard $iScrollState = BitAND(_WinAPI_Key_GetState($VK_SCROLL, $hDLL), 1) Local $iScrollStateWas = $iScrollState While 1 $iScrollState = BitAND(_WinAPI_Key_GetState($VK_SCROLL, $hDLL), 1) If $iScrollStateWas <> $iScrollState Then $iScrollStateWas = $iScrollState If $iScrollState Then ToolTip("SCROLLLOCK is ON") HotKeySet("{PAUSE}","f_PAUSE") HotKeySet("{UP}","f_UP") HotKeySet("{DOWN}","f_DOWN") HotKeySet("{ESC}","f_ESC") Else HotKeySet("{PAUSE}") HotKeySet("{UP}") HotKeySet("{DOWN}") HotKeySet("{ESC}") ToolTip("") EndIf EndIf Sleep(50) WEnd EndFunc Func f_PAUSE() Send("{VOLUME_MUTE}") ToolTip("VOLUME_MUTE") Send("{SCROLLLOCK OFF}") ; return keyboard use EndFunc ; by {SCROLLLOCK OFF} Func f_UP() Send("{VOLUME_UP}") ToolTip("VOLUME_UP") EndFunc Func f_DOWN() Send("{VOLUME_DOWN}") ToolTip("VOLUME_DOWN") EndFunc Func f_ESC() Exit ; just in case you hide the Tray icon EndFunc Func _WinAPI_Key_GetState($vKey, $vDLL = 'user32.dll') ; read help on _WinAPI_GetAsyncKeyState() and DllOpen() Local $aRet = DllCall($vDLL, 'short', 'GetKeyState', 'int', $vKey) If @error Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==>_WinAPI_GetKeyState Func _WinAPI_Key_Pressed($vKey, $vDLL = 'user32.dll') ; read help on _IsPressed(), but use Virtual-Key Codes (WinAPIvkeysConstants.au3) Local $a_R = DllCall($vDLL, "short", "GetAsyncKeyState", "int", $vKey) If @error Then Return SetError(@error, @extended, False) Return BitAND($a_R[0], 0x8000) <> 0 EndFunc ;==>_IsPressed Also here is the version of _IsPressed() I use. Edited November 19, 2017 by argumentum tweaked code and comments Draygoes and coffeeturtle 2 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Earthshine Posted November 19, 2017 Share Posted November 19, 2017 (edited) My Razor Black Widow Ultimate has built in hardware control keys. Maybe I will assign scroll lock to autoit Edited November 19, 2017 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
argumentum Posted November 19, 2017 Share Posted November 19, 2017 2 hours ago, Earthshine said: My Razor Black Widow Ultimate I use a Dell SK-8115 and bought a K70 LUX RGB. I'm back to my old keyboard. The software for the K70 did not do what it was supposed to do and the keys sucked and $^@#$!. So much for the gaming keyboard. If i could only have my Dell keyboard, with keys, as the look now AND backlighting, I'd be super happy. I'm returning the K70 on monday, if you know of a keyboard that would illuminate all the symbols ( like the "2" and the "@" on the VK_2 ), with thin fonts, do let me know, as that is what I wish I could find. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
TheSaint Posted November 19, 2017 Share Posted November 19, 2017 (edited) I think all my keyboards have buttons (or a combo) to use for volume control. probably the number of times I remember to use them though, could be counted on one hand ... two at most. I don't use volume much on my PCs ... and when I do, it is mostly through headphones. Notepad is a good option for most I imagine, but for me personally, that is not how I ever use it ... browsing. Can't remember the last time I did that .... always double-click or right-click for me, and many of my programs have built-in access to Notepad. I even created a kind of Frontend for most text based files, that gives choice of Notepad or Wordpad or ScITE etc. P.S. I have thought about whipping up a script to do all i want, that is running in the background all the time, but mostly I need to reduce resources being used, especially on this PC, that I browse the web with. Edited November 19, 2017 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Draygoes Posted November 20, 2017 Author Share Posted November 20, 2017 7 hours ago, TheSaint said: P.S. I have thought about whipping up a script to do all i want, that is running in the background all the time, but mostly I need to reduce resources being used, especially on this PC, that I browse the web with. See, thats why I have a modular script running on startup through the autoit compiler. Far less resource intensive than multiple compiled exe's, and crazy easy to modify. Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
Earthshine Posted November 20, 2017 Share Posted November 20, 2017 My cherry mx buttons are fine. I don’t use their custom software I just use the Microsoft built in drivers. Lol My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
TheSaint Posted November 20, 2017 Share Posted November 20, 2017 3 hours ago, Draygoes said: See, thats why I have a modular script running on startup through the autoit compiler. Far less resource intensive than multiple compiled exe's, and crazy easy to modify. With this web browsing Netbook of mine, I really can't afford to have even one script running constantly in the background, as I am low on resources before I start. Maximum RAM which I have installed is 2 Gb, and the longer it is running the more degraded the performance, and rebooting to refresh is not really a favored option, when it can take 20 minutes or more to complete. No doubt this age of hungry AV and Browsers etc play a big part. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
argumentum Posted November 20, 2017 Share Posted November 20, 2017 (edited) On 11/19/2017 at 11:05 PM, TheSaint said: I really can't afford to have even one script running constantly in the background, as I am low on resources before I start. hmm, ...being lazy gets expensive after a while. I use chrome as a main browser and it can chew up those 2 Gb. for no good reason in no time and this is with 7 open tabs. Edited February 10 by argumentum removed the pic. (needs the space) Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
TheSaint Posted November 20, 2017 Share Posted November 20, 2017 I try to limit my open tabs in Firefox to about 5, but sometimes it is more for a variety of reasons. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Earthshine Posted November 20, 2017 Share Posted November 20, 2017 I have an ultra cheap AMD based notebook. I feel your resource poor pain. It was $200 at Amazon But it runs really fast when configured correctly My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Earthshine Posted November 20, 2017 Share Posted November 20, 2017 (edited) Chrome has a built-in task viewer and it will show you what all those instances are for. Chrome manages it’s on tasks and every tab is another task and that way if one crashes they don’t all crash so that’s a good reason Edited November 20, 2017 by Earthshine Draygoes 1 My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
argumentum Posted November 21, 2017 Share Posted November 21, 2017 8 hours ago, Earthshine said: that way if one crashes they don’t all crash so that’s a good reason it should not crash !!! But really, the same browser in android surely uses less memory, so, wassup with that !. I have 32 gb on this PC, but in a new, 8 gb pc or lappy, the swapping to disk, slows the fastest CPU. Still, I use chrome w/AdBlock. No anti-virus. If I had to use IE ( for an ActiveX in a business app. ), I'd need a good anti-virus, so also, for the integration w/gmail in the google world, chrome is the way ( for me ) For netflix and xfinity cable TV, I use Opera v49.0 . xfinity don't wanna run in chrome Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Earthshine Posted November 21, 2017 Share Posted November 21, 2017 (edited) in a perfect world, nothing would crash. i have a cheapo laptop that runs amazingly fast with only 4GB mem and a tiny swap file. maybe you're doing it wrong. 512 MB ram is reserved for the onboard video, and I can develop on it. lol soon it gets an SSD and 8GB upgrade HP Notebook 15 ba009dx was only 200 dollars on Amazon six months ago! of course, I formatted the HD to get rid of all the crapware and went with latest Win10 Pro (already had license). It has virus protection built in, and I added Malwarebytes Premium (but there can be issues with that, beware, it can be a HOG, but you can tame it). I turn off all the snooping crap With O&O Shut-Up 10 I use uBlock Origin chrome extension for ad-blocking. remember that EVERY single extension is a separate process to chrome, therefor all the threads in the process viewer. https://www.oo-software.com/en/shutup10 https://www.malwarebytes.com/ I have never been touched by a virus yet in my career of well over 35 years in the field. I practice safe browsing habits. Edited November 21, 2017 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now