I am trying to get a button with vbscript to set the path of several tabs.
Have attached a simplified version to demonstrate.
The code runs without error but the tab does not change to show the set folder.
Can anyone see what I am doing wrong here.
Function OnClick(ByRef ClickData)
Dim objTab
for each objTab in clickData.func.sourcetab.lister.tabsleft
objTab.path.Set "C:"
next
End Function
If I put in some MsgBoxs, I get this
MsgBox objTab.path --> this pops up showing the current path in that tab eg. D:\Somefolder
objTab.path.Set "C:"
MsgBox objTab.path --> this pos up showing C:\ as if the path of the tab has indeed changed
The path of the tab however does not change
The documentation says to use Set string:path
I have tried "C:", "C::path", ""C:"", ("C:") etc
Most tab and lister properties are read-only. To change things, have the script run a command using the Command object. There's one already set up to use the active tab inside ClickData.Func.Command:
In VBScript:
ClickData.Func.Command.RunCommand("Go ""C:""")
You can use the SetSourceTab method to change which tab it acts on.
You can change the path inside a Path object, but nothing will react to that change. It isn't changing the path in the folder tab; it's just changing an object that holds a snapshot of what that folder tab's path is/was, and which only your script can see.
Path objects are used in lots of different places in scripts, and can be used by your own script code to store and manipulate paths. That's why the Set method exists.