I'm trying to bind a key to copy URL's from specific files, but the code I have outputs the full path as text.
- Is there a way to just show the original file name as text but keep the hyperlink?
- Also, I like showing the full location every once in a while, but is there a way to remove the % and show as a blank instead.
The code I'm using is:
Clipboard COPYNAMES=url REGEXP (ftp://|file:///)(.*)//(.*) http://\2/\3
Sample: file:///C:/Users/Public/Documents/test%20sample%20file.txt
I am not sure what you are after. Can you give an example for both input and desired output.
A space is not valid in a URL, that is why its replaced with %20.
Your command has a couple of mistakes preventing it from matching. I think it should be something like this
Clipboard COPYNAMES=url REGEXP "(ftp://|file:///)(.*)/(.*)" "http://\2/\3"
this file:///C:/Users/Public/Documents/test%20sample%20file.txt
becomes http:///C:/Users/Public/Documents/test%20sample%20file.txt
If you just want the file name it could be.
Clipboard COPYNAMES=url REGEXP "(ftp://|file:///)(?:.*/)?(.*)" "http://\2"
this file:///C:/Users/Public/Documents/test%20sample%20file.txt
becomes http:///test%20sample%20file.txt
If you don't want a %20 don't use the URL function. You can just get the filename and then append the http using the regexp functionality.
Hello wowbagger, and thanks again for all your help.
I have a file called "test sample file.txt. I am trying to do two different things. The first being the most important
1. Copy the filenames but include the hyperlink so when I click on it, it will bring me to the file..
test sample file.txt
2. Copy the output location and include the hyperlink so I can click on it or copy the location
C:/Users/Public/Documents/test sample file.txt
I have tried using the nopath parameter instead of the url parameter, but it won't include the url.
Can you include what you want the clipboard to hold, as in the literal value required?
As for your current samples these match, but I don't think it is what you want as there is no url part.
Clipboard COPYNAMES=nopaths
test sample file.txt
Clipboard COPYNAMES
C:/Users/Public/Documents/test sample file.txt
Best to say something like
For file C:/Users/Public/Documents/test sample file.txt
I need file://test%20sample%20file.txt
I would like for the clipboard to hold the file name for one method
Test sample file.txt
And for the other method the location without %
C:/Users/Public/Documents/test sample file.txt
But when I paste it to my notes I can still click it to bring it up as it contains the original hyperlink location.
Got you, i don't think you can do that. The clipboard can contain text, images and html and so on.
What you want is html with text of the file name, and the href as the url.
This would generate the html but it will put it in to the clipboard as txt not rich text.
Clipboard COPYNAMES=url REGEXP "(ftp://|file:///)(?:.*/)?(.*)" "<a href='\0'>\2<\a>"
Bummer.
Yeah my original regex I posted worked fine other than the %.
I used to put them in email from Outlook with the hyperlink option on attachments and it wouldn’t include the full path or %. So now when I do it with dopus it’s hard to read with the long file path and so many % signs.
It works because you are including a url. many email clients (and word tools) will detect a url and make it clickable. A url cant contain a space it is not valid. The copy as url exists to create a valid url.
You can have a link, that has display text and a hidden url. My guess is outlook is creating a link for you.
You could make a feature request to the dopus team to allow setting the clipboard type (text, html, image...) so you could set the clipboard with rich text that would paste as a html.
This is more likely to get actioned if you link your account.