



#-limit : Stop searching after finding N matching windows. #-all : Require that all conditions be met. # get the window id from the Lightshot process id \\tLightshot is most probably not running." Is_number "$lightshot_process_id" || print_error_and_exit 7 "lightshot_process_id" "The argument is not a number! # test if a process id has been successfully acquired Lightshot_process_id=$(get_process_id_using_process_name "$lightshot_process_name") # check if the argument is an integer number || print_error_and_exit 6 "is_number" "There has not been passed exactly one argument! # try to get the process id using the process name || print_error_and_exit 5 "get_process_id_using_process_name" "There has not been passed exactly one argument! # check if the argument is a program which is installedĬommand -v "$1" > /dev/null 2>&1 || print_error_and_exit 4 "check_for_prerequisite" "I require $1 but it is not installed! Please install it." || print_error_and_exit 3 "check_for_prerequisite" "There has not been passed exactly one argument! # check if exactly one argument has been passed & print_error_and_exit 1 "$0" "You have passed $# unexpected argument(s) to the script! # check if no arguments have been passed to the script # here we do have color support, so we highlight the error origin and the exit code \\tThere has been passed the first argument as not a number (%b)! # check if the first argument is a number \\tThere has been passed a wrong number of arguments (%b)! Expected 3: Printf "print_error_and_exit() internal error # if not, print out an internal error without colors

# check if exactly 3 arguments have been passed # $2 = error origin usually function name # lightshot_process_name: no need to change this one it is a case-sensitive name of the Lightshot process # example: for left control and print screen key -> type Control_L+Print # lightshot_printscreen_hotkey: set this to the same hotkey which you have set up in Lightshot # treat unset variables as an error when substituting I would like someone else (than myself) to actually review the code this time. There were too many errors which I didn't see at the moment and I tried hard to fix them up now. This question is a direct follow-up #1 of my previous question:
