Skip to content

FileAssociationsFileOpenedEventArgs.FilePath

property · FileAssociationsFileOpenedEventArgs · cAlgo.API Since 5.1

DesktopCLICloud

Gets opened file path.

Environment behaviour

CLI — not supported. Available to plugins only, and plugins cannot run in the CLI.

Cloud — not supported. Available to plugins only, and plugins cannot run in the cloud.

Definition

public string FilePath {get;}
fileAssociationsFileOpenedEventArgs.FilePath: str

Returns string

Examples

protected override void OnStart()
{
    FileAssociations.Add("csv");
    FileAssociations.FileOpened += OnFileOpened;
}

private void OnFileOpened(FileAssociationsFileOpenedEventArgs args)
{
    if (args.FilePath.EndsWith(".csv", StringComparison.OrdinalIgnoreCase))
        Print("Importing {0}", args.FilePath);
}
def on_start(self):
    api.FileAssociations.Add("csv")
    api.FileAssociations.FileOpened += self.on_file_opened

def on_file_opened(self, args):
    if args.FilePath.lower().endswith(".csv"):
        api.Print(f"Importing {args.FilePath}")