Strip portion of filename path to pass on to function

Pleased enough with the initial functionality but wondering what I'm missing in terms of passing through a filename with only a portion of its path.

Example: full path might be D:\Sandbox\trunk\information\resources.html

I'd like to be able to pass the file name with only part of the path to my browser, removing the Sandbox\trunk\ part of the path & leaving the rest intact.

E.g., "http://productionwebserver/"{filepath$|nopath} will give me "http://productionwebserver/Sandbox/trunk/information/resources.html" while what I'd like to get would be "http://productionwebserver/information/resources.html"

I thought the subdir might work, but the help file is a bit confusing to me.

Anywho, I have a functioning button that hits against my development server (since that's mapped to a drive letter), but occasionally I'm not paying attention to where I am & have occasionally sent files from the sandbox to the browser & it gets crabby in response. :smiley:

Thank you in advance!

Are you putting the resultant URL into a command (or launching it via a web browser etc.), or into the clipboard for pasting into something else?

Passing it over to a browser. The idea here is that I'd like to be able to review the files in a browser whilst they're still in the sandbox without me needing to navigate throughout the website. A bit lazy on my part, perhaps, but I thought it'd be a kewl way to demonstrate the power of Directory Opus to my co-workers as well. :slight_smile:

Whilst the subject of the clipboard is floating around, is there anyway to just put some plain-text onto the clipboard via a button? I'd like to have a little panel of text snippets that I use all over the place (i.e., many different applications from email to image editing) & it'd be very handy to be able to hit a button & have a snippet for pre-defined text entered into the clipboard for my laziness. :slight_smile: Thx!

I think this should do what you want?

Clipboard COPYNAMES=nopaths REGEXP (.*) http://www.domainname.com/\1
Clipboard SET Copy This Text

[quote="ktbcrash"]
I think this should do what you want?

Clipboard COPYNAMES=nopaths REGEXP (.*) http://www.domainname.com/\1

Throw in a {clip} in the browser call & it worked perfectly! I had read the regexp description in the notes & despite using RegEx in TextPad everyday, I felt very stupid. Thank you for your assistance!

[quote="ktbcrash"]

Clipboard SET Copy This Text

Remember when I said I felt very stupid in the previous reply? I'm not sure there's a even stupider to feel in regards to this. Honestly must have parsed over this a dozen times and not once did the SET register in my awareness. :frowning:

Also works as advertised & makes me happy-happy!

[quote="Phoig"][quote="ktbcrash"]
I think this should do what you want?

Clipboard COPYNAMES=nopaths REGEXP (.*) http://www.domainname.com/\1

Throw in a {clip} in the browser call & it worked perfectly! I had read the regexp description in the notes & despite using RegEx in TextPad everyday, I felt very stupid. Thank you for your assistance![/quote]

:blush: Whoops! Jumped the gun a bit! Sorry 'bout that (just spent the last 2 hours training staff on Office 2010...)

Anywho, the "middle path" segments are not being included which is the kinda crucial part of the exercise.

Example:

Selected file is: D:\WebSandbox\trunk[b]happyfun\foo[/b]bar.aspx

needs to become: devserver/happyfun/foo/bar.aspx

Instead, it's becoming: devserver/bar.aspx

The \happyfun\foo\ segment is getting chopped out along with the rest of the path. :frowning:

If you take out the "=nopaths" then you'll pass the full paths into the regexp.

You can then change the regexp so that it strips off the appropriate path prefix (e.g. D:\WebSandbox\trunk) before adding the server prefix.

Remember that you'll need to escape characters like \ in the regexp. Also, you can provide multiple regexp search & replace expressions if you need the command to handle various different prefixes.

Something like this, I think:

Clipboard COPYNAMES REGEXP D:\\WebSandbox\\trunk\\(.*) http://www.domainname.com/\1

[quote="leo"]If you take out the "=nopaths" then you'll pass the full paths into the regexp.

You can then change the regexp so that it strips off the appropriate path prefix (e.g. D:\WebSandbox\trunk) before adding the server prefix.

Remember that you'll need to escape characters like \ in the regexp. Also, you can provide multiple regexp search & replace expressions if you need the command to handle various different prefixes.

Something like this, I think:

Clipboard COPYNAMES REGEXP D:\\WebSandbox\\trunk\\(.*) http://www.domainname.com/\1

That did the trick (verified too! :slight_smile:) RegEx always seems to give me fits; I have to fight some days to get a decent pattern match in either DOpus or TextPad. I have a whole pile of the expressions saved over the years, but it never ceases to amaze me how I constantly am encountering new patterns to match on. :confused:

Oh, well, thank you all for your assistance!

Just in case I didn't think you were kewl enough, this little tip led me to a bit of song-n-dance, but eventually got a function to take a selected file from either my sandbox or my repository & display the equivalent file from the dev-server ('cuz sometimes I'm in one and other times I'm in the other & I'm not always paying attention to where I'm at when I want to preview). Mighty, mighty fun! :smiley:

Clipboard COPYNAMES REGEXP D:\\WebSandbox\\trunk\\(.*) http://devserver/\1 REGEXP X:\\(.*) http://devserver/\1

Thank you!