Page 1 of 1

feedback required: scripting xplorer2

Posted: 2017 Apr 05, 13:28
by nikos
I started reading about the possibility of making xplorer2 like excel, you know, offer its commands through a VBS/JScript programmable interface for v4. It certainly seems a humongous effort and I don't know if anybody can use it.

from what I see in the "competition", they offer either a full programming language or some mongrel implementation. In any case it looks like the effort to learn the syntax and the options (for the end user) is as big as the development effort to make it. So there's a double possible whammy, spend a year developing something that nobody will ever use!

I can find plenty of reasons not to add scripting, e.g:

* people already achieve xplorer2 hacks using autohotkey and the like
* there is WSH for all the programmers out there (e.g. you can create a text list of whatever files you fancy and import it in a scrap window to bring it inside xplorer2)

so I'm in a pickle here. What do you think, is there any advantage of rewriting xplorer2 with scripting in mind? What would be the benefit?
what do you think?

Re: feedback required: scripting xplorer2

Posted: 2017 Apr 05, 16:44
by pj
Looking ahead to where mainstream computing is heading, I'll offer the following:
  • X2 currently has scripting capabilities of CMD/BAT scripting and, my preference, dumping a list of files with a user-selectable table of properties into an Excel spreadsheet and using VBA to automate the tasks. The incremental benefit of a full OO model scripting API, could assist in automating some of the actions needed to make use of those capabilities, but, again, this is incremental and not evolutionary.
  • The amount of the limited resources (your time) this takes probably further diminishes the benefit since while working on the gargantuan task, other fixes might be back-burnered.
  • Porting x2 to Linux may open up a larger potential market as X2 is a geeky tool for the geeky WINDOWS users. By and large, Linux users are geeky to a much higher percentage than Windows users, and might be interested in the unique features of x2. That said, I have ABSOLUTELY no idea what the effort of this would be, but, from my own point of view, one of the big drawbacks for me to move to Linux is the lack of a familiar file management interface. Excel is the other, but that's out of your control.
Having ridden this horse of yours for many years, I am truly interested in your success and continued support, complaints and temper tantrums notwithstanding. Looking at the other utilities that have Linux ports (Calibre, VLC, ect.), x2 would be one of the biggest programs that I'd miss if I switched today at home. I don't have that option at work unfortunately. I'll add that should there be a Linux port, I'd be sure I also had a lifetime license to that version of x2 as well as the Windows version. I wouldn't expect a lifetime Windows license to come with a Linux rider. Maybe a discount :D

Hope this helps and that others chime in. Always fascinated by the broad scope of users and their perspectives.

PJ in FL

Re: feedback required: scripting xplorer2

Posted: 2017 Apr 05, 18:16
by FrizzleFry
The idea of having some built-in scripting capabilities in x2 is intriguing. What are some features that you are thinking of providing?

It would be nice to have an official/standard way of doing some of the stuff that we use AutoHotkey or resource editing now like MenuHack or several of Kilmatead's confections. I guess built-in scripting would make it easier to automate some x2 processes. It would be nice to have more control of the interface... one thing I have always wanted for x2 is a way to make custom menus.

Re: feedback required: scripting xplorer2

Posted: 2017 Apr 05, 18:45
by Gandolf
I like the approach that some text editors and ZTreeWin (shame on me for using another file manager!) use - remembering keystrokes, and some mouse actions. The important thing is that the keystroke file can then be edited to trim the macro (as it's usually called). That approach means there is less need to learn a complex scripting language to repeat simple keystroke actions, but more complex actions can be performed by editing the macro.
I agree with you that for the user more time has to be spent learning the scripting language than actually on managing files.

Re: feedback required: scripting xplorer2

Posted: 2017 Apr 05, 18:54
by Tuxman
The main benefits of making xplorer2 "scriptable" with something other than keyboard/mouse macros or obscure COM things are obvious: By providing an easy way to just hack around xplorer2's internals you'll lower the bar for extension development which might lead to a more vivid ecosystem surrounding the application. (Also, less Kilmatead software. Yay!)

You might, however, want to go the "embedded programming language" way because it means less effort to you and there is probably already a community for it so porting existing code as an x2 "script" will be quite easy. I'd like to suggest to use ECL but I'm admittedly a weirdo.

Re: feedback required: scripting xplorer2

Posted: 2017 Apr 06, 05:39
by nikos
when we are talking about full scripting, it would be something like excel VBA, where everything you see in xplorer2, including files, folders, commands and all the GUI, would be available as COM object and then available for scripting through visual basic or javascript. The more I think of it, the more it seems infeasible given my resources

but what I get from your feedback is that perhaps something simple like a basic macro language, something like what AHK does (much simpler though just with keyboard commands and clicks) could be feasible. Again this won't be much use, because it would just duplicate AHK, but you could put all that on a button like other custom commands, with less hassle

Re: feedback required: scripting xplorer2

Posted: 2017 Apr 07, 08:11
by snakebyte

I am not in favor of learning a new/custom scripting language for automating Xplorer2.

I would prefer if you go the COM automation way of adding the proper scripting support. Windows standard automation interfaces have been around for quite some time and are well documented. They are supported by wide variety of languages including VBScript/Autohotkey/AutoIt/ C#/powershell/ perl etc. See this for a more comprehensive list. I would also like run the scripts from outside of xplorer2 even if its not active.

Most of the current Autohotkey/AutoIt plugins invoke UX actions to achieve a task. This is very error prone and it is hard to automate certain scenarios. Adding automation support will greatly simplify these scripts and will enable lot of new scenarios

Here are example of some basic APIs that X2 should support
1) Open/close/active a tab
2) Find tab by path name
3) Get list of all open tabs in left/right pane
4) Get history of visited folders
5) Add/remove and list folders in Quick view pane
6) Add / clear a filter
7) Ability to manipulate items in the toolbar etc

Some plugins/scripts such as following could be written based on xplorer2 automation apis
1) Find duplicate open tabs on both the panes and close them.
2) Open a new tab or switch to an existing tab based on a path stored in my clipboard.
3) Create a custom user command, assign it an icon and add it to the toolbar
4) Create a custom search criteria based on selected file

This feature is making me excited again about xplorer2. By adding automation support, you will be promoting a rich ecosystem of user created plugins :bigsmile:

Re: feedback required: scripting xplorer2

Posted: 2017 Apr 07, 09:06
by Kilmatead
Dipping my toe into the same universe simulator as snakebyte's (welcome back, lurker! :wink:), exposing more of x2's entrails was always a wish for me - as far as I know, your single concession to the outside world [UWM_GETDIRECTORY (WM_APP + 31)] is horribly unreliable considering the permissions necessary to read x2's memory space from a foreign process.

Heck, it isn't even that simple from within an attached DLL as is; if you were to, say, expose more custom info (as snakebyte's list) plus the usual necessities such as active panes, current selections within those panes, directories of panes/tabs, etc, from within a few custom API's (as part of the existing plugin mechanism, perhaps?) then you might have a ballgame. (Especially, I might add, the ability to add custom items to menus, which is a mainstay of extensibility if ever there t'was.)

Granted, that sort of thing (COM exposure) is not as scripting-friendly as some might imagine, at least its availability would be a boon, and a much more practical alternative to the inherent unreliability of recorded macros (completely useless where unexpected errors occur, as is almost guaranteed given the context of file-management).

* * *

As an aside (and foregoing the risk of being my usual tautologous self), I'm a bit mixed on the subject at large, considering that if it weren't for x2's current intransigence and my decade's worth of silliness battling against it, I wouldn't know 1/100'th of what I do now about how Windows/Shell/API's work overall. With no windmills to tilt at, Don Quixote is just another tosser with a sink full of dirty dishes; necessity really is the mother of invention. That being said, the careful rendering of one's own obsolescence is what maturity within the terrifying human condition is all about, isn't it? :D Memento mori.
Tuxman wrote:(Also, less Kilmatead software. Yay!)
Indeed! The sweet release! "Once more unto the breach, lads... close up the wall with our dead!"

Re: feedback required: scripting xplorer2

Posted: 2017 Apr 07, 20:41
by pschroeter
This sounds like a lot of work. I would rather you did a bunch of simpler improvements to x2.

Right now I would have to say number one on my wish list is having an option for Dual bookmarks open up the two pane view side by side if duel pane view isn't already on. Right now I get two tabs.

For years I've wanted File > Browse flat, to flatten the current folder if none is selected.

If you want a bigger project File > Mass rename… , could do a lot more, like change capitalization ect.

I've got a long list of suggestions I can resend to you if your bored.

Re: feedback required: scripting xplorer2

Posted: 2017 Apr 08, 08:11
by nikos
I think that many of the items in snakebyte's list can already be done though menu commands. So if you want to set a visual filter, a macro that calls the filter menu then allows you to set a string there and click enter, that's covered. All simple stuff like FindWindow, Click, Settext. Nothing massive to learn about. If there's a need to close duplicate tabs, surely a new command can be added for that purpose, instead of relying on scripting support. To browse a folder, you activate the addressbar and paste a text. Other stuff like find/activate tab could be added as script commands. All these macros would be in a list like bookmarks etc, and thus could be added on a toolbar

theoretically adding full scripting support isn't that hard, the plumbing is known. But the amount of objects and commands are stupendous. And as you guys say, you mostly need to automate the xplorer2 user interface. Scripting for file operations is already covered by WSH

Re: feedback required: scripting xplorer2

Posted: 2017 Apr 08, 13:07
by longfellow
For years now I've been using AHK for my x2 scripting needs; I don't think I'd bother to learn a custom scripting language just to redo what's already working for me.
pschroeter wrote:If you want a bigger project File > Mass rename… , could do a lot more, like change capitalization ect.
+1! I think the Mass renamer is one of the best additions to x2 you've made; I am 100% behind improvements like this!

Re: feedback required: scripting xplorer2

Posted: 2017 Apr 09, 07:01
by nikos
Longfellow let me put it another way, is there anything AHK cannot do for you or you envisage having it simplified?

Re: feedback required: scripting xplorer2

Posted: 2017 Apr 10, 11:39
by longfellow
nikos wrote:
2017 Apr 09, 07:01
Longfellow let me put it another way, is there anything AHK cannot do for you or you envisage having it simplified?
A good question! I have to say my needs are simple, maybe I am not the best one to ask. Being able to address specific panes and tabs more easily would be nice. But you raise a good point: perhaps there would be features in the new scripting language that I did not know I wanted until I was exposed to them.

Re: feedback required: scripting xplorer2

Posted: 2017 May 24, 06:05
by nikos
snakebyte wrote:
2017 Apr 07, 08:11
1) Open/close/active a tab
I think your problems will be solved if I make all the custom controls in xplorer2 Active Accessibility friendly (?)
So you would know how many tabs are there, their names etc