Coercing a Path to a File

I had a question about the Shortcuts app’s Content Graph engine, which is discussed in the documentation here and is described as follows:

Much of the magic of Shortcuts comes from its Content Graph engine, which intelligently converts data into shortcut actions on the fly. When an action expects one type of content and you pass it another type of content, the Content Graph automatically converts that content to the appropriate type. [emphasis mine]

When necessary, you can manually change the content type of data, and this is explained here and in the following paragraph:

Shortcuts automatically detects the type of content stored in a variable and uses that content as the variable’s default content type. You can force the variable to change content types.

An action that requires a file (e.g. the rename action) will not accept a path–the automatic conversion mentioned above doesn’t work. As an alternative, I’ve tried to manually change the path to a file, as illustrated in the following screenshot. However, this doesn’t work (the content type remains text), and I wondered if anyone knew of a way to get this to work?

BTW, a workaround is to use an AppleScript, but that’s kinda a last resort.

Thanks for reading my post.

Don’t you want to coerce it to a File Path?

technomorph. Thanks for looking at my post.

What I’m attempting to do is get a file object from a path with the intent of using the file object in such Shortcuts’ actions as rename, move, delete, and so on. If I understand things correctly, it would conceptually be the rough equivalent of AppleScript’s POSIX file and ASObjC’s fileURLWithPath.

I can easily understand how a file object would not be the property of a path, which is just text. However, it seems like there could be a Get File action which would create a file object. Just by way of analogy, the following shortcut gets a date string from a Text action and creates a date object.