sv ru pl es fr

Documentation of the functions available in the PlayOnLinux's scripts.

Preamble

The functions presented below are usable in the scripts designed to be used in PlayOnLinux. Green written parameters are mandatory, others are optionnal.
In order to give a parameter to a function, the order must be respected, for example the "exemple" function can have 3 parameters, the first and the last are mandatory, the second is optionnal. The function's call will have to be like this (at least):
exemple "mandatory parameter 1" "" "mandatory parameter 2"
or
exemple "mandatory parameter 1" "optinnal parameter 1" "mandatory parameter 2"


Will be presented in this documentation only the useful functions for the script's creation, PlayOnLinux uses other functions which aren't presented here.

Using the su, sudo, gksu, kdesu ... commands (any command which changes the user's privileges) are formaly forbidden in any PlayOnLinux's script (as well as in the software itself)

creer_lanceur

The creer_lanceur function allows to create a launcher, accessible in the PlayOnLinux's menu, on the desktop, or in the window manager.

Parameter Function Type
WinePrefix Defines in which prefix the piece of software is installed Characters' string
Directory Defines in which directory or sub-directory of the prefix the piece of software is installed. Characters' string
Binary Defines the name of the executable which will be launched. Character's string
Icon Icon's name which will be displayed during the shortcut's creation.
Allowed formats are png and xpm.
The files have to be hosted on the PlayOnLinux's website.
Contact the administrators for more informations
Characters' string
Icon's name Defines the launcher's name, the prefix's name is used as default parameter. Characters' string
Nothing This parameter isn't used, it's for compatibility with the versions < 2.0 Nothing
Possible argument Possible parameter to be given to the program when launching it Characters' string
creer_lanceur "My Big Game" "Program Files/The_MulXGame/" "YetAnotherGame.exe"

Example image of launcher's creation

Example image of launcher's creation

message

This function displays a message for the user running the script.

Parameter Function Type
Message The message's content Characters' string
Title Title of the window displaying the message Characters' string
StepNumber Number of the current step Non signed integer
TotalStepNumber Total number of steps of the script Non signed integer
CancelButton Define the "Cancel" button's visibility.
1 = Visible ; 0 = Not visible
Boolean
Image Image to display in the window Characters' string
NextButton Defines the text on the "Next" button Characters' string
message "Everybody need, needed or will need a drawing to get the message to be understood."

Example image for the message window


error

The error function has a behaviour similar to the message function's.

error "Those who are never wrong never try."

Example image for the error window

warning

The warning function has a behaviour similar to the message function's.

warning "The greater danger in times of turbulence is not the turbulence. It's acting with yesterday's logic."

Example image for the warning window

question

Asks a question to the user.
The answer is returned as a boolean. '1' means that the user answered "No" and '0' that the user answered "Yes"

Parameter Function Type
message The question to display Characters' string
WindowTitle The window's title Characters' string
StepNumber Number of the current step Non signed integer
TotalStepNumber Total number of steps of the script Non signed integer
CancelButton Defines the "Cancel" button's visibility.
1 = Visible ; 0 = Not visible
Boolean
Image Image to display in the window Characters' string

question "Do you know the Answer to the Ultimate Question of Life, the Universe and Everything ?" "Don't Panic, It's just a question ! "

Example image for a question

text_field

The text_field command allows the user to fill a field. The informations entered by the user are returned (without modifications) if he clicks on "Next", else nothing is returned.

Parameter Function Type
message The text justifying the user's intervention (usually a question) Characters' string
Default The default text field's value Characters' string
StepNumber Number of the current step Non signed integer
TotalStepNumber Total number of steps of the script Non signed integer
CancelButton Defines the "Cancel" button's visibility.
1 = Visible ; 0 = Not visible
Boolean
WindowTitle The window's title Characters' string
Image Image to display in the window Characters' string
text_field "WHAT DO YOU GET IF YOU MULTIPLY SIX BY NINE?" "42" "" "" "" "Arthur's Scrabble tiles"

Example image for the text_field window

This function displays a menu. The user's choice is returned, if no entry is choosed nothing is returned.

Parameter Function Type
Message Message's text Characters' string
Items The menu's entries Characters' string
Title The window's title Characters' string
StepNumber Number of the current step Non signed integer
TotalStepNumber Total number of steps of the script Non signed integer
CancelButton Defines the "Cancel" button's visibility.
1 = Visible ; 0 = Not visible
Boolean
Image Image to display in the window Characters' string
Separator Defines the character used as a separator between the menu's entries Characters' string
Next "Next" button's text Characters' string
Return's type [ 1 = Return the ID, 0 = Return the name ] Default = 0 Boolean
menu "Choose between the oven and the mill !" "oven mill" "" "" "" "" "wizard.png"

Example image for the menu function

This function is known as "menu" in the versions < 2.1.0

This function proposes a list of choices. Once the user's choice is done, the choosed value is returned.
If no value has been choosed the function returns nothing.

Parameter Function Type
Message Message's text Characters' string
Items The menu's entries Characters' string
Title The window's title Characters' string
StepNumber Number of the current step Non signed integer
TotalStepNumber Total number of steps of the script Non signed integer
CancelButton Defines the "Cancel" button's visibility.
1 = Visible ; 0 = Not visible
Boolean
Image Image to display in the window Characters' string
Separator Defines the character used as a separator between the menu's entries Characters' string
Next "Next" button's text Characters' string
menu_list "You have to make a choice in the list" "First choice~Second choice" "This is the fabulous title :)" "" "" "" "" "~"

Example image for the menu_list function

run_and_wait

This function displays a dialog box indicating to the user that he must waits for the running command to finish

Parameter Function Type
Message Message to be displayed. Characters' string
Command Command to be runned by the system.
Beware to use only commands available for all the distributions.
It isn't a PlayOnLinux-specific command.
Characters' string
Title The window's title Characters' string
StepNumber Number of the current step Non signed integer
TotalStepNumber Total number of steps of the script Non signed integer
CancelButton Defines the "Cancel" button's visibility.
1 = Visible ; 0 = Not visible
Boolean
Image Image to display in the window Characters' string
autoExit Determines if the window has to be closed automatically once the command is finished.
1 = the window will be automatically closed, 0 = the window won't be closed.
Boolean
exitMessage Message to be displayed once the command is finished
It replaces the message defined in the first parameter
Characters' string
Next Defines the "Next" button's text Characters' string
run_and_wait "Please wait 10 seconds and you will know the answer" "sleep 10s" "Don't panic! " "" "" "0" "" "" "So the answer is? 42 ;-)
But do you know the real question?" "Yet H2G2"

The message during the command's execution

The message after the command's execution

download

This function downloads a file from internet, then save it into the directory where the function was runned.

Parameter Function Type
Message Message to be displayed. Characters' string
File The address of the file to download, with this syntax http://www.example.com/file.txt Characters' string, URL
Title The window's title Characters' string
StepNumber Number of the current step Non signed integer
TotalStepNumber Total number of steps of the script Non signed integer
CancelButton Defines the "Cancel" button's visibility.
1 = Visible ; 0 = Not visible
Boolean
Image Image to display in the window Characters' string
autoExit Determines if the window has to be closed automatically once the command is finished.
1 = the window will be automatically closed, 0 = the window won't be closed.
Boolean
autoDl Launch the download automatically
1 = the download starts automatically, 0 = the download doesn't start automatically.
Boolean
download "Downloading Wine for Windows System (Strange isn't it?) "http://heanet.dl.sourceforge.net/sourceforge/wine/wine-dlls-0.9.14.zip" "" "" "" "0"

Example of file donwload

Example of file donwload

Example of file donwload

select_file

The select_file function allows to select a file. The absolute access path is returned as a character's string.

Parameter Function Type
Message Message to be displayed. Characters' string
Default Default path value Characters' string, access path
StepNumber Number of the current step Non signed integer
TotalStepNumber Total number of steps of the script Non signed integer
CancelButton Defines the "Cancel" button's visibility.
1 = Visible ; 0 = Not visible
Boolean
Image Image to display in the window Characters' string
select_file "Where is Dave? " "/dev/null"

Example image for select_file

show_file

This function displays a file's contents.

Parameter Function Type
File Path to the file. It can be absolute or relative. Characters' string
Title The window's title Characters' string
StepNumber Number of the current step Non signed integer
TotalStepNumber Total number of steps of the script Non signed integer
CancelButton Defines the "Cancel" button's visibility.
1 = Visible ; 0 = Not visible
Boolean
Image Image to display in the window Characters' string
NextButton Defines the "Next" button's text Characters' string
show_file "/proc/diskstats"

Example image for show_file

Opens the default browser at the given address.

browser http://www.playonlinux.com

simulate_reboot

This command allows to simulate a reboot of the system.

Parameter Function Type
StepNumber Number of the current step Non signed integer
TotalStepNumber Total number of steps of the script Non signed integer

select_prefix

This function allows to select the prefix used by Wine or DosBox.

Parameter Function Type
Prefix Path to the prefix of Wine or DosBox you want to use Characters' string

polprefixcreate

This function allows to create and update a Wine's prefix, which was defined before with select_prefix.

Parameter Function Type
StepNumber Number of the current step Non signed integer
TotalStepNumber Total number of steps of the script Non signed integer

Ask_For_cdrom

This function asks to the user the path to the CD-ROM and defines the CDROM variable as the CDROM's path.

Parameter Function Type
StepNumber Number of the current step Non signed integer
TotalStepNumber Total number of steps of the script Non signed integer
CdNumber The CD-ROM's number during a mutli-cd application's installation. Non signed integer

Example image of Ask_For_cdrom's use

Check_cdrom

This function checks the presence of the file given as parameter.
It must be called after Ask_For_cdrom

Parameter Function Type
Program Relative path (based on $CDROM's value) allowing to confirm the presence of the (good) CD-ROM. Characters' string

Set_OS

This function changes the version of the operating system simulated by Wine.
The Wine's prefix must be defined before (with select_prefix)

Parameter Function Type
Version The different available versions are: vista, win2003, winxp, win2k, winnt, winme, win98, win95, win31
Only one value in the same time
Characters' string

Set_Managed

This function allows to let the window manager control the window
The Wine's prefix must be defined before (with select_prefix)

Parameter Function Type
Managed The two possible values are: On or Off.
The case must be respected
Boolean

Set_SoundDriver

This function defines the audio driver to be used
The Wine's prefix must be defined before (with select_prefix)

Parameter Function Type
Audio The possible values are: alsa ; oss ; esd
The case must respected
Trilean :-/

Set_GLSL

This function allows to define the Wine's GLSL support (see the wikipedia page for more informations).
The Wine's prefix must be defined before (with select_prefix)

Parameter Function Type
GLSL The two possible values are: On or Off.
The case must be respected
Boolean

Set_DXGrab

This function defines if DirectX © can control the mouse's pointer
The Wine's prefix must be defined before (with select_prefix)

Parameter Function Type
DXGrab The two possible values are: On or Off.
The case must be respected
Boolean

Set_Iexplorer

This function simulates the presence of Microsoft Internet Explorer 6 ©
The Wine's prefix must be defined before (with select_prefix)

Set_Desktop

This function enables or disables the Wine's virtual desktop
The Wine's prefix must be defined before (with select_prefix)

Parameter Function Type
Desktop The two possible values are: On or Off.
The case must be respected
Boolean
Width Defines the virtual desktop's width when it's enabled (first parameter is On) Non signed integer
Height Defines the virtual desktop's height when it's enabled (first parameter is On) Non signed integer

fonts_to_prefixe

This function copies the fonts in the Wine directory, which was defined before with select_prefix

Set_WineVersion_Assign

This function allows to change the Wine version used by an application.
Every game rated "Platinum" on Wine's website must be associated to a fixed version of Wine, because of regression problems between the different Wine's versions.
If the Wine version isn't present in the user's directory, it will be installed automatically (then assigned)

Parameter Function Type
Version Wine's version to be assigned. Use --reset to go back to the Wine's version installed on the user's system. Characters' string
Game Application's name to be assigned, it must be the same than the one used in creer_lanceur Characters' string

Set_WineVersion_Session

This function allows to change the Wine's version to be used.
Contrarly to Set_WineVersion_Assign this function modifies the Wine's version only during the script's execution.
This function shoud be used to do an installation with a Wine's version that is well known for working without troubles.

Parameter Function Type
Version Wine's version to be assigned. Use --reset to go back to the Wine's version installed on the user's system. Characters' string

Variable

It's a non-exaustive list of the available variables for the scripts.
The variables' content is obtained when adding the "$" symbol in front of the variables' name example: $LANG
A variable's value is affected by the = operand example: author="MulX" ; the author variable is created (if non existing before) and initializated to the MulX value. When assigning a character's string, you have to "frame" the string with " (double quotes).
The case must be respected when using a variable author is different from Author which is also different from AUTHOR
If you have a doubt about variales' use feel free to read this page again
So the different variables are:

Name Content
PLAYONLINUX Contains the absolute path to the PlayOnLinux software
REPERTOIRE Contains the absolute path to the user's PlayOnLinux directory ( equivalent to $HOME/.PlayOnLinux )
POL_LANG Contains the language used by PlayOnLinux
CDROM Contains the absolute path to the CD-ROM, it's initialized after Ask_For_cdrom's call
WINEPREFIX Variable used by Wine to know where is installed the application, initialized with select_prefix's call
Il n'y a rien à voir ici