I'm using AHK for a while and I love it! But today I noticed something weird.
I tend to use scripts to automate things like task switching, audio mute/unmute on applications, etc.
I started playing the game Call of Duty: Black Ops 4 and my hotkeys were acting weird. They did what they should, but with a few "extra" actions I didn't want. The problem was, that AHK couldn't block access to any keys which was bound to an action in the settings of the game.
Step by step I tried to fix this and narrow down what the specific problem could be. I tried things like:
F1::
Send, f
Return
F1::Return
VK70::Return
SC03B::Return
None of these worked. Yes, the first one wrote the character "f" when the chat was open, but all of them did the action what it should for the game.
And another example of this control of the game is the Caps Lock key, which can't be used in some situations, because it toggles the Map in-game. And to prevent confusion when using the chat, the developers disabled it when it can be used as a map toggle. Because of this, I can't bind any AHK hotkey to Caps Lock, because it won't fire when it is blocked by the game.
I'd like to ask if I could "catch" these keys earlier somehow, before it reaches the applications? How could I implement my script lower, than it is by default?
Thanks in advance!
My AutoHotInterception library uses a custom device driver and allows you to block below the OS layer. You want the "Subscription Mode" method, not the "Context mode" method.
Related
I'm trying to build a script in autohotkey which will make it annoying for myself and fellow users of the flashcard program Anki from quitting midway through a study session.
So far I have written the following
InputBox, TimeMin, ATTENTION, Enter how long would you like to commit to answering flashcards in minutes.
TimeMili:=TimeMin*60*1000
SetTimer, Meh, %TimeMili%
a:=0
While a < 1
{
IfWinActive User 1 - Anki
{
MouseMove,1298, 981
WinKill Task Manager
WinMaximize User 1 - Anki
}
Else
{
WinKill Task Manager
IfWinExist User 1 - Anki
{
WinActivate User 1 - Anki
MouseMove,1298, 981
}
}
}
return
!F4::
MouseMove 350,350
return
Meh:
MsgBox WELL DONE U R NOW FREE
SetTimer,,OFF
a:=10
Return
Lwin::
Return
Rwin::
Return
This script disables alt + f4, kills taskmanager, maximizes the anki window whenver it is minimized and prevents the mouse coming near the red exit button on the outside of the programs window for a user-defined number of minutes. As anki can be navigated without using the mouse, this selectively impedes procrastinating actions without impeding studying.
The script works pretty well, but it can be overcome by restarting the computer or doing a slow logout via control alt delete (win + L doesn't terminate script). Control alt delete is very hard to disable on modern windows builds, likely as a malware prevention safeguard.
My proposed solution is to have the script perform some annoying action (e.g. deleting all desktop shortcuts) when activated, and to undo that same action when the user-defined time period terminates. I believe this would leave the annoying action unfixed if the user logs out/shuts down/restarts/slow log offs.
I've considered using the script to create another annoying script in the startup folder, but this can be circumvented by just logging out rather than restarting/shutting down.
Renaming/deleting keyboard shortcuts is only annoying if the user has a lot of keyboard shortcuts.
Creating a ton of text files on the desktop and other folders is too easy to reverse and can just be ignored by the user until they have finished procreastinating
Disabling the internet would be good, but it would still leave offline distractions (e.g. video games) available.
How best to go about designing such an action that will temporarilly disable a PC that is trivial and reliable, but timeconsuming and boring to undo?
While your AutoHotkey solution is a clever way to dissuade people from exiting out of the program, you will never get a true 100% rock solid solution for the following reason: you are logging in with a user that is allowed to do stuff. If you can do stuff, you and others will figure out a clever way around to do it, and no, as amazing as AutoHotkey is, it can't disable the unplugging of a power cord.
On the other hand, yes, you can make the penalties for circumventing the protections increasingly painful (up to the penultimate format c: nuclear option, which I would garner guarantees 99% compliance), but you will always start to run into issues, and still you won't get compliance.
The better solution is to use features that are baked into Windows via Group/Local Security Policies that will limit things. By using a special user with locked down privileges, they physically won't be able to do things because they can't (for ex. you can disable the start menu, power options, sites, etc.).
You really want to lock things down to a single app? Well Windows has a special Kiosk Mode where you literally can -only- have one app running, and you can't get out of it no matter what. There are dozens of special Kiosk Policies that can be applied from removing sign out options from Ctrl-Alt-Delete to Removing Task Manager.
I have to develop a browser based game with WebGL (for cross-platform support) using Unity that allows people with severe disabilities to take full control of their experience. This also includes opening and closing the application on their own. Opening the browser and game is pretty straightforward since these people can simply open them using a program provided by another company (like Tobii), but now I am facing an issue when trying to close the window again, since there doesn't seem to be a way to achieve this from within the browser/game.
My question is, is there a way to close the browser with JavaScript or maybe even in Unity itself? Or should I look towards creating an application outside of the browser with something like Java (for cross-platform support) that manages the browser window?
I already looked into ways of doing it via JavaScript or even from within unity, but I simply couldn't find a solution. I tried using JavaScript's windows.close() function, but that only works on windows opened from within JavaScript itself by the looks of it. Looking at a stand-alone application then leaves the question of how to detect an exit request from the user when they are done playing the game.
What I am looking for is a way for them to select an 'exit' button within the game which then closes the browser, so they can return to their assistance program, without the help from another person.
Currently, the user is only able to make use of a single button and can't control mouse or cursor themselves, meaning that they can't close the browser on their own.
tl;dr how can I close a browser window using an exit button in a WebGL Unity game for a person who isn't able to themselves due to a handicap?
Pretty sure you can't
And that goes back to window.close only working on windows opened with JS. Originally it could close any window, but people started abusing that fact (think about things like the self-retweeting tweet, except it also closes your browser tab!)
So the restriction got added.
This is why we can't have nice things.
I really enjoy using vs code but there are some many shortcuts to remember and every new plugins come with a new set.
Of course, I can use the command palette in order to quickly execute a command, but I would like something even more faster such as assigning a shortcut to any of the keys for a device like a Novation Launchpad midi controller.
Stackoverflow is maybe not the best plase to ask this question but I didn't knew where to post it, so is there anyone who tried something like this? I have seen this video (https://www.youtube.com/watch?v=LOyNUGS4RC8) linking such a device with visual studio so perhaps someone created a software dedicated for vs code already.
Regards,
Johnny -
I've setup this with MIDI Loupe and midiStroke.
MIDI Loupe listens your device and logs channel/key/value you just hit on your midi controller - with this tool you inspect your device's output.
Then in midiStroke you map controls to shortcuts.
Note: I've found my midiStroke setup for M-Audio Axiom 49 keys don't require values (only key number) but controls (e.g. record start) do require it. Also for me letter keys didn't not work if uppercased (e.g. for garageband recording start I need simply R button hit and R should be r in this case)
Detailed tutorial here
I'd like to configure emacs a little differently when coming in over remote desktop. I can detect the rdp session, but I'd like to automatically run the function that checks when emacs wakes from sleep. I believe Windows issues a PBT_APMRESUMESUSPEND event when awakening because of user activity -- is there a way to hook this from within emacs?
This would be for emacs 24.4 on Windows. Some code or a pointer to the right documentation would be great. I've looked but am not seeing anything -- maybe I'm not looking in the right place. Thanks in advance.
I don't know of any hooks that are triggered in your situation, would it be possible to solve your situation using the input focus hooks?
Specifically, focus-in-hook.
Basically I've used 2 keyboards for a very long time for the sake of personal convenience, but now there's something that's really bugging me. I'd like to remap the spacebar on my second keyboard to w/e so that I can play a particular game with two separate space bars.
Problems I've encountered so far is that keyboard remapping software tend to remap the keys for both keyboards. Or the remaping doesn't work in-game although it seems to work fine in notepad or such. Mostly likely since the remapping occurs on a higher level then where the game is fetching it's inputs.
Here's what did on HIDmacros;
For the trigger kbd6 32 ()
HIDMacros.SendKeys "p"
Not much but I'm not too savvy in this field haha
Does anyone know how I may achieve this?
-Edit: Oh and the ability to "hold" the key is a must, or else they'd be no point in doing this :/. I'm thinking hardware modifications at this point haha
I was able to use AutoHotKey AHKHID script and SharpKeys to accomplish something similar.
Using SharpKeys I remapped the key (in your case it's spacebar) to some fictitious key.
Then using AutoHotKey with AHKHID script, I was able to listen to strokes on that key, and determine from which device it was sent -
Then I would simulate the wanted key stroke.
I believe this could work in your situation (also, I simulate the up and down strokes, so "holding" works).
I've posted the full solution on the AutoHotKey's forum:
http://www.autohotkey.com/board/topic/38015-ahkhid-an-ahk-implementation-of-the-hid-functions/page-29#entry631055
Good luck