From 2a9588ece1235c525ac4c511f67d55137c5dc7a9 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Mon, 4 Feb 2019 10:08:38 +0100 Subject: [PATCH 1/5] Add documentation about include mechanism Fix #785. --- docs/_docs/Develop/script-js.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/_docs/Develop/script-js.md b/docs/_docs/Develop/script-js.md index c989e37a48..74467e8cc3 100644 --- a/docs/_docs/Develop/script-js.md +++ b/docs/_docs/Develop/script-js.md @@ -200,6 +200,13 @@ var Installer = Java.extend(org.phoenicis.scripts.Installer, installerImplementa ### Advanced This section describes some advanced methods which give you more possibilities to control your script. +### Include mechanism +When you want to use a certain functionality in your scripts, you need to include it in your scripts, for example: +```javascript +include(["engines", "wine", "quick_script", "steam_script"]); +``` +allows you to execute a steam script. The content of the include can be determined from the path of the functionality (in the scripts repository) you want to use and the id of the functionality (check the `script.json` file near the `script.js` file containing the functionality). + #### Executable arguments By default, the `.executable` runs the application without arguments. If you need arguments, pass an array as second parameter. @@ -247,6 +254,8 @@ Specific wine architecture ("x86" or "amd64"): ``` Specific windows version: ```javascript +include(["engines", "wine", "plugins", "windows_version"]); + ... .preInstall(function(wine, wizard) { wine.windowsVersion("win7"); }) @@ -258,6 +267,9 @@ If the script requires a special registry setting, there are 2 options: 2. If the setting is special for this script, use a registry file. Create a `registry.reg` in `/resources` (see [IE6](https://github.com/PhoenicisOrg/scripts/blob/master/Applications/Internet/Internet%20Explorer%206.0/resources/ie6.reg)) and apply this in `pre/postInstall()` via ```javascript +include(["utils", "functions", "apps", "resources"]); +include(["engines", "wine", "plugins", "regedit"]); + ... var registrySettings = new AppResource().application([TYPE_ID, CATEGORY_ID, APPLICATION_ID]).get("registry.reg"); wine.regedit().patch(registrySettings); ``` From 8a483a912a73b600ece08a7aee7bd6ba64536851 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Mon, 4 Feb 2019 11:07:34 +0100 Subject: [PATCH 2/5] Update script-js.md --- docs/_docs/Develop/script-js.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_docs/Develop/script-js.md b/docs/_docs/Develop/script-js.md index 74467e8cc3..9315132aba 100644 --- a/docs/_docs/Develop/script-js.md +++ b/docs/_docs/Develop/script-js.md @@ -205,7 +205,7 @@ When you want to use a certain functionality in your scripts, you need to includ ```javascript include(["engines", "wine", "quick_script", "steam_script"]); ``` -allows you to execute a steam script. The content of the include can be determined from the path of the functionality (in the scripts repository) you want to use and the id of the functionality (check the `script.json` file near the `script.js` file containing the functionality). +allows you to execute a steam script. The content of the include can be determined from the path made up of the id's on the different folder levels leading to the functionality. #### Executable arguments By default, the `.executable` runs the application without arguments. If you need arguments, pass an array as second parameter. From 47cef6ea1cc9bd5c3132603814f8d58288e4c8f9 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Wed, 6 Feb 2019 20:56:48 +0100 Subject: [PATCH 3/5] Update script-js.md --- docs/_docs/Develop/script-js.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_docs/Develop/script-js.md b/docs/_docs/Develop/script-js.md index 9315132aba..92ea12aeaa 100644 --- a/docs/_docs/Develop/script-js.md +++ b/docs/_docs/Develop/script-js.md @@ -205,7 +205,7 @@ When you want to use a certain functionality in your scripts, you need to includ ```javascript include(["engines", "wine", "quick_script", "steam_script"]); ``` -allows you to execute a steam script. The content of the include can be determined from the path made up of the id's on the different folder levels leading to the functionality. +allows you to execute a steam script. The content of the include can be determined from the path made up of the id's on the different folder levels leading to the functionality. Those id's are located in a .json file inside each directory which makes up the path. #### Executable arguments By default, the `.executable` runs the application without arguments. If you need arguments, pass an array as second parameter. From f51a3c778b7503b72f2a40110fa415edcb6d85b1 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Tue, 26 Feb 2019 21:46:49 +0100 Subject: [PATCH 4/5] Update script-js.md --- docs/_docs/Develop/script-js.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_docs/Develop/script-js.md b/docs/_docs/Develop/script-js.md index 92ea12aeaa..3ed319e9ed 100644 --- a/docs/_docs/Develop/script-js.md +++ b/docs/_docs/Develop/script-js.md @@ -203,9 +203,9 @@ This section describes some advanced methods which give you more possibilities t ### Include mechanism When you want to use a certain functionality in your scripts, you need to include it in your scripts, for example: ```javascript -include(["engines", "wine", "quick_script", "steam_script"]); +include("engines.wine.quick_script.steam_script"); ``` -allows you to execute a steam script. The content of the include can be determined from the path made up of the id's on the different folder levels leading to the functionality. Those id's are located in a .json file inside each directory which makes up the path. +allows you to execute a steam script. The content of the include is the id of the functionality, which can be found in the `script.json` file located next to the `script.js` file implementing the functionality. #### Executable arguments By default, the `.executable` runs the application without arguments. If you need arguments, pass an array as second parameter. From 702bf8314e26870344ecf25e8b49966597aa11f3 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sat, 2 Mar 2019 16:51:00 +0100 Subject: [PATCH 5/5] Include by ID --- docs/_docs/Develop/script-js.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/_docs/Develop/script-js.md b/docs/_docs/Develop/script-js.md index 3ed319e9ed..4adf92afca 100644 --- a/docs/_docs/Develop/script-js.md +++ b/docs/_docs/Develop/script-js.md @@ -19,7 +19,7 @@ QuickScripts use the latest stable wine version by default (recommended). A basic script looks like: ```javascript -include(["engines", "wine", "quick_script", "steam_script"]); +include("engines.wine.quick_script.steam_script"); var installerImplementation = { run: function () { @@ -55,7 +55,7 @@ For a different shortcut (e.g. if you want to pass arguments): ### OriginScript A basic script looks like: ```javascript -include(["engines", "wine", "quick_script", "origin_script"]); +include("engines.wine.quick_script.origin_script"); var installerImplementation = { run: function () { @@ -81,7 +81,7 @@ You can determine the app ID by going into `C:\Origin Games\*name of the game*\ A basic script looks like: ```javascript -include(["engines", "wine", "quick_script", "uplay_script"]); +include("engines.wine.quick_script.uplay_script"); var installerImplementation = { run: function () { @@ -105,7 +105,7 @@ Installs a local Windows executable. Shows a setup window browse step (see [Setu A basic script looks like: ```javascript -include(["engines", "wine", "quick_script", "local_installer_script"]); +include("engines.wine.quick_script.local_installer_script"); var installerImplementation = { run: function () { @@ -129,7 +129,7 @@ Downloads and installs a Windows executable. A basic script looks like: ```javascript -include(["engines", "wine", "quick_script", "online_installer_script"]); +include("engines.wine.quick_script.online_installer_script"); var installerImplementation = { run: function () { @@ -152,7 +152,7 @@ var Installer = Java.extend(org.phoenicis.scripts.Installer, installerImplementa ### CustomInstallerScript Executes a custom installation command: ```javascript -include(["engines", "wine", "quick_script", "custom_installer_script"]); +include("engines.wine.quick_script.custom_installer_script"); var installerImplementation = { run: function () { @@ -177,7 +177,7 @@ var Installer = Java.extend(org.phoenicis.scripts.Installer, installerImplementa A basic script looks like: ```javascript -include(["engines", "wine", "quick_script", "zip_script"]); +include("engines.wine.quick_script.zip_script"); var installerImplementation = { run: function () { @@ -223,8 +223,8 @@ You can find the complete list of available verbs [here](https://github.com/Phoe For example, in the script for "Assassin’s Creed: Brotherhood": ```javascript -include(["engines", "wine", "verbs", "d3dx9"]); -include(["engines", "wine", "verbs", "crypt32"]); +include("engines.wine.verbs.d3dx9"); +include("engines.wine.verbs.crypt32"); new SteamScript() ... @@ -254,7 +254,7 @@ Specific wine architecture ("x86" or "amd64"): ``` Specific windows version: ```javascript -include(["engines", "wine", "plugins", "windows_version"]); +include("engines.wine.plugins.windows_version"); ... .preInstall(function(wine, wizard) { wine.windowsVersion("win7"); @@ -267,8 +267,8 @@ If the script requires a special registry setting, there are 2 options: 2. If the setting is special for this script, use a registry file. Create a `registry.reg` in `/resources` (see [IE6](https://github.com/PhoenicisOrg/scripts/blob/master/Applications/Internet/Internet%20Explorer%206.0/resources/ie6.reg)) and apply this in `pre/postInstall()` via ```javascript -include(["utils", "functions", "apps", "resources"]); -include(["engines", "wine", "plugins", "regedit"]); +include("utils.functions.apps.resources"); +include("engines.wine.plugins.regedit"); ... var registrySettings = new AppResource().application([TYPE_ID, CATEGORY_ID, APPLICATION_ID]).get("registry.reg"); wine.regedit().patch(registrySettings); @@ -279,8 +279,8 @@ If the QuickScript is not sufficient for you, you can still write a custom scrip The frame for a custom script looks like this: ```javascript -include(["engines", "wine", "engines", "wine"]); -include(["engines", "wine", "shortcuts", "wine"]); +include("engines.wine.engines.wine"); +include("engines.wine.shortcuts.wine"); var application = "application name"