File Associations not pertinent

Started by JJK, February 26, 2009, 11:14:37 AM

Previous topic - Next topic

JJK

Hi Alex,
It is not exactly a bug, but rather a not pertinent behaviour : I have used Tools/File associations to set file associations. It works as expected. But I have set file association to *.bat files. In the Command column of the window, in front of *.bat we have "%1" %* as command (by default, I didn't modified it ; anyway we cannot modify it).
But, now, when a bat file is run, HippoEdit opens it, and .bat file is not executed. Anyway, .bat files have the HE icon in Windows explorer
I didn't try for *.cmd which has the same string in Command column and which is also an executable file type.

Other issue : I have checked the the checkbox for the *.txt extension with Command by default "C:\Prog...\HippoEdit\HippoEdit.exe" --workspace=viewer "%1"
Yet, when I doubleclick on a .txt file within Windows explorer, EditPlus opens it, but not HippoEdit. Icon is not HE's but remains the Editplus one.
What is the scope of file associations set within HippoEdit ? I don't understand.
Last question : what does the command "%1" %* mean ?
Thanks for your explanation.


Stefan

Quote from: JJK on February 26, 2009, 11:14:37 AM
Hi Alex,
I am not Alex, but if i may i try to help you.

Quote
I have used Tools/File associations to set file associations.
But I have set file association to *.bat files.

But, now, when a bat file is run, HippoEdit opens it, and .bat file is not executed.
That is correct, because you have modified the "default action" for this file type.
Before it was "batfile", now it's "HE.batch.1"
@Alex
That is because in the Registry the .bat -key entry itself was modified.
Better would be to lockup the following key which is 'batfile' as default.... and modify there the 'edit\command' -key

HKEY_CLASSES_ROOT\.bat ==> batfile
HKEY_CLASSES_ROOT\batfile\shell\edit\command >> %SystemRoot%\System32\NOTEPAD.EXE %1


It depends what should be archived?
This current setting could also be called an feature, because it's an secure setting.
(companies has disabled the execution of *.vbs files that way. So the VBS are opened instead executed)


Quote
Other issue :
I have checked the the checkbox for the *.txt extension with Command by default "C:\Prog...\HippoEdit\HippoEdit.exe" --workspace=viewer "%1"
Yet, when I doubleclick on a .txt file within Windows explorer, EditPlus opens it, but not HippoEdit.
Icon is not HE's but remains the Editplus one.
There are several ways to associate an file type with an application.
Maybe EditPlus use an 'harder' way to set this modification?
Try to disable this association in EditPlus first.


Quote
Last question : what does the command "%1" %* mean ?
Those signs allow to delivery parameters to the called app.

F.ex. try this batch file:

test.bat
@ECHO OFF
notepad "%1"


Save this as *.bat on your desktop.
Than drop an text file *.txt on it.
Notepad should start and open the dropped file for you. That's the secret behind it :D

But i have forgotten the exact issue of '%*' parameter, anyone can help me out?

Quote
In the Command column of the window, in front of *.bat we have "%1" %* as command
(by default, I didn't modified it ; anyway we cannot modify it).
Sure you can.
- select extension
- click on the command
- edit it in the command box below


HTH?
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

JJK

Thanks Stefan
1) Yes I could modify .bat action as you explain. I had unchecked the checkbox, so I could not change the command string, which is the normal behaviour. My mistake.

2) I resetted the .txt association from Windows explorer. Before .txt were opened by EditPlus. After reset of the .txt association, if I associate .txt to HE, HE opens them. It is OK as expected.
Yet, here, in HE associations window, when .txt box is unchecked, the command is "%1" %*. Thus, if I uncheck this box; .txt files are considered as DOS command files.
It seems to me that by default, .txt files should be Notepad files instead of DOS command files. Perhaps it is only here that .txt files default are DOS command files, but I don't see what I did to have that behaviour...

Extract of my registry :
[HKEY_CLASSES_ROOT\.txt]
@="batfile"
"Content Type"="text/plain"

and below :

[HKEY_CLASSES_ROOT\batfile\shell\open\command]
@="\"%1\" %*"

I wonder  which one among HE or Windows either any other app made such register key.

3) "%1" %* : I knew also "%1" signification. What I don't know, like you Stefan, is %* meaning.

4) I agree that open and edit behaviours have to be distinguished, both for .bat and .txt.
For example .txt must not be executed but only edited, and contrariwise .bat must be opened (executed) but not edited by associations in HE.
Perhaps it is only here that those behaviors seem to me not very pertinent.

5)
Quotecompanies has disabled the execution of *.vbs files that way. So the VBS are opened instead executed
Good point.



Stefan

@2)
i don't know what happens with your box but you can fix this:
modify [HKEY_CLASSES_ROOT\.txt]  and write instead of (Standard) 'batfile' , 'txtfile' there  (you should have HKEY_CLASSES_ROOT\txtfile too?)
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

Hello,

Thanks Stefan.

I would check the points...

But what I can answer now:
1) The HE stores previous association of the extension, and try to restore it when unchecked and you would see it, but could not change.
2) I have done association to EditPlus, then to HE and in my case all works... Maybe sequence is wrong or file was associated with older version of HE ...
3) Dont know what is %* mean and from where it comes... HE nether sets something like this...
4) What I can do, I can really distinguish between executable files (as .bat, .com and .vbs) and the rest. And for executable add not open command but edit. Would this be better?

Best regards,
Alex
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

JJK

Thanks to you both.
1) Well, thus here "%1" %* was wroten in my registry by some app, nor Windows, neither HE.
2) Now I understand the HE's behaviour in associations process. Storing previous assoc is a good point.
3) I agree with your idea about executable files.

All is OK now.

alex

#6
3) Would be changed with new beta. Sorry, would not

I have checked, the situation is not clear. The association is done by specific document class, but not by overwriting of one of the command (edit, open, print etc). The icon is also defined by document class.

Because I do not want to change standard document class (for example batfile, associated with .bat files), the only one possibility would be completely copy batfile to HE.batch. And replace only edit command. But what this give? Nothing. The icon would be same (because it should correspond default action on double click), the open action is same, only additional bold Edit in menu. Which you can have any way, because of the HippoEDIT Shell Extension.

So, I have decided to live logic like it is now...
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]