Advertisement
Guest User

archivarius auto index files

a guest
Nov 17th, 2023
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.85 KB | Software | 0 0
  1. #!/bin/bash
  2.  
  3. out_loc=$(echo "/media/ramdisk/archivarius")
  4. if [ -d "$out_loc" ]; then  # check for directory existence
  5.     echo "resuming session"
  6.     # rm -rf "$out_loc" # delete folder tree
  7.     cd "$out_loc"
  8.     nohup $(wine ArchivariusPort.exe) &>/dev/null & # run archivarius
  9.     window_title="Search system for home and office"
  10.     time_sec=900
  11.     while [ 0 -ne $time_sec ]; do
  12.         echo "$time_sec, waiting... to appear"
  13.         sleep 1
  14.         time_sec=$[$time_sec-1]
  15.         xdotool search --onlyvisible --name "$window_title" windowactivate
  16.         if [ $? == 0 ]; then
  17.           echo "window found"
  18.           break
  19.         fi
  20.     done
  21.     window_handle=$(xdotool search --sync --onlyvisible --name "$window_title")
  22.     wmctrl -ir $window_handle -b remove,maximized_vert,maximized_horz # unmaximize window
  23.     xdotool windowmove --sync "$window_handle" 0 60
  24.     xdotool windowsize --sync "$window_handle" 1816 1016
  25.     sleep 1
  26.     xdotool mousemove 70 120 click 1 # click on wizard button
  27. else
  28.     ./7zz x "Archivarius 3000 4.79 x32 Portable.7z" -o/media/ramdisk    # unpack 7z archive
  29.     mv "/media/ramdisk/Archivarius 3000 4.79 x32 Portable" "$out_loc"   # rename the out_loc
  30.     cd "$out_loc"
  31.     nohup $(wine ArchivariusPort.exe) &>/dev/null & # run archivarius
  32.     # wait for window
  33.     window_title="Create new index"
  34.     time_sec=900
  35.     while [ 0 -ne $time_sec ]; do
  36.         echo "$time_sec, waiting... to appear"
  37.         sleep 1
  38.         time_sec=$[$time_sec-1]
  39.         xdotool search --onlyvisible --name "$window_title" windowactivate
  40.         if [ $? == 0 ]; then
  41.           echo "window found"
  42.           break
  43.         fi
  44.     done
  45.     # setup window position and size
  46.     xdotool key Escape # close current wizard window
  47.     sleep 0.5
  48.     window_title="Search system for home and office"
  49.     window_handle=$(xdotool search --sync --onlyvisible --name "$window_title")
  50.     echo window_id = $window_handle
  51.     wmctrl -ir $window_handle -b remove,maximized_vert,maximized_horz # unmaximize window
  52.     xdotool windowmove --sync "$window_handle" 0 60
  53.     xdotool windowsize --sync "$window_handle" 1816 1016
  54.     # rerun index wizard
  55.     xdotool windowactivate $window_handle
  56.     # get current mouse coords
  57.     eval $(xdotool getmouselocation --shell)
  58.     mouse_coord_x=$X
  59.     mouse_coord_y=$Y
  60.     xdotool mousemove 60 120 click 1 # click on wizard button
  61.     xdotool mousemove $mouse_coord_x $mouse_coord_y # move the mouse to the origianl position
  62.     # focus wizard window
  63.     window_title="Create new index"
  64.     xdotool search --sync --onlyvisible --name "$window_title" windowactivate
  65.     # setup default index location
  66.     sleep 0.5
  67.     xdotool key Return
  68.     sleep 0.5
  69.     xdotool type "my"
  70.     sleep 0.5
  71.     xdotool key Right
  72.     sleep 0.5
  73.     xdotool type "z"
  74.     sleep 0.5
  75.     xdotool key Right
  76.     sleep 0.5
  77.     xdotool type "media"
  78.     sleep 0.5
  79.     xdotool key Right
  80.     sleep 0.5
  81.     xdotool type "ramdisk"
  82.     sleep 0.5
  83.     xdotool key Right
  84.     sleep 0.5
  85.     xdotool type "recordings"
  86.     sleep 0.5
  87.     xdotool key space
  88.     sleep 0.5
  89.     for (( i=1; i <= 7; i++ ))
  90.     do
  91.         xdotool key Return
  92.         sleep 0.5
  93.     done
  94.     window_title="Rebuild index"
  95.     xdotool search --sync --onlyvisible --name "$window_title" windowactivate
  96.     sleep 0.5
  97.     xdotool key Return
  98.     window_title="Index results"
  99.     time_sec=900
  100.     while [ 0 -ne $time_sec ]; do
  101.         echo "$time_sec, waiting... to appear"
  102.         sleep 1
  103.         time_sec=$[$time_sec-1]
  104.         xdotool search --onlyvisible --name "$window_title" windowactivate
  105.         if [ $? == 0 ]; then
  106.           echo "window found"
  107.           break
  108.         fi
  109.     done
  110.     sleep 0.5
  111.     xdotool key Return
  112.     sleep 0.5
  113.     xdotool mousemove 63 77 click 1
  114. fi
  115.  
  116.  
  117. # sleep 5
  118. # eval $(xdotool getmouselocation --shell)
  119. # echo $X $Y
  120.  
  121. # dependecies:
  122.     # 1. Archivarius 3000 4.79 x32 Portable.7z, copy into 2. folder
  123.     # 2. 7z2200-linux-x86.tar.xz, unpack
  124.     # 3. sudo apt install xdotool wmctrl wine
  125.     # 4. /media/ramdisk/recordings - default index folder location
  126.     # 5. after copying files to the default index folder location, indexing will be done automatically
  127.     # tested on wine-8.0 and GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement