-
Notifications
You must be signed in to change notification settings - Fork 45
Add documentation about include mechanism #856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2a9588e
Add documentation about include mechanism
ImperatorS79 8a483a9
Update script-js.md
ImperatorS79 47cef6e
Update script-js.md
ImperatorS79 f51a3c7
Update script-js.md
ImperatorS79 702bf83
Include by ID
ImperatorS79 f9e8747
Merge branch 'master' into ImperatorS79-patch-3
ImperatorS79 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 () { | ||
|
|
@@ -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 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. | ||
|
|
||
|
|
@@ -216,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() | ||
| ... | ||
|
|
@@ -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 `<scriptname>/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"); | ||
| ... | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the indention?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did it in the spirit of the indent in #### Pre/Post install hooks. |
||
| var registrySettings = new AppResource().application([TYPE_ID, CATEGORY_ID, APPLICATION_ID]).get("registry.reg"); | ||
| wine.regedit().patch(registrySettings); | ||
| ``` | ||
|
|
@@ -267,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" | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the deep indention?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is the same than in #### Pre/Post install hooks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@plata what do you think? Should we always indent the
...or should we not indent the...at all?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you show a comparing screenshot?