Using vbscript and the clickdata object I have got everything I need but have not worked out how to get the parent directory into a string variable. Have the filename and path to it okay.
What I am doing is selecting a file and then when pressed my button will move the file to the parent directory, move up to the parent and then delete the directory that the original file was in not worrying about any left over files.
If you have a Path object and call Parent on it, it will be modified accordingly. (Note that this changes the object itself, rather than returning a string. You can then use the object where a string is required to get the path as a string. If you want to keep a copy of the original path, copy the Path object and call Parent on the copy.)
I must be missing something. I keep getting an error Object required for the mypath.parent line. The below is only the bit of the code which I want to test I am getting right. My first go at making a button with code so go easy on me. It must be something obvious.
For Each filepart In clickdata.func.sourcetab.Selected
mypath = filepart.path
movename = CStr(filepart.realpath)
mypath.parent
moveup = CStr(mypath.realpath)
dlg.Message = moveup
dlg.show
Next
Try changing the second line to Set mypath = filepart.path. In VBScript objects have to be assigned using Set; what's happening currently is it's being treated like a plain string.