Default Editor

Advertisement

duerra
Donor
Joined:
Posts:
45

Default Editor

Martin,
It would be nice if WinSCP could, by default, use the default Editor for a particular file type without further configuration.

To determine the default editor for a file type, look in HKEY_CLASSES_ROOT/.<extension>

That value (default) will tell you what file <type> it is.

Then look in HKEY_CLASSES_ROOT/<type>/shell/Edit/command

The value of that key will tell you the value of the "Edit" command from Windows explorer's perspective.

A default can be set for all file types, too, so if the file type searched for was non-existent, use the value of HKEY_CLASSES_ROOT/*/shell/Edit/command

From here there shouldn't really be any need to know if an editor is MDI/tabbed, and it should allow WinSCP to work well without separate configuration (and allow it to dynamically update with Windows as necessary).

I hope this helps. As always, WinSCP is an unbelievably fantastic app. Your efforts are highly appreciated by a very large number of people.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Default Editor

duerra wrote:

That value (default) will tell you what file <type> it is.

Then look in HKEY_CLASSES_ROOT/<type>/shell/Edit/command

The value of that key will tell you the value of the "Edit" command from Windows explorer's perspective.
I have thought about it already. However I do not think that the "edit" value use to be filled, does it?.

From here there shouldn't really be any need to know if an editor is MDI/tabbed, and it should allow WinSCP to work well without separate configuration (and allow it to dynamically update with Windows as necessary).
Why do you think so?

Reply with quote

duerra
Donor
Joined:
Posts:
45

Re: Default Editor

martin wrote:

I have thought about it already. However I do not think that the "edit" value use to be filled, does it?.
What do you mean? I'm not following you...

martin wrote:

Why do you think so?
Correct me if I am wrong, but WinSCP only uses the MDI/tabbed checkbox to determine if the process has actually started/exited, correct? If you are using the same keys that Explorer uses, you are no longer requiring the user to make this edit in WinSCP, and it can be fairly reliably assumed that the entry is correct and that the process will reliably start, making the check less necessary (any problems with that entry are a larger problem in the OS and should be something that you really need not be too concerned about).

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Default Editor

duerra wrote:

I have thought about it already. However I do not think that the "edit" value use to be filled, does it?.
What do you mean? I'm not following you...
I've meant that in most cases the "edit" field in the registry is empty (or not present). Only the "open" field is usually filled in.

Correct me if I am wrong, but WinSCP only uses the MDI/tabbed checkbox to determine if the process has actually started/exited, correct? If you are using the same keys that Explorer uses, you are no longer requiring the user to make this edit in WinSCP, and it can be fairly reliably assumed that the entry is correct and that the process will reliably start, making the check less necessary (any problems with that entry are a larger problem in the OS and should be something that you really need not be too concerned about).
It is more complicated. Please refer to the documentation.

Reply with quote

duerra
Donor
Joined:
Posts:
45

Ok, so the problem is in determining when to delete the temporary file? It seems to me that this could be done upon close of WinSCP all the time, the same as you do for MDI/tabbed editors. It doesn't seem that there is any particular harm in that, but I can't say that for certain.

And often the "Edit" value is empty, yes. If it is empty, that's when the default would be used (described in my first post). If the default doesn't exist, then use the built-in by default, perhaps? Or a default specified by the user in WinSCP?

It just seems like a bit much on the maintenance to have to set up WinSCP for all these editors when system configurations may change, or when showing co-workers how to use WinSCP, etc. It's just one less thing for new adopters to have to worry about/figure out.
_________________
When you put everything into something, it means everything to you.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

duerra wrote:

Ok, so the problem is in determining when to delete the temporary file? It seems to me that this could be done upon close of WinSCP all the time, the same as you do for MDI/tabbed editors. It doesn't seem that there is any particular harm in that, but I can't say that for certain.
Not when only to delete the file. That also means the WinSCP would have to watch for changes for every single file you have ever edited in current session. To me that means unacceptable wasting of system resources.

Reply with quote

duerra
Donor
Joined:
Posts:
45

Fair enough. If you are against it, I respect your cause at any rate.

I would like to propose a question, though, that should be taken into consideration... how many editors out there today don't support some sort of MDI/tabbed interface for editing documents? It would seem that assuming that an app does would be correct in most instances. Maybe defaulting WinSCP to the non-MDI-style could be done only when it's determined that the editor is Notepad (I know, a hack, and I'm kidding ;) ).

My personal view is that the benefits of not having to configure every extension far outweighs the minor resource implications, but I'm not the one who has to make that decision. I wonder if it's easily possible to determine if some other app has a file open via the Windows API? Filemon seems to do it well enough, but I haven't checked into the complexity of such functionality.
_________________
When you put everything into something, it means everything to you.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

duerra wrote:

My personal view is that the benefits of not having to configure every extension far outweighs the minor resource implications, but I'm not the one who has to make that decision. I wonder if it's easily possible to determine if some other app has a file open via the Windows API? Filemon seems to do it well enough, but I haven't checked into the complexity of such functionality.
File are locked mostly by Microsoft applications only. That's my experience.

Reply with quote

Advertisement

You can post new topics in this forum