Open acarril opened 4 years ago
funny bug. Apparently when the command pane is hidden, stata's accepts any input only once. And then the focus goes somewhere else. This can be overcome by typing Ctrl+1
in between every keystroke. So the following works:
if [ ! -z "$winid_stata" ]; then
xdotool key --window ${winid_stata} --delay 10 ctrl+a
xdotool key --window ${winid_stata} --delay 0 ctrl+1
xdotool type --window ${winid_stata} --delay 0 "${string}"
xdotool sleep 0.010 #sleep in seconds
xdotool key --window ${winid_stata} --delay 1 ctrl+1
xdotool key --window ${winid_stata} --delay 1 Return
else
echo "No Stata window open."
exit 1
fi
I'm not sure I would implement it though because it is very sensible to the --delay flags. After long testing, the above constellation of delays worked quite reliably. But still, I am not sure how the delay of 0 might affect older machines.
I am writing here in case someone really wants to use the command pane fully closed.
it does work fine (without any of the xdotook key ctrl+1
lines) if the command pane is nearly fully closed.
When Stata's command pane is fully hidden, the program is only able to paste the execution line
do <file>
, but it won't select the text that was already in there (withcrtl+a
) and, most importantly, won't execute the line (withReturn
).I have no clue what may be causing this issue, although it is a minor one.