Skip to content

OSL ‐ File Handling

Mistium edited this page Nov 29, 2023 · 23 revisions

Info About files structure here

Supported File Commands:

  1. file "open" file-path:

    • 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.
  2. file "open" "id" file-id:

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

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

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

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

    • Runs/opens the current file in its default application.
  7. 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.
  8. file "add" complete-file-json:

    • Adds the passed JSON representation of a file to the downloads folder of the logged-in user.
  9. file "get" data-id:

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

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

    • Represents a right-click action on a file, text, or window with specified IDs.

originOS v4.3.7 or later

  1. file "install_type" type_code(examples:app/osl/icn) file_type_icon(this is written in icn) 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.

You can find the file id of the current window's app file using the "current_file" variable

Supported on originOS v4.2.4 or later

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