Windows "Double-Shortcuts" for batch scripts - windows

In Windows we can create a shortcut for any batch script and assign a shortcut for it. (Right-Click on shortcut->Properties->Shortcut key)
How can I assign a double-shortcut for a shortcut like this? For example Ctrl+Alt+J, Ctrl+Alt+K. When I press Ctrl+Alt+J and Ctrl+Alt+K in a sequential order I want the batch script to execute.
Is this possible in Windows? If this method doesn't work, is there any other method this can be achieved through?

No, assigning a combination of hotkeys is impossible. Windows shortcuts are essentially stored IShellLink objects. The object's GetHotKey() documentation shows that only a single hotkey can be used.
Perhaps you could try AutoHotKey. Although I have no experience with it, AHK is usually the solution for such things.

You can also use the SHIFT key which will give you more combinations of keys.
CTRL+ALT+key
CTRL+SHIFT+key
CTRL+SHIFT+ALT+key
SHIFT+ALT+key

Related

Emacs on Windows: mapping the Meta key to something else than Alt

I read for a few hours on different threads for this issue without any results. Every time I was doing searches for something like
"lwindow" meta
I was always getting into EmacsWin32 code which appears to be code developed in 2006.
So, here I am to ask the question:
Is it possible to remap the Meta key, for Emacs, in Windows to something else than Alt?
I would prefer to remap it to the Windows key, but I don't think it is possible. Then the Fn (function) key would be a good alternative.
I need my Alt key operational in Emacs since it is used for all kind of things on a French keyboard.
I know nothing about Windows, but w32-pass-alt-to-system, w32-alt-is-meta, w32-lwindow-modifier, and w32-rwindow-modifier seem like good candidates (maybe combined with w32-pass-lwindow-to-system and friends).
Finally the only thing that worked for me is to use the
(require 'iso-transl)
That is making sure that the mapping of my (Canadian) French keyboard is working properly.
Then I started to use the right Alt instead of the left one. That way, I can do everything that I was doing with Ctrl+Alt.

How to implement command autocomplete in myshell?

I am making my own shell in C. I know one can use the readline library to make use of autocompletion of paths using TAB, but it can only be used for autocompletion of paths but not commands.
For example, if I write clea and press the TAB key, it does not make it clear, nor does it give suggestions for any similar commands on pressing TAB twice. How to do it?
Your shell also needs to implement a PATH variable, which is a list of directories to search for non-builtin commands. For instance, if PATH has the value /usr/bin:/bin, then your completion function would complete cle to clear if either /usr/bin/clear or /bin/clear exists.

capturing what keys were used to launch vbscript

I have an application that has 'macro' capabilities. When I map some keys on the keyboard to perform the 'macro', I can also have it launch vbscript instead.
What i'd like to try and do is within my vbscript figure out what keys were used in order to launch the script. Is it posible to do this? Could there be a way in vbscript to figure out what keys were last touched on the keyboard and then I could apply my logic.
The purpose of doing this is to keep the code in a single .vb file instead of several seperate .vb script files(one for each keyboard mapping, possible 3-4). Obviously we are looking to just maintain 1 file instead of multiple files with essentially the same code in each one.
I am leaning towards the idea that this is not possible, but i figured this would be a worthy question for the masses of StackOverflow. Thanks for the help everyone!
What you are asking for is not possible.
Can you change your VBScript to accept parameters and then call it with a different parameter based on which hotkey was selected?
I agree with aphoria, the only way to make something like this possible is if your keyboard mapping software allows you to assign a script/command with parameters/arguments. For example if you used
c:\Temp\something.vbs
then you would change this to
%WINDIR%\system32\wscript.exe c:\temp\something.vbs "Ctrl-Alt-R"
Then in your vbscript code you could collect the argument using the wscript.Arguments object collection to do actions based on what argument/parameter was passed. See the following two links for more info:
http://msdn.microsoft.com/en-us/library/z2b05k8s(VS.85).aspx
http://www.microsoft.com/technet/scriptcenter/resources/qanda/sept04/hey0915.mspx
The one possible approach you may use is to install keylogger and read its log in your VBScript.
For example save script start time in the very beginning of the script
StartTime = Timer()
and then read one log record of your keylogger before this time.

Capturing keycodes in shell?

I am writing my own shell and need to implement a history feature where up and down arrow keys show history of commands executed. I need to find out when up and down keys are pressed.
How do i do this?
you want to be capturing input in raw mode. this can get kinda complicated, but here's an example that should get you on the right path:
http://docs.linux.cz/programming/c/unix_examples/raw.html
i'm assuming you're writing your shell in c. if you're using a more high-level language, there might be an easy way to get raw input. in python, for instance, i would use the ncurses module.

General Purpose Filter As You Type (aka typeahead, Incremental find, autocomplete) is it out there?

Background
Lately I've become a fanatic that everything I type while working on a computer should be compatible with "DRY". If there's anything I have to type more than once in any context, I want some kind of user-aware auto-complete option to do some of the work for me -- always -- no exceptions.
Having to work under Windows, I've looked at GUI solutions to make this insane goal a reality.
The (almost) optimal solution
If you have a moment, open up Firefox 3.0 and type a few keystrokes into the address bar. You will notice that it performs a kind of Incremental Autocomplete based on space-separated sub-strings of whatever you type. Another place in Firefox that does something similar is the about:config URL.
This is sub-optimal, because I don't want this in Firefox only. I want to use this everywhere.
The Question
Does anyone out there know of a widget or app that does nothing but insanely good incremental auto-complete that can be used as a general purpose "run everywhere" tool? Something that allows the user to: 1) maintain one or more "completion candidate files"; 2) pick one of those files as the source for Firefox 3.0 style completion; 3) return the result (or blank if the user canceled), and do those three things only?
Details
Here's how it should work:
STEP1: user saves or more csv file(s) (or other easy-edit format) somewhere in his hard-drive
STEP2: user creates a Windows Script Host script or a batch file (or whatever) instantiates the FilterAsYouType GUI
STEP3: user runs the script file, and the script file instantiates the GUI, telling it which CSV file to use as the source of all potential completions
STEP4: the user either chooses one of the completions, supplies his own text that is not in the list, or cancels out without supplying anything
STEP5: when the user is done the script saves the result to a variable and does something with it
Here is some pseudo-code for the script:
include "GenericTypeaheadWidget";
var gengui = new GenericTypaheadWidget('c:\docs\favorite_foods.csv');
var fave_food = gengui.get_user_input();
if(fave_food != ''){
alert('you chose '+fave_food+'!');
}
The rationale
The goal is to just have a way to always be able to do auto-completions from a list of arbitrary items, even if the list is a couple thousand items, and not have to rely on it being built into some IDE or standalone application that only accepts certain kinds of input or has an overly-complicated API relative to the simplicity of this task.
CSV (or text or sqlite database) would provide a way for me to self-generate "candidate lists" or "history logs" and then just use those logs as the source of the possible completions.
The disclaimer
I've tried several GUI "launcher" programs, command-line engines like power-shell and scripting shells, the regular plain old command-line history with varying degrees of satisfaction. The problem with these is they all do extra superfluous stuff like searching directories or built-in commands. I just want nothing but whatever is in the CSV file I happen to be pointing at.
I'm wondering if there is any simple tool that does nothing but what I'm describing above.
UPDATE: It looks like this question is very closely related to Graphical Command Shell, which captures the essential idea presented here.
You should really try Launchy - it's exactly what you're looking for, a "run anything" with intelligent autocompletion. It completely changes the way you interact with a Windows PC.
And it has open source-code, so you can borrow its autocompletion code if you want to roll your own interface.

Resources