Forums

POL script reference

Auteur Réponses
chain2k Lundi 4 Février 2008 à 14:36
chain2kAnonymous

So as I can't find official english manual with POL function listing, I want to write about those that I learned when I read POL scripts.
Please remember that english not my native language, so feel free to show me my mistakes.

So, from the beginning:

#!/bin/bash
if [ "$PLAYONLINUX" = "" ]
then
exit 0
fi
source "$PLAYONLINUX/lib/sources"

cfg_check

     
This is the beginning of the script, which is defined POL belonging, inclusion of libraries and checking dependencies. This part is required!
presentation - this function represents the program and assign prefix name.Structure:
presentation "Program name" "Program creator" "Program's web site" "Script author" "The_name_of_the_directory_where_script_will_create_the_wine-prefix."
If you don't need some of parameters feel free to use empty quotes - "".
menu - This function creates a dialogue choices, structure:
menu "Text" "$1 $2"
where "Text" - This is text menu, in which the user is offered a choice.
"$1 $2" - There are proposed options. Meaning, which is chosen, usually used in the condition: if [ ]; then; else; fi
selectionner_fichier -      creates the menu to select a file, returns the full path to user selection, structure:
selectionner_fichier "Text"
erreur - the error message, structure:
erreur "Text" - by the way, here, as in the previous function is commonly used standard message from the language file /usr/share/playonlinux/lang/en_EN.UTF-8 - '$LNG_LI_CHOOSEFILE'
dirname - return path, without the names of the file itself, structure:
dirname "Path to the file" - usually in conjunction with selectionner_fichier function, which returns the file path
telecharger -      file downloads, structure:
telecharger "Message during download" "URL to a file for download" "Message before download"
attendre - menu with progress indicator , in the background is usually performed any actions. Structure:
attendre "Message during action" "unzip file.zip" "Message before action" - second operator is action (in this case, unpacking archive)
select_prefixe - This function selects the directory to create a prefix. Structure:
     select_prefixe "path to a prefix" - is used in conjunction with the next described function to create a wine-prefix
creer_prefixe - creates a prefix structure, with all the directories (windows, program files ...) and files
creer_lanceur - creates a script which runs application. Structure:
creer_lanceur "prefix_name" "path to the .exe file" "filename of .exe file" "filename of icon file" "name of the script which runs the application"
Set_WineVersion_Assign - assign WINE version to run the application with it. Structure:
Set_WineVersion_Assign "WINE version number" "prefix name"
simuler_reboot - imitates windows restart
attention - menu with warnings. Structure:
attention "text"
end_install - standard message that the installation is complete.
message - the message, for example, with an explanation of any action. Structure:
message "Text with explanation"
Ask_For_cdrom - request to show CDROM mount point.
Check_cdrom - checks for the file user need to run at a specified installation CD to start installation. Structure:
Check_cdrom "path/filename.exe"
protection_warning - report about incorrect work with copy protection CDROM driver
Set_SoundDriver - change the sound driver in winecfg. Structure:
     Set_SoundDriver alsa - the second operator is the name of the driver (alsa, oss, esd, jack, nas)
Set_OS - change the windows version, which will run the application in winecfg. Structure:
Set_OS win98 - the second operator is the windows version (vista, win2003, winxp, win2k, winnt, winme, win98, win95, win31)
Set_Managed "On" - to switch in winecfg the flag of the control "allow the window-manager to control the windows"
Set_DXGrab "On" - to switch in winecfg the flag of the control "allow DirectX apps to stop the mouse leaving their window"
Set_GLSL "On" - to allow GLSL in winecfg
Set_Desktop On 1024 768 - to emulate a virtual desktop with given resolution

If you'll notice numbers at the end of the line, for example 7 8, you have to know that is the way to identify steps in the installation menu, which displays for the user, in the example given - it's step 7 of 8 possible.
In general, you can use standard Bash language.
http://www.gnu.org/software/bash/manual/bashref.html
     
I am sure that there are not all the functions that can be used in the POL script.
As I try to write a manual about the functions of POL for Russian users, I would be grateful for additions to this reference.
Thank you and sorry for my bad English.
Ghostofkendo Lundi 4 Février 2008 à 19:10
Ghostofkendo

Hi chain2k,

That's a good idea you had.
So to help you, here are some functions you didn't listed:

- selectionner_fichier, erreur, telecharger, attendre and attention are available in English too.
They are respectively select_file, error, download, run_and_wait and warning. Easier to understand, isn't it

- show_file which ... show the file in argument (I guess).

- Set_Iexplore which simulates Internet Explorer's presence in the prefixes.

- navigateur which opens user's browser at the url you gave as argument.

- OpenWineLookBox which opens the window of theme's choice (thanks to the Wine Look function). (you must give the name of a game as argument)

That's it ! Hope it will help.

Bye
chain2k Lundi 4 Février 2008 à 19:43
chain2kAnonymous

Great thanx)
I'll change the russian reference with your help.

still cant understand in which case we may need show_file

Edité par chain2k

guyx666 Jeudi 6 Mars 2008 à 0:23
guyx666

Tanxs your a half god.
i hope to make a script to install CoD4
with those info...


http://www.quebec666.com/ub666.jpg
THAiSi Jeudi 27 Mars 2008 à 11:12
THAiSiAnonymous

I modified the scripts in the scripts 'dosbox' section to install some old dos games I have in the system, but they don't work. no prefix is made, and no items is in the playonlinux menu. How does this work??

(and i mean, the dosbox support)
THAiSi Jeudi 27 Mars 2008 à 11:35
THAiSiAnonymous

ah never mind, forgot to install the playforlinux-dosbox-support package...
jefersondossantos Lundi 11 Mai 2009 à 13:24
jefersondossantosAnonymous

Hi Ghostofkendo,
For reasons of compatibility, I think all the functions need be translated. telecharger, attendre, select_prefixE, erreur... all this funcs need be translated to english.
PlayonLinux is a project to be used around the world.
I am Brazilian, but I write scripts in English just for compatibility.
Think about it, bye.
NSLW Lundi 11 Mai 2009 à 16:40
NSLW


[...]
telecharger, attendre, select_prefixE, erreur... all this funcs need be translated to english.

Quote from jefersondossantos

Hi jefersondossantos,
I think this functions are no longer to be used. There are new functions in "playonlinux/lib/interface_v3" which are written in english. The problem is that the documentation for them is poor, but you can look on these functions in interface_v3 and everything becomes clearer.
Ghostofkendo Mardi 12 Mai 2009 à 12:58
Ghostofkendo

Hi jefersondossantos,

As NSLW said, these functions aren't used anymore because these are from POL script language v2 and today, we use the version 3 of this language.

About the documentation issue, soon, it won't be a difficulty anymore.
Indeed, the old documentation that refers to the POL script language v2 (HERE) will be replaced soon by the new one, referring to POL script language v3 (it's already written, it just need to be uploaded to the website).
Finally, I'm writing a complete and up-to-date listing of the available functions when creating a script, with explanations and examples for each function, of course :) (I've written a little bit more than a half. Once the writing will be done, the editing and the upload will follow quickly)

EDIT: Voilà! The current documentation for the scriptwriters has replaced the old one. It's available at the same address so.
Concerning the listing of POL script language's functions, I've now written about 40 out of 53 functions ;-)


Bye

Edité par Ghostofkendo

Ghostofkendo Dimanche 31 Mai 2009 à 12:35
Ghostofkendo

Hi again,

As you can see in this topic, the brand new reference for the scriptwriters is available ! :)

Ciao