Last active
February 12, 2016 23:03
-
-
Save zmughal/6931066 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if ! which xclip xdotool >/dev/null; then | |
echo "$0: requires xclip, xdotool" | |
exit 1 | |
fi | |
xclip -i -selection primary | |
TEMP=`xclip -o -selection primary` # store it so it does get lost when clicking | |
MATLAB_WIN=`xdotool search 'MATLAB R' 2>/dev/null | head -1` | |
if [ -z "$MATLAB_WIN" ]; then | |
echo "MATLAB window not found" | |
exit 1; | |
fi | |
xdotool windowactivate "$MATLAB_WIN" | |
# select center of MATLAB window | |
xdotool mousemove --window "$MATLAB_WIN" --polar 0 0 | |
xdotool click --window "$MATLAB_WIN" 1 | |
echo $TEMP | xclip -i -selection primary # restore after the clicking | |
echo $TEMP | xclip -i -selection buffer-cut # restore after the clicking | |
echo $TEMP | xclip -i -selection clipboard # restore after the clicking | |
#CODE#xdotool type --window "$MATLAB_WIN" "help" | |
#CODE#xdotool key --window "$MATLAB_WIN" Ctrl+0 Ctrl+y Return | |
# don't specify the window --- use the current window because MATLAB behaves | |
# oddly with focus | |
xdotool key Ctrl+0 Ctrl+y Return | |
#CODE#xvkbd -text '\C0\Cy\r' | |
# select command window = Ctrl+0 | |
# paste = Ctrl+y | |
# execute = Return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also https://gist.github.com/zmughal/da6a0a78dbeb7dfca8dc