class
ScriptProjects.
PromptOverwriteResult
value
Bases: Enum
Enum that enumerates the possible results for the overwrite handling.
Yes
= 0
The user selected “Yes”, which means that the file or item should be overwritten.
No
= 1
The user selected “No”, which means that the file or item should not be overwritten.
Cancel
= 2
The user selected “Cancel”, which means that the project archive extraction should be terminated.
class
ScriptProjects.
VersionUpdateFlags
value
Bases: Enum
Flags for the _3S.CoDeSys.VersionCompatibilityManager.IVersionCompatibilityManager2.SetVersionUpdateFlags(_3S.CoDeSys.VersionCompatibilityManager.VersionUpdateFlags) method.
Regular
= (0,)
The _3S.CoDeSys.VersionCompatibilityManager.IVersionCompatibilityManager checks for updates when opening a project and displays a related dialog for the user to manually update the versions.
NoUpdates
= (1,)
The _3S.CoDeSys.VersionCompatibilityManager.IVersionCompatibilityManager will not check for updates when the next project will be opened. Therefore, there will be no dialog.
SilentMode
= (2,)
Determines if a dialog for user interaction is shown or not. If this flag is set, there will be no dialog.
Remarks: This flag is often combined with one of the Update… flags.
UpdateAllCustomProviders
= (4,)
The _3S.CoDeSys.VersionCompatibilityManager.IVersionCompatibilityManager will automatically update all items to the newest available version when the next project will be opened. To avoid a dialog, combine this flag with the _3S.CoDeSys.VersionCompatibilityManager.VersionUpdateFlags.SilentMode flag.
UpdateLibraries
= (8,)
The _3S.CoDeSys.VersionCompatibilityManager.IVersionCompatibilityManager will automatically update all libraries to the newest available version when the next project will be opened. To avoid a dialog, combine this flag with the _3S.CoDeSys.VersionCompatibilityManager.VersionUpdateFlags.SilentMode flag.
UpdateCompiler
= (16,)
The _3S.CoDeSys.VersionCompatibilityManager.IVersionCompatibilityManager will automatically update the compiler version to the newest available version when the next project will be opened. To avoid a dialog, combine this flag with the _3S.CoDeSys.VersionCompatibilityManager.VersionUpdateFlags.SilentMode flag.
UpdateVisualisation
= (32,)
The _3S.CoDeSys.VersionCompatibilityManager.IVersionCompatibilityManager will automatically update the visualisation profile to the newest available version when the next project will be opened. To avoid a dialog, combine this flag with the _3S.CoDeSys.VersionCompatibilityManager.VersionUpdateFlags.SilentMode flag.
UpdateDevices
= (64,)
The _3S.CoDeSys.VersionCompatibilityManager.IVersionCompatibilityManager will automatically update the device profile to the newest available version when the next project will be opened. To avoid a dialog, combine this flag with the _3S.CoDeSys.VersionCompatibilityManager.VersionUpdateFlags.SilentMode flag.
UpdateVisualisationStyles
= (128,)
The _3S.CoDeSys.VersionCompatibilityManager.IVersionCompatibilityManager will automatically update the used visualization styles to the newest available versions when the next project will be opened. To avoid a dialog, combine this flag with the _3S.CoDeSys.VersionCompatibilityManager.VersionUpdateFlags.SilentMode flag.
UpdateUnresolvedUnboundPlaceholders
= (256,)
The _3S.CoDeSys.VersionCompatibilityManager.IVersionCompatibilityManager will automatically redirect the unresolved unbound placeholders to the newest available versions when the next project will be opened. To avoid a dialog, combine this flag with the _3S.CoDeSys.VersionCompatibilityManager.VersionUpdateFlags.SilentMode flag.
UpdateAll
= 65532
The _3S.CoDeSys.VersionCompatibilityManager.IVersionCompatibilityManager will automatically update all items to the newest available version when the next project will be opened. To avoid a dialog, combine this flag with the _3S.CoDeSys.VersionCompatibilityManager.VersionUpdateFlags.SilentMode flag.
Remarks: Please note that this enum value sets all bits in the range of 2 to 15 to “1”.
class
ScriptProjects.
ScriptProjects
Bases: object
The ScriptDriverProjects uses this interface to provide project handling functionality for the python scripts.
create
path
primary=True
Creates a new project.
path (str) – The location where the project content is to be stored.
primary (bool or None) – if set to True the project will be the new primary project. See ScriptProject.primary for more information.
The created ScriptProject instance.
open
path
password=None
primary=True
encryption_password=None
session_user=None
session_password=None
update_flags=VersionUpdateFlags.NoUpdates
allow_readonly=False
Opens the specified project.
WARNING | |
---|---|
If the password is omitted, None or empty string, opening a password protected archive will prompt the user for a password.
For the update_flags parameter, the VersionUpdateFlags.SilentMode is usually combined with one or more of the Update... flags defined in the VersionUpdateFlags enum. If you only pass some Update... flags without the VersionUpdateFlags.SilentMode flag, they will be used as initial values when the update dialog pops up. To silently update everything, you can pass the combination VersionUpdateFlags.SilentMode|VersionUpdateFlags.UpdateAll.
path (str) – The path of the project file to open.
password (str) – The password for the project encryption.
primary (bool) – if set to True, open as primary project. See ScriptProject.primary for more information.
encryption_password (str) – Version added: 3.5.5.0 The project encryption password.
session_user (str) – Version added: 3.5.5.0 The project session user (project usermanagement).
session_password (bool) – Version added: 3.5.5.0 The project session password (project usermanagement).
update_flags (VersionUpdateFlags) – Version added: 3.5.8.0 The flags telling whether some aspects (libraries, compiler version) ought to be updated when the project is loaded. The default is to silently update nothing.
session_password – Version added: 3.5.8.0 If set to True, allow the project to be opened as read-only.
The opened project.
open_archive
archivefile
projectpath
overwrite=False
password=None
encryption_password=None
session_user=None
session_password=None
update_flags='VersionUpdateFlags.NoUpdates'
prompt_absolute_path=None
Opens a project archive.
The parameter projectpath will be evaluated using the following algorithm:
If it’s the path of an existing file, and overwrite is true, it will be overwritten.
If it’s the path to an existing file, and overwrite is false, an IOException will be thrown.
If this points to an existing directory, the project will be extracted with its original name into that directory.
If the path does not exist, but ends with a “/” or “", the directory (and all non-existing parent directories) will be created, then the project will be extracted with its original name into that directory.
If the path does not exist, but the parent directory exists, the given path (directory and file name) will be used.
Otherwise, if the path ends with “.project” or “.library”, the project will be extracted using the given path, creating all necessary parent directories.
In all other cases, a DirectoryNotFoundException will be thrown.
This method will return None when the archive extraction was cancelled due to an error, overwriting of files or cancel request for absolute path handling. If a password is given, SystemInstances.ObjectManager must implement IObjectManager9, or a MissingMethodException will be thrown (even if the project is not actually password protected). If the password is omitted, None or empty string, opening a password protected archive will prompt the user for a password.
For the update_flags parameter, the VersionUpdateFlags.SilentMode is usually combined with one or more of the Update... flags defined in the VersionUpdateFlags enum. If you only pass some Update... flags without the VersionUpdateFlags.SilentMode flag, they will be used as initial values when the update dialog pops up. To silently update everything, you can pass the combination VersionUpdateFlags.SilentMode|VersionUpdateFlags.UpdateAll.
archivefile (str) – The path of the project archive.
projectpath (str) – The path for the extracted project.
overwrite (bool) – if set to true, overwrite existing objects and project files
password (str) – The password.
encryption_password (str) – Version added: 3.5.5.0 The project encryption password.
session_user (str) – Version added: 3.5.5.0 The project session user (project usermanagement).
session_password (str) – Version added: 3.5.5.0 The project session password (project usermanagement).
update_flags (VersionUpdateFlags) – Version added: 3.5.8.0 The flags telling whether some aspects (libraries, compiler version) ought to be updated when the project is loaded. The default is to silently update nothing.
prompt_absolute_path (PromptAbsolutePath) – Version added: 3.5.16.0 The callback which allows to decide if an project archive item with an absolute path should be extracted relatively to the project file or not at all. Or if the operation should be canceled. The default is to cancel the operation.
The opened project or null if it was canceled.
get_by_path
path
Gets a Project by the absolute path where the project is physically stored.
path (str) – The path to the project.
The project instance
property
primary
Gets the primary project, or None if no primary project currently exists.
The primary project is the one the user usually works with. See ScriptProject.primary for more information.
property
all
Gets a (possibly empty) List of all currently opened projects.
list[ScriptProject]
convert
path
output_path=None
converter=None
primary=True
Converts the specified project.
Currently, password and device conversion prompts cannot be caught by the script.
3.5.0.0
path (str) – The path of the project to convert.
output_path (str) – The output path. This parameter is optional, if it is omitted, the output path will be auto-generated from the project path by changing the file extension.
converter (str) – The GUID of the CoDeSys converter factory as string object. This parameter is optional, if omitted, the script engine will try to guess using the extension of the file name.
primary (bool) – If set to True, open as primary project. See ScriptProject.primary for more information.
The converted project.
class
ScriptProjects.
ScriptProjectArchiveCategories
iterable=()
/
Bases: list
The list of available archive categories.
Enumerating this object will give all categories available in the current installation. Some often used categories are defined here, but may be unavailable (throw exceptions) in customized environments. An instance of this object is injected into the scriptengine module with the name “ArchiveCategories”.
property
default
The default selection of archive categories.
See also: ScriptProjectArchiveCategory.selected_by_default
property
none
No categories (empty set).
This is a special sentinel value, different from passing an arbitrary empty list.
property
all
A collection of all categories (returns self).
property
compileinfo
Gets the category for the compileinfo.
This is needed for logins and online changes into an existing application without download.
property
libraries
Gets the category for the libraries referenced by the project.
property
devices
Gets the category for the device descriptions of the devices used in the project.
property
options
Gets the category for the project, user, and machine specific preferences.
property
ftd
Gets the category for the FDT Bulk Data.
property
images
Gets the category for the imagepool images of the project.
property
bootproject
Gets the category for the files containing offline boot applications, that were generated for the current project.
property
libraryprofile
Gets the category for the library profile that is currently in use with this project.
property
visualstyles
Gets the category for the visualization styles which are currently referenced by this project.
property
visualprofile
Gets the category for the active visualization profile.
property
visuextensions
Gets the category for the active visualization extensions.
class
ScriptProjects.
ScriptProjectArchiveCategory
Bases: object
Represents a category of items which can be included into a project archive.
property
guid
Gets the Guid for this category.
Guid
property
name
Gets a display name for this project category, e.g. “Referenced libraries”.
This string should be localized.
str
property
description
Gets a description for this project category.
This string should be localized.
str
property
selected_by_default
Gets a boolean value indicating whether this category should be selected for project archive inclusion per default.
This is a hint for the presentation layer.
bool
ScriptProjects.
PromptAbsolutePath
self
path
[Delegate]. This method can be used to decide if a project archive item with absolute path should be extracted relatively to the project file or not at all. Or if the whole operation should be canceled.
path (str) – Path to the location where the item wants to be extracted to
Yes if the item should be extracted relatively to the project file. No if the item should not be extracted at all. Cancel if the operation should be canceled.