Is it possible to have windows autocomplete custom commands? - autocomplete

I'm running Console2, which I believe is just an interface to windows cmd
I have a custom batch file that does most of my dirty work for me, but there are lot of commands in it now. Is there a way I can get a tap autocomplete working for it in the windows command prompt?
For example: my script is called rob.bat and it takes in a various number of arguments
It'd like to type rob set{Tab} and then have it cycle through
setup_envvars
setup_userprefs
setup_whateverothersetupscriptsIhave
Is there a way to do this?

Console2 has no special provisions for tab completion and instead relies on the program running within it to provide such features. Picture Console2 as little more than something that runs a console program hidden somewhere, regularly polls that hidden window for changes, and forwards all input to that window; this is, in essence, what's happening.
Note that Console2 does nothing special with cmd. You can run any shell within it. As for customizing tab completion, cmd offers nothing of that sort. You may be able to change this by installing clink, which has extension points for Lua code. Another option would be PowerShell, which has customizable tab completion out of the box, either by wrapping your program in a function that provides the necessary parameters, or by writing a custom TabExpansion or TabExpansion2 function.

Related

Eclipse keybindings. Setting up a shortcut for executing a specific run configuration

I'm trying to setup a key binding in Eclipse to directly execute a background Java file. My file is called CodeChecker.java and it's sufficient for my purposes to run the main method without any arguments. I need to run it repeatedly and so I'm trying to setup a shortcut key to run it directly without having to bring up the Run... menu or having to bring up the file itself.
As far as I'm aware Eclipse is not able to offer this functionality directly. I've tried using a plugin called Practically Macro according to this answer Assigning a keyboard shortcut for a specific Eclipse build configuration. But this answer is horribly out of date and doesn't work any longer.
So I'm wondering if Practically Macro can still be used to achieve this? Any other solution, plugin, script or otherwise would be equally welcome.

Powershell won't pass keystroke to cli window

I first need to offer the disclaimer that I am barely a novice when it comes to scripting or coding, so I might be doing this all wrong in the first place. I'm running into an issue with a script I had written in powershell a while ago that is used on several hundred computers in my company daily to automate starting a certain app that everyone uses. So far everyone else hasn't had an issue except one machine.
Normally when I run the script, it starts the services and cli for the program which opens in a new window. Then the script, still open behind that, sends all of the key commands to that cli window, pauses for a brief line of user input after which it closes that cli window, does a few other clean up tasks and closes out itself.
The only difference on this one machine that's not working is the script won't pass the keystrokes to the cli window. If I put them in manually including the normal user input, it finishes the rest of the script just fine, but the cli window is just not receiving the keystroke input from the main script.
The only part of the script that send the keystrokes to the cli window is a few lines of this:
[System.Windows.Forms.SendKeys]::SendWait("Text{Enter}")
I have tried using the sleep command before and in between the key commands to make sure it's not going through the keystrokes to early. I've checked and windows had gone through an Update two days ago, but we would've heard about this issue right then if that was it. I'm at a loss for what the issue could be and would apreciate and help, tips, or direction to help figure this one out.
Is the console window the active window when the keys are sent? The documentation for the class you are calling indicates that it sends the keys to the active window. Not only that, but the documentation also seems to indicate that there are some issues that developers have run into when using that class to sends keys. I would try using the autoit powershell module instead. Autoit is its own scripting language which specializes in automating windows processes and being capable of automating interactions with windows forms, but also comes bundled with its own powershell module that I think is exactly what you need, so I would download the portable "zip" package, extract the powershell module from "Autoitx", and that should help you accomplish what you need
PowerShell automation especially when using SendKeys can / is glitchy due to many varying reasons. Can you use SendKeys sure, but you have to know the environment it will be run in and the needed performance details. Hence your futzing/guessing with Sleep.
There are purpose-built tools to help.
Auto HotKey
'PowerShell auto hotkey'
or the UIAutomation tool
'PowerShell automating other applications'

Does everything done through GUI (in Windows) have a command line equivalent?

Does everything you do in the GUI in windows (i.e. through pointing, clicking and typing) have a command line equivalent, or are there some things (or maybe a lot of things) the command prompt can’t do?
FYI I'm very new to using the command line and just curious
Microsoft does not guarantee that, but it does gradually allow every changes on UI to have a related PowerShell cmdlet.
Thus, you'd better check out PowerShell, which is more related to server management, than programming.

How to fill textboxes on a website with MATLAB

I'm trying to use MATLAB to fill in textboxes on a webpage in Internet Explorer without typing directly into the URL. Can anyone explain to me how to do this? I'm pretty lost. I really appreciate any help you can give me.
Thanks!
While I have seen this done before (i.e. running a MATLAB script that automatically fills in fields in Internet Explorer), to the best of my knowledge, I do not believe that there is an actual MATLAB command to directly interface with IE.
Instead, you can make use of the MATLAB command system to call an external program that actually does the interfacing with IE.
For example, you might be able to make a Visual Basic program that interfaces with IE through the InternetExplorer object. I'm not too familiar with VB, but this doc might help. Once you've created this program, use MATLAB's system command to execute it (passing command-line arguments to define what/how to fill in the textboxes).
Take a look at the doc for system for more info.
I've done it many times with a small program called Autohotkey.
With this program you can write a script, that will move the mouse / click the keyboard. you can pass string arguments and use it inside the script. once done, you can call this script from matlab.

powershell.exe tab completion - list alternatives?

I've never really used PowerShell before, and playing with it a bit, it looks like it uses cmd.exe's style of tab completion (fill in the first likely candidate, and then you can use tab to cycle through other alternatives). I'd much prefer the way e.g. bash works, where if there are multiple candidates, it shows a list of them.
Is there an easy way to turn this on, by any chance?
I have seen this implemented with an add-on called PowerTab (original post). For script editing there are some editors that support this sort of drop down Intellisense. Check out the free PowerGUI editor.
You want PSReadline: https://github.com/lzybkr/psreadline
It includes many completion and shell experiences you might expect from bash, etc.