Introducing SRP_Path in SRP Utilities 1.5.5
SRP is pleased to announce the release of SRP Utilities 1.5.5. In addition to some minor fixes and updates, the highlight of this release is SRP_Path. This service-oriented routine provides more than thirty functions for working with file paths. The tedium of manipulating paths is over. Let the era of single line convenience commence!
SRP_Path is a single stored procedure providing multiple services, just like OpenInsight’s Utility function. Some of them do very simple things, like AddBackslash and RemoveBackslash. Sure, these normally only require a couple lines of code, but it’s still nice to reduce them down to a single call. However, things get a bit more complicated when you want to rename the extension or make an absolute path relative to another path. Regardless of your needs, SRP_Path will get you there.
One especially handy service is called FitToEditline. This service takes an EDITLINE’s control ID and produces a newly formatted path that is elegantly reduced to fit nicely within the EDITLINE’s text area. The code is simple:
Path = "C:\Users\Johnny Appleseed\AppData\Local\SomeApplication\Logs\2016_02_04_16_55_22.log" Result = SRP_Path("FitToControl", Path, @Window:".MY_EDITLINE") Set_Property(@Window:".MY_EDITLINE", "TEXT", Result)
As a result, your path is shortened in such a way as to ensure the filename is always visible.
Another unique feature of SRP_Path is its support for paths with command line parameters. Let’s say you are given a string that looks like this:
"C:\path with space\file with space.exe" /a /b /c="some data"
If what you want is just the path, simply do this:
Path = SRP_Path("GetPath", '"C:\path with space\file with space.exe" /a /b /c="some data"')
The result will be just the path portion without the quotes. You can also GetDirectory, GetExtension, GetFilename, and GetParameters. Or go the other way with RemoveDirectory, RemoveExtension, RemoveFilename, and RemoveParameters. There’s a service to meet any need.
You can download SRP Utilities 1.5.5 for free! Be sure to check out the full documentation for SRP_Path here.
Leave a Reply