Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts about dialog. # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://angg.twu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at <http://angg.twu.net/e/dialog.e> # or at <http://angg.twu.net/e/dialog.e.html>. # See also <http://angg.twu.net/emacs.html>, # <http://angg.twu.net/.emacs[.html]>, # <http://angg.twu.net/.zshrc[.html]>, # <http://angg.twu.net/escripts.html>, # and <http://angg.twu.net/>. # ####### # «.compile_at_parati» (to "compile_at_parati") # «.test-dialog-at-parati» (to "test-dialog-at-parati") # (find-orggrep "grep -nH -e dialog *.org") # (find-zsh "acse dialog | sort") # (find-status "dialog") # (find-vldifile "dialog.list") # (find-udfile "dialog/") # (find-udfile "dialog/examples/") # (find-udfile "dialog/examples/inputbox") # (find-man "1 dialog") # (find-man "3 dialog") ##### # # redirections # 2006aug03 # ##### # (find-es "bash") # (find-dialogexfile "form1" "exec 3>&1") #* function metadialog {( exec 3>&1 dialog $* 2>&1 1>&3 )} function maindialog { dialog --title "Mediador - Bla" \ --help-button --no-collapse --no-shadow \ --ok-label "Executar" \ --cancel-label "Terminar" \ --help-label "Ajuda" \ --form "Mediador Bla - texto" \ 20 70 0 \ "Comando:" 1 1 \ "$1" 1 10 40 70 } maindialog #* # (find-node "(bashref)Redirections") # (find-node "(bashref)Redirections" "[N]>&WORD") # (find-busyboxfile "") echo ##### # # adapting the examples # 2006aug02 # ##### # (find-man "1 dialog" "--colors") # (find-udfile "dialog/examples/form1") # (find-udfile "dialog/examples/form2") # (find-udfile "dialog/examples/") # (find-udfile "dialog/examples/inputbox") # (find-man "1 dialog") # (find-man "1 dialog" "--form text height") # (find-man "1 dialog" "--form text height width formheight [ label y x item y x flen ilen ]") # (find-dialogexfile "") # (find-dialogexfile "form1") # (find-dialogexfile "form2") cd /usr/share/doc/dialog/examples/ ./form1 ./form2 # (find-man "1 dialog" "--help-button") # (find-man "1 dialog" "--form text height width formheight [ label y x item y x flen ilen ]") #* dialog --title "Mediador - Bla" \ --help-button --no-shadow \ --ok-label "Executar" \ --cancel-label "Terminar" \ --help-label "Ajuda" \ --form "Here is a possible piece of a configuration program." \ 20 50 0 \ "Comando:" 1 1 \ ".user" 1 10 40 70 #* function maindialog_text { cat <<'EOT' Digite um comando para o Mediador na caixa abaixo e use o botao "Executar" para roda'-lo (ou use o botao "Terminar" para sair). Exemplos de comandos (para mais detalhes veja a tela de ajuda): para 44 - paralisa a emissao de avisos por IVR e SMS para a regional 44 para_sms 5_,72 - paralisa a emissao de avisos por SMS para as regionais 51, 52, 53, 54, 55 e 72 volta_ivr 44 - reinicia a emissao de avisos por IVR para a regional 44 EOT } function maindialog { dialog --title "Mediador - Bla" \ --help-button --no-collapse --no-shadow \ --ok-label "Executar" \ --cancel-label "Terminar" \ --help-label "Ajuda" \ --form "$(maindialog_text)" \ 20 70 0 \ "Comando:" 1 1 \ "$1" 1 10 40 70 } # (find-man "1 dialog" "--help-button") # (find-man "1 dialog" "--form text height width formheight [ label y x item y x flen ilen ]") function helpdialog_text { cat <<'EOT' Os comandos validos sao: para_ivr <regionais> para_sms <regionais> para <regionais> volta_ivr <regionais> volta_sms <regionais> volta <regionais> onde <regionais> e' uma lista de codigos de regionais validos separados por espacos ou virgulas. Os codigos de regionais validos sao 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 24, 27, 28, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 71, 72, 73, 75 e 77, e mais os seguintes codigos especiais em que o "_" faz papel de curinga: 1_, 2_, 4_, 5_, 7_, __. Repare que "__" significa "todas as regionais". EOT } function helpdialog { dialog --title "Mediador - Bla - Ajuda" \ --no-collapse --no-shadow \ --ok-label "Voltar" \ --msgbox "$(helpdialog_text)" 20 70 } # «mediador-dialogs» (to ".mediador-dialogs") # 2006aug02 function dialogs { while true; do OUTPUT=$(maindialog "$COMANDO") case $? in 0) COMANDO="$OUTPUT"; echo "$COMANDO"; read;; 1) return;; 2) helpdialog;; esac done } # dialogs "Foo bar" maindialog "Foo bar" echo $? #* maindialog "echo foo bar" # helpdialog echo $? OUTPUT=$(maindialog) echo $? echo "[$OUTPUT]" --backtitle ".backtitle" \ # (find-man "1 dialog" "--no-shadow") cd /usr/share/doc/dialog/examples/ ./msgbox ./msgbox2 cd /usr/share/doc/dialog/examples/ ./textbox ./textbox2 # (code-c-d "dialogex" "/usr/share/doc/dialog/examples/" :grep) # (find-dialogexfile "") # (find-dialogexfile "infobox" "not pause") cd /usr/share/doc/dialog/examples/ ./infobox ./infobox2 ./infobox3 ./infobox4 cd /usr/share/doc/dialog/examples/ ./inputbox ./inputbox1 ./inputbox2 ./inputbox3 ./inputbox4 ./inputbox5 ./inputbox7 cd /usr/share/doc/dialog/examples/ ./inputmenu-stdout ./inputmenu1 ./inputmenu2 ./inputmenu3 ./inputmenu4 # (find-man "1 dialog") # (find-man "1 dialog" "--form text") # (find-man "1 dialog" "--help-button") # (find-man "1 dialog" "--help-label string") # (find-man "1 dialog" "--title title") # (find-man "1 dialog" "--and-widget") input box com default #* dialog --title "My box" \ --msgbox "Hi, this is an information box. It is different from a message box: it will not pause waiting for input after displaying the message. The pause here is only introduced by the sleep command within dialog. You have $left $unit to read this..." 10 52 echo $? #* ##### # # running the dialog demos inside an M-x ansi-term Emacs window # 2006jul07 # ##### # (find-efunction 'ansi-term) # (find-udfile "dialog/examples/") cd /usr/share/doc/dialog/examples/ ./msgbox2 # (ansi-term (ee-expand "$SHELL")) ##### # # compiling dialog at parati # 2006jun23 # ##### # «compile_at_parati» (to ".compile_at_parati") # http://invisible-island.net/dialog/ # ftp://invisible-island.net/dialog/dialog.tar.gz * (eepitch-eshell) cd (ee-paratifile "") mkdir snarf/ mkdir snarf/ftp/ mkdir snarf/ftp/invisible-island.net/ mkdir snarf/ftp/invisible-island.net/dialog/ cd snarf/ftp/invisible-island.net/dialog/ cp -v $S/ftp/invisible-island.net/dialog/dialog.tar.gz . * (eepitch-parati) edrx cd mkdir ~/usrc/ rm -Rf ~/usrc/dialog-1.0-20060221/ mkdir ~/usrc/dialog-1.0-20060221/ cd ~/usrc/ gunzip -cd < ~/snarf/ftp/invisible-island.net/dialog/dialog.tar.gz | tar -xvf - cd ~/usrc/dialog-1.0-20060221/ export LC_ALL=C export LANG=C ./configure 2>&1 | tee oc make 2>&1 | tee om cd ~/bin/ ln -sf ../usrc/dialog-1.0-20060221/dialog dialog ##### # # testing dialog at parati # 2006jun23 / 2006jul25 # ##### # «test-dialog-at-parati» (to ".test-dialog-at-parati") # (find-efunction 'passwds-tcl-get) # (passwds-tcl-get "parati") * (eechannel-xterm "P") telnet parati edrx * (eechannel-send-passwd "parati") export DIALOG=$HOME/bin/dialog cd ~/usrc/dialog-1.0-20060221/samples/ ./msgbox # (find-udfile "dialog/examples/") # (find-udfile "dialog/examples/inputbox") ##### # # substituting msgbox by textbox # 2006aug28 # ##### # (find-man "ksh") # (find-man "1 dialog" "--textbox file height width") # Local Variables: # coding: utf-8-unix # End: