[Level 2] Shell Interactive With Zenity Episode 2 -- entry
When shell script needs to communicate with user, we usually use the command "read" to receive your's input. Does zenity has something like this? Yes, you can use the option "--entry". The command synopsis as the following:
SYNOPSIS
zenity --entry [--title=title] [--window-icon=path] [--width=width] [--height=height] [--timeout=seconds] [--text=text] [--entry-text=text] [--hide-text]
The first command you can try is "zenity --entry", then you can see a pop out screen like below:
# zenity --entry
Just like "--calendar", if you press "ESC" key or click button "Cancel", the return code will be "1". If you key some text in the column and click "OK", zenity will response the text that you key in and the return code will be "0". And also the same effect about the options "--title", "--timeout"...etc, for saving your time, please refer to the previous post "[Level 2] Shell Interactive With Zenity Episode 1 -- calendar", too.
So all extra options that you should know is, "--entry-text" and "--hide-text".
"--text" option is the default text you want display in the column, like below:
# zenity --entry --entry-text="default text"
And "--hide-text" is for hide the text, zenity will replace the text with "asterisk". It's very useful when the column you want use to key in with his "password", it can prevent the other people to "see" the password while user is typing.
# zenity --entry --text="Please enter your password:" --entry-text="default text" --hide-text
Wish this helps.
regards,
Stanley Huang
SYNOPSIS
zenity --entry [--title=title] [--window-icon=path] [--width=width] [--height=height] [--timeout=seconds] [--text=text] [--entry-text=text] [--hide-text]
The first command you can try is "zenity --entry", then you can see a pop out screen like below:
# zenity --entry
Just like "--calendar", if you press "ESC" key or click button "Cancel", the return code will be "1". If you key some text in the column and click "OK", zenity will response the text that you key in and the return code will be "0". And also the same effect about the options "--title", "--timeout"...etc, for saving your time, please refer to the previous post "[Level 2] Shell Interactive With Zenity Episode 1 -- calendar", too.
So all extra options that you should know is, "--entry-text" and "--hide-text".
"--text" option is the default text you want display in the column, like below:
# zenity --entry --entry-text="default text"
And "--hide-text" is for hide the text, zenity will replace the text with "asterisk". It's very useful when the column you want use to key in with his "password", it can prevent the other people to "see" the password while user is typing.
# zenity --entry --text="Please enter your password:" --entry-text="default text" --hide-text
Wish this helps.
regards,
Stanley Huang
Comments
Post a Comment