Not quite sure what the user is having issues with but here we go:
a=`xdotool search --name "AAA"`
if [[ "$a" ]]; then
xdotool windowactivate --sync $a
xdotool windowmove --sync $a 377 153
else
leafpad '/media/1/AAA'
sleep 5
a=`xdotool search --name "AAA"` # <-- You need this
xdotool windowactivate --sync $a # <-- Otherwise $a will be empty (think about it)
xdotool windowmove --sync $a 377 153
fi
The reason for the window not being re-positioned is because:
You search for 'leafpad' and place it in $a
, but if leafpad isn't started $a
will be empty when you go into the else
block. So you need to search and place leafpad in $a
after it's launched again in order to move it.