Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| indigo_5_documentation:folder_class [2011/04/07 23:03] – [Commands (indigo.*.folder.*)] jay | indigo_5_documentation:folder_class [2024/06/27 00:08] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Folders ====== | ||
| + | The folder class represents a folder in the various Indigo user interfaces (Mac client, Indigo Touch, web, etc.). | ||
| + | |||
| + | ==== Class Properties ==== | ||
| + | |||
| + | ^Property ^ Type ^Description ^ | ||
| + | |//'' | ||
| + | |//'' | ||
| + | |//'' | ||
| + | |||
| + | ==== Commands (indigo.*.folder.*) ==== | ||
| + | |||
| + | |||
| + | The commands to manipulate folders are within the object lists defined in the IOM Overview page (indigo.devices.folder.*, | ||
| + | |||
| + | === Create === | ||
| + | |||
| + | Create a folder. This method returns a **copy** of the newly created folder. | ||
| + | |||
| + | ^ Command Syntax Examples | ||
| + | |< | ||
| + | |||
| + | ^ Parameters | ||
| + | ^ Parameter | ||
| + | |//'' | ||
| + | |||
| + | === Delete === | ||
| + | |||
| + | Delete the specified folder. | ||
| + | |||
| + | ^ Command Syntax Examples | ||
| + | |< | ||
| + | |||
| + | ^ Parameters | ||
| + | ^ Parameter | ||
| + | |direct parameter| | ||
| + | |//'' | ||
| + | |||
| + | === Duplicate === | ||
| + | |||
| + | Duplicate the specified folder. This method returns a copy of the new folder. | ||
| + | |||
| + | ^ Command Syntax Examples | ||
| + | |< | ||
| + | |||
| + | ^ Parameters | ||
| + | ^ Parameter | ||
| + | |direct parameter| | ||
| + | |//'' | ||
| + | |||
| + | === Set Remote Display === | ||
| + | |||
| + | Use this command to set the remote display flag for the folder. | ||
| + | |||
| + | ^ Command Syntax Examples | ||
| + | |< | ||
| + | |< | ||
| + | |||
| + | ^ Parameters | ||
| + | ^ Parameter | ||
| + | |direct parameter| | ||
| + | |//'' | ||
| + | |||
| + | ==== Examples ==== | ||
| + | |||
| + | Since folders aren't available in AppleScript, | ||
| + | |||
| + | < | ||
| + | newFolder = indigo.variables.folder.create(" | ||
| + | |||
| + | # test to see if a folder exists by Name | ||
| + | if ("My New Variable Folder" | ||
| + | # should execute this because we just created it | ||
| + | indigo.server.log(" | ||
| + | |||
| + | # test to see if a folder exists by ID | ||
| + | if (newFolder.id in indigo.variables.folders): | ||
| + | # should execute this because we just created it | ||
| + | indigo.server.log(" | ||
| + | |||
| + | # set the remote display flag on the folder immediately | ||
| + | indigo.variables.folder.displayInRemoteUI(newFolder, | ||
| + | |||
| + | # a ValueError exception with the text " | ||
| + | # create a folder with a name that already exists | ||
| + | try: | ||
| + | indigo.variables.folder.create(" | ||
| + | except ValueError, e: | ||
| + | if str(e) == " | ||
| + | # should execute this because it's a dup name | ||
| + | indigo.server.log(" | ||
| + | else: | ||
| + | indigo.server.log(" | ||
| + | |||
| + | # NOTE - at this point, newFolder.remoteDisplay is still true (default for new folders) | ||
| + | # because we're still working with a copy. Refresh it to get it updated: | ||
| + | newFolder.refreshFromServer() | ||
| + | |||
| + | # change the name of a folder | ||
| + | newFolder.name=" | ||
| + | newFolder.replaceOnServer() | ||
| + | |||
| + | # duplicate the folder | ||
| + | indigo.variables.folder.duplicate(newFolder, | ||
| + | |||
| + | # delete a folder | ||
| + | indigo.variables.folder.delete(newFolder) | ||
| + | |||
| + | #test to see if a folder doesn' | ||
| + | if ("My New Variable Folder" | ||
| + | # should execute this because we just deleted it | ||
| + | indigo.server.log(" | ||
| + | |||
| + | # test to see if a folder doesn' | ||
| + | if (newFolder.id not in indigo.variables.folders): | ||
| + | # should execute this because we just deleted it | ||
| + | indigo.server.log(" | ||
| + | </ | ||