From bf18fb8195fb30e203eb6db4d035426fd7dd11b8 Mon Sep 17 00:00:00 2001 From: lrgex Date: Tue, 14 Nov 2023 14:56:44 +0300 Subject: [PATCH] v2.0 --- test/mainsail.exp | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 test/mainsail.exp diff --git a/test/mainsail.exp b/test/mainsail.exp new file mode 100644 index 0000000..c906b97 --- /dev/null +++ b/test/mainsail.exp @@ -0,0 +1,45 @@ +#!/usr/bin/expect + +# expect used tcl syntax which is very indetaion and spaces sensitive keep that in mind + + +# Set timeout +set timeout 60 + +# 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" + exp_continue + } else { + send "q\r" + exp_continue + } + } + "*Installation Menu*" { + if {$menu} { + send "3\r" + exp_continue + } else { + send "b\r" + exp_continue + } + } + "*Download the recommended macros? (Y/n):*" { + send "y\r" + set menu 0 + exp_continue + } + timeout { + puts "Operation timed out" + exit 1 + } +} \ No newline at end of file