#!/bin/bash out_loc=$(echo "/media/ramdisk/archivarius") if [ -d "$out_loc" ]; then # check for directory existence echo "resuming session" # rm -rf "$out_loc" # delete folder tree cd "$out_loc" nohup $(wine ArchivariusPort.exe) &>/dev/null & # run archivarius window_title="Search system for home and office" time_sec=900 while [ 0 -ne $time_sec ]; do echo "$time_sec, waiting... to appear" sleep 1 time_sec=$[$time_sec-1] xdotool search --onlyvisible --name "$window_title" windowactivate if [ $? == 0 ]; then echo "window found" break fi done window_handle=$(xdotool search --sync --onlyvisible --name "$window_title") wmctrl -ir $window_handle -b remove,maximized_vert,maximized_horz # unmaximize window xdotool windowmove --sync "$window_handle" 0 60 xdotool windowsize --sync "$window_handle" 1816 1016 sleep 1 xdotool mousemove 70 120 click 1 # click on wizard button else ./7zz x "Archivarius 3000 4.79 x32 Portable.7z" -o/media/ramdisk # unpack 7z archive mv "/media/ramdisk/Archivarius 3000 4.79 x32 Portable" "$out_loc" # rename the out_loc cd "$out_loc" nohup $(wine ArchivariusPort.exe) &>/dev/null & # run archivarius # wait for window window_title="Create new index" time_sec=900 while [ 0 -ne $time_sec ]; do echo "$time_sec, waiting... to appear" sleep 1 time_sec=$[$time_sec-1] xdotool search --onlyvisible --name "$window_title" windowactivate if [ $? == 0 ]; then echo "window found" break fi done # setup window position and size xdotool key Escape # close current wizard window sleep 0.5 window_title="Search system for home and office" window_handle=$(xdotool search --sync --onlyvisible --name "$window_title") echo window_id = $window_handle wmctrl -ir $window_handle -b remove,maximized_vert,maximized_horz # unmaximize window xdotool windowmove --sync "$window_handle" 0 60 xdotool windowsize --sync "$window_handle" 1816 1016 # rerun index wizard xdotool windowactivate $window_handle # get current mouse coords eval $(xdotool getmouselocation --shell) mouse_coord_x=$X mouse_coord_y=$Y xdotool mousemove 60 120 click 1 # click on wizard button xdotool mousemove $mouse_coord_x $mouse_coord_y # move the mouse to the origianl position # focus wizard window window_title="Create new index" xdotool search --sync --onlyvisible --name "$window_title" windowactivate # setup default index location sleep 0.5 xdotool key Return sleep 0.5 xdotool type "my" sleep 0.5 xdotool key Right sleep 0.5 xdotool type "z" sleep 0.5 xdotool key Right sleep 0.5 xdotool type "media" sleep 0.5 xdotool key Right sleep 0.5 xdotool type "ramdisk" sleep 0.5 xdotool key Right sleep 0.5 xdotool type "recordings" sleep 0.5 xdotool key space sleep 0.5 for (( i=1; i <= 7; i++ )) do xdotool key Return sleep 0.5 done window_title="Rebuild index" xdotool search --sync --onlyvisible --name "$window_title" windowactivate sleep 0.5 xdotool key Return window_title="Index results" time_sec=900 while [ 0 -ne $time_sec ]; do echo "$time_sec, waiting... to appear" sleep 1 time_sec=$[$time_sec-1] xdotool search --onlyvisible --name "$window_title" windowactivate if [ $? == 0 ]; then echo "window found" break fi done sleep 0.5 xdotool key Return sleep 0.5 xdotool mousemove 63 77 click 1 fi # sleep 5 # eval $(xdotool getmouselocation --shell) # echo $X $Y # dependecies: # 1. Archivarius 3000 4.79 x32 Portable.7z, copy into 2. folder # 2. 7z2200-linux-x86.tar.xz, unpack # 3. sudo apt install xdotool wmctrl wine # 4. /media/ramdisk/recordings - default index folder location # 5. after copying files to the default index folder location, indexing will be done automatically # tested on wine-8.0 and GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)