Skip to content

OSL ‐ File Handling

Mistium edited this page Feb 23, 2024 · 23 revisions

Info About files structure here

Supported File Commands:

  • file "open" (file-path or file-uuid or file-name):
    • Opens the selected file to be modified.
    • Sets the "file" variable to the raw JSON of the current file.
    • Sets the "data" variable to the data value of the open file.

file "open" "test.osl"
file "open" user_folder ++ "/Downloads/test.txt"

  • file "open" "id" file-id:

    • Opens a file with the specified "file-id" for modification.
  • file "open" file-name file-type:

    • Opens a file with the specified "file-name" and "file-id" for modification.
  • file "open" "myself":

    • Opens the currently selected file for modification.
  • file "exists" file-path:

    • Returns a boolean indicating whether a file exists and is accessible by the current program.
  • file "start":

    • Runs/opens the current file in its default application.
  • file "render" size:

    • Renders the currently open file.
    • You can add "interactable" at the end of this command to render it as a file instead of as an icon.
  • (v4.5.1) file "download" "file_name.file_extension" "icon_code" "file_data":

    • Adds a file to the downloads folder.
  • file "get" data-id:

    • Gets a specific file entry based on the data ID.
  • file "set" data-id:

    • Sets a specific file entry based on the data ID.
  • rightclick "file/text/window" "file-id/text/window-id":

    • Represents a right-click action on a file, text, or window with specified IDs.
  • (v4.5.1) You can access the uuid of the file's self through the variable: current_file_uuid

  • (v4.3.7) file "install_type" type_code(examples:app/osl/icn) file_type_icon(icn code) file_type(examples:3d Model/Script/Application):

    • Adds a new file type to the os system
    • Example:
file "install_type" "txt" "c #588fbf w 6 square 0 -2 5 6 square -2 3 3 5 w 3 c #335776 line 2 9.5 6.5 5 cont 2 5 cont 2 9.5 w 2 line -4 1 4 1 line -4 -3 0 -3 line -4 -7 2 -7" "Text File"

These commands and file attributes allow for file management and manipulation within the OriginOS environment. They enable you to work with files, open them, render them, and perform various operations on them.

  • (v4.2.4) You can get the file path of the current window's app file with the "current_file_path" variable

originOS Wiki

Wiki Views:
:views

OSL | RSH | ICN

Clone this wiki locally