Page 1 of 1

Scripting - How to identify branch view

Posted: 31 Oct 2015 14:20
by nerdweed
How can we identify if the branch view is active.

I am trying to do this
1. In a folder with lots (say 10) folders, I enter a branch view after selecting few (say 5) of them
2. Within those folder, I move files to some other folders
3. I want to delete those folders which the branch view is active on if they don't have any files in them. (most times there wouldn't be any files, but a check would be good).

Re: Scripting - How to identify branch view

Posted: 31 Oct 2015 15:05
by highend
mh, use a listpane(, ,2, "<crlf>");
remove the current path + trailing backslash via a regexreplace (escape the path before)
and then a regexmatch / gettoken(..., "count") to see if there are still backslashes in that result?

Adding branch view to get("view"); would ofc be a whole lot easier...

Re: Scripting - How to identify branch view

Posted: 31 Oct 2015 16:32
by admin
The /:flat switch is present in a branch view.

Highend, congrats for joining the 3000 club! :appl: :tup:

Re: Scripting - How to identify branch view

Posted: 31 Oct 2015 18:52
by nerdweed
Thanks highend and congrats.

Code: Select all

if (!listpane(, , 1, "|"))
		{
			$selitems = listpane(, ,2, "|");
			goto "<curpath>" ;
			delete 1, 1, "$selitems";
		}
Don't know why you asked to remove the current path. This list only the folders that have the branch view enabled (including subfolders). For my needs, I wouldn't be having those sub-folders. Regardless, even if they are and are empty, the delete command would silently ignore it (since they would no longer be present as the parent would have been deleted earlier on).

However; how can I be certain that this is a branch view.

Don,
I thought about reading the /flat from address bar, but didn't a find a way to read what is in the address bar.

Re: Scripting - How to identify branch view

Posted: 31 Oct 2015 19:42
by highend
Highend, congrats for joining the 3000 club!
Damn, I'm deleting my last 1000 posts in a sec!
I thought about reading the /flat from address bar, but didn't a find a way to read what is in the address bar.

Code: Select all

text tab("get", "term");

Re: Scripting - How to identify branch view

Posted: 31 Oct 2015 20:14
by nerdweed
Thanks. I never looked it at that way.