Since the version 3 of PlayOnLinux, you need to initialize a window at the beginning of your script and close it at the end.
To initialize a window, use the following line :
POL_SetupWindow_InitTo close it :
POL_SetupWindow_CloseIn the end, your script should look like this :
if [ "$PLAYONLINUX" = "" ]
then
exit 0
fi
source "$PLAYONLINUX/lib/sources"
POL_SetupWindow_Init
## Votre script ici
POL_SetupWindow_Close
exit
Add the following code to your script :
POL_SetupWindow_message "Hello World !" "My first message"
This is what you will get
You can now display a message. Happy ?
If you launch Playonlinux from a terminal, you can have a message displayed in it which is very convinient for debugging. Enter the following code :
echo "Hello World"
This symbole "#" basically tells bash to ignore the following text. Here is an example :
echo "Hello World"
# a nice comment
echo "Goodbye World"
We advise you to comment your code as much as possible to make it easier to read and facilitate the validation process by the scriptors
You want to ask something to the user ? The function POL_SetupWindow_textbox was created for that purpose. Add the following code to your script :
POL_SetupWindow_textbox "What is your name?" "Text zone"
And here's what the window looks like
Nothing's happening ? That's normal, we'll see in the next chapter how to retrieve the date that the user entered
You want the user the answer by yes or no ? Then use this function POL_SetupWindow_question
Here's how it works :
POL_SetupWindow_question "Do you like PlayOnLinux ?" "A question"
The result will look like :
In the next chapter we will see how to retrieve the answer to the question
Just like for the two previous functions, you can create a menu for PlayOnLinux.
POL_SetupWindow_menu "What would you like to eat tonight ?" "Tonight's menu" "Carrots Potatoes French-Fries" " "
What if I want to put "Carots", "French-Fries", "Potatoes", will I get 6 different entries ?
Yes, we've chosen the blank as the separator. That way, each blank corresponds to a new entry in your menu. If you really want to have blanks in your menu, you can do as follows.
POL_SetupWindow_menu "What do you want to eat tonight ?" "Tonight's menu" "Some carrots~Some potatoes~French fries" "~"
This command is very important. It allows you to introduce the application to the user before he installs it
POL_SetupWindow_presentation "Name of the program" "Editor of the program" "Editor's site" "your pseudo" "Program's prefix (cf chapter 5)"
Example :
POL_SetupWindow_presentation "The Quest of the platypus" "PlayOnLinux" "http://www.playonlinux.com" "Tinou" "quest_of_the_platypus"