how to enter command in J-link prompt using AutoIt - autoit

All,
When JlinkSTR91x.exe is invoked, it opens up a command prompt J-Link. In this prompt, we can type the commands. I need to do the same using AutoIt scripting.
This is what I tried,
;Execution.au3
Local $foo = Run("C:\\Program Files\\SEGGER\\JLinkARM_V426b\\JLinkSTR91x.exe", "", #SW_SHOW, $STDIN_CHILD)
StdinWrite($foo,"setb 0")
ProcessWaitClose($foo)
When I run this script, J-Link prompt opens up but unable to send the command "setb 0" at this prompt. Please help.

Run("cmd")
$prog = WinWaitActive("C:\WINDOWS\system32\cmd.exe")
ControlSend($prog, Default, $prog, "exit")
Sleep(999)
ControlSend($prog, Default, $prog, "{Enter}")
WinWaitClose($prog)
This does theoretically what you want. Just replace the cmd with your command and insert the actual title of the prompt.You can find it out with the Info-Tool included with AutoIt.
It's just a working example.
And it will even send the text when your prompt isn't active any more. You can even hide your prompt with WinSetState($prog, Default, #SW_HIDE) .

Related

ZSH vi normal mode to move around printed text

Can I use zsh vi normal mode to move around previous commands output or the printed text in the shell to copy/yank it ?
For example in the screenshot below. I want to move to the output of ls to copy something. When I press j/k zsh cycle my command history but doesn't move up to the printed text. j/k move one line down/up only when I have multiple line command that I'm currently writing but haven't executed yet.
To the best of my knowledge, the ability to access the output of commands interactively is the domain of your terminal (-emulator), not the shell. You would use commands like sed, awk, grep, possibly in a pipe, to access, manipulate and use output you know in advance is the part you are interested in.
To access the output with keyboard shortcuts/command-keys, I suggest using the like of tmux - it allows to copy/yank from the whole terminal display as if it was a text-file in an editor.

R help, shell prompt changed and none of the commands work

This question is related to R, I have written >help('[[") instead of >help("[[") and the shell prompt changed from > to + and none of my commands work. How do i get back to the default shell prompt
press Escape key to get out of the + sign

How can I get native Vi mode in R to be persistent?

I have looked at the answers to vi input mode in R? and vi mode to emacs mode while on R. Through the latter question, I learned that meta-ctrl-j will work to toggle vi-mode in R, but I cannot get it to stick so that every time I start R, vi-mode is enabled by default.
I have tried placing set editing-mode vi in my .inputrc, but that does not have the desired effect.
How can I get the vi-mode from meta-ctrl-j to be persistent across R sessions?
Try bind -f ~/.inputrc then bind -V | grep editing-mode and see if you get editing-mode is set to 'vi'.
If that works, it's just a matter of getting that file to be read on login.
Try echo $INPUTRC, if empty set it in your ~/.bashrc. Bash will supposedly check for ~/.inputrc then $INPUTRC then /etc/inputrc in search of your inputrc config.
Additionally, you might try adding bind -f ~/.inputrc to your ~/.bashrc if R opens up an interactive shell.

Tmux powerline prompt command not found

I'm new to Vim. I was experimenting with vim-powerline and tmux (and pathogen and vundle).
Somwehere in that process I tried to remove powerline and tmux started receiving this error.
My .tmux.conf file is empty. How can I find where tmux is trying to run this command?
I had this problem, too, but not in the first tmux window. It only happened for me in subsequent windows. I found a solution, but not exactly the cause of the problem.
The short version is the set the value of the POWERLINE_COMMAND variable in your .bashrc on the line before you source the bash binding. For me, that means:
export POWERLINE_COMMAND="$HOME/powerline/scripts/powerline"
. $HOME/powerline/powerline/bindings/bash/powerline.sh
I don't get exactly why this happens in subsequent tmux windows but I added some echo lines to the bash binding to find out what's happening. When the binding is sourced in subsequent windows, POWERLINE_COMMAND is already set to powerline, so it skips the code that checks for the right place to set it. I couldn't figure out where, how, or why it's already set, though.
Here's the code that does the check from the beginning of the bash binding:
if test -z "${POWERLINE_COMMAND}" ; then
if which powerline-client &>/dev/null ; then
export POWERLINE_COMMAND=powerline-client
elif which powerline &>/dev/null ; then
export POWERLINE_COMMAND=powerline
else
# `$0` is set to `-bash` when using SSH so that won't work
export POWERLINE_COMMAND="$(dirname "$BASH_SOURCE")/../../../scripts/powerline"
fi
fi
Since it works in the first window, I just set POWERLINE_COMMAND to point to the command that it points at in the first window. Setting it before sourcing the bash binding skips the whole check.
I suggest you to check your shell's configuration files. If you use e.g. use bash, check $HOME/.{bashrc,profile} or $HOME/.zshrc for zsh. There is probably a line like
. {repository_root}/powerline/bindings/bash/powerline.sh
according to the powerline installation instructions.

Set the terminal tab title as prompt name in unix

Lets say, the prompt is as below
run_scripts >
How to set that terminal tab title same as prompt
i.e Terminal tab tile also should be
run_scripts>
So that terminal title should dynamically update when the prompt changes.
Many terminals emulators are able to understand the special escaping : "\033]0;foo\007".
I know its a old post but i saw it today :
Here is the answer:
title `pwd`
if title command does not works in your shell then:
write a shell script with follwing contents (filename = title)
#!/usr/bin/tcsh -f
echo "^[]2;$1^G^[]1;$1^G"
then:
chmod +x title (give this script executable permission)
type:
title `pwd` <enter>
This single line command will change the title of the tab.
Simply run the command from terminal tab which title need to change-
PS1=$PS1"\[\e]0;My_Tab_Name\a\]"
Some Info:
The PS1 is a primary prompt variable which holds the characters displayed at the terminal prompt. You can set it whatever you want. However the above command will make it only work for current terminal session. Once you close the terminal and opena new one, it'll be the default one.
To make it permenant edit the PS1 variable in ~/.bashrc or ~/.zshrc file.
Benefits-
It help us to easily navigate over the tabs.

Resources