Topic "Default Editor"

Author Message
duerra
[View user's profile]
Donor
Joined: 2004-10-06
Posts: 45
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.
_________________
duerra wrote:
When you put everything into something, it means everything to you.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
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?.

Quote:
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?
_________________
Martin Prikryl
duerra
[View user's profile]
Donor
Joined: 2004-10-06
Posts: 45
prikryl wrote:
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?.

What do you mean? I'm not following you...

prikryl wrote:
Quote:
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?

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).
_________________
duerra wrote:
When you put everything into something, it means everything to you.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
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...[/quote]
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.

Quote:
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.
_________________
Martin Prikryl
duerra
[View user's profile]
Donor
Joined: 2004-10-06
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.
_________________
duerra wrote:
When you put everything into something, it means everything to you.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
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.
_________________
Martin Prikryl
duerra
[View user's profile]
Donor
Joined: 2004-10-06
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 Wink ).

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.
_________________
duerra wrote:
When you put everything into something, it means everything to you.
duerra
[View user's profile]
Donor
Joined: 2004-10-06
Posts: 45
This might be of use:
http://vbnet.mvps.org/index.html?code/fileapi/createfile_inuse.htm
_________________
duerra wrote:
When you put everything into something, it means everything to you.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
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.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License