Files
Klipper-docker/scripts/klipper.exp
2023-11-15 15:58:40 +03:00

61 lines
1.4 KiB
Plaintext

#!/usr/bin/expect
# expect used tcl syntax which is very indetaion and spaces sensitive keep that in mind
# Set timeout
set timeout 3000
# Start your process
spawn /opt/lrgex/kiauh/kiauh.sh
# Initialize a variable to control the menu interaction
set menu 1
# Single expect block with multiple patterns
expect {
"*Main Menu*" {
# using condition here to make a break for the loop created by exp_continue as i need to use the pattern 2 times one for pressing 1 and one for pressing q
if {$menu} {
send "1\r"
sleep 3
exp_continue
} else {
send "q\r"
sleep 3
exp_continue
}
}
"*Installation Menu*" {
if {$menu} {
send "1\r"
sleep 3
exp_continue
} else {
send "b\r"
sleep 3
exp_continue
}
}
"*Initializing Klipper installation*" {
send "\r"
sleep 3
exp_continue
}
"*Setting up too many instances may crash your system*" {
send "\r"
sleep 3
exp_continue
}
"*WARNING: Your current user is not in group:*" {
send "y\r"
sleep 3
# Change the condition to stop interacting with menus
set menu 0
exp_continue
}
timeout {
puts "Operation timed out"
exit 1
}
}