Jump to content

Help creating a workflow for copying a link to local file


Recommended Posts

Hi all,

 

The problem I'm trying to solve is that I would like a way to copy a direct link to a selected file of folder, whereafter I can insert the link into fx. Apple Notes, and then when clicking the link open thenfile in the desktop app or Finder.

This is to help me organise my projects and have a singe Apple Note or Task Manager be the hart of information. And an added benefit for me is that I really prefer working local with desktop apps instead of through the browser, where fx. a shared link from OneDrive would open a file.


I have been googeling and reading on the forum here, to find a solution to copy a filename of a selected file on my computer. Sadly I have not been able to find any solutions I can use. I do find some older treats on the topic, but the solutions doesn't work anymore, or at least I can't get them to work.

Do any of you know if this is doable, and can lead me in a direction to create a workflow that can help me copy a local file or folder path?

Thanks

Edited by Buchholdt
Link to comment

Can you explain in a little more detail exactly what you want to achieve, please? For example, do you want to copy a file and put it in another folder somewhere on your computer or are you trying to do something different?

 

Stephen

Link to comment

Here is a very basic starter for you:

 

CleanShot2024-08-23at13_44.06@2x.png.9e9e2301b3796744fd7a720f1a1e5d17.png

 

The Arg & Vars action is simply this, to assemble the file URL:

 

CleanShot2024-08-23at13_51.46@2x.thumb.png.65ae2fcd977f86b3f07718e0ecd14dd6.png

 

After that you could do a number of things, of course…copy the {var:fileURL} to the clipboard and paste it into an Apple note, maybe automate the opening of an Apple note (a little tricky!) and automatically paste it…

 

If anything is not clear or you need more help just ask and either I can clarify or someone better qualified can come along with better ideas. 😀

 

Stephen

Link to comment

It's OK - I accept you are always right. 😀 I've just checked again and the debugger shows the full path. I've no idea what I previously managed to do which made the debugger show the curtailed path: sorry! However, there is clearly not a problem and all works as you say it should (of course!).

 

Stephen

Link to comment

I was sufficiently interested in this to create a small, simple workflow called Create link to file which I've published on GitHub. It is simple but it does deal with the need to encode the file URL where the path or filename includes a space or spaces.

 

Here is the download link in case the workflow is of any interest.

 

Stephen

Link to comment

Quick tip: you should be able to both simplify it and make it more resilient by going Universal Action → URL Encode Text Automation Task → file://{query}. After all, despite being local file:// has the same rules for encoding.

Link to comment

I'll take a look at that later but when I used the URL Encode Text Automation Task I found that it encoded the forward slashes in the path too…which I think I did not want (?). At least, the link (in a markdown document) doesn't work when I do that!

 

Stephen

Edited by Stephen_C
Clarification of link location
Link to comment

Thank you so much for helping out here, and you two look into it😀
I have played around with the downloaded Github file at it works really well, and is a huge win for my workflow in so many ways.
 

Now I look forward to a very productive monday morning.

Thanks again 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...