Page 1 of 1
Can anyone help with CFA
Posted: 06 May 2021 22:46
by Daniel0312
Hello !
Using the custom file associations feature, I'd like to open by default every text file with notepad3 except XYS files with notepad++.
I added the following 2 lines in the Custom File Associations dialog:
"Notepad3" {:Text}>..\..\Notepad3\Notepad3.exe
"Notepad ++" xys>..\..\Notepad++\notepad++.exe
The XYS file is always opened in Notepad3
If I understand correctly the help file, it doesn't work since xys is considered a text file in... Preview | Previewed formats and the first matching pattern is used.
So I unchecked XYS in Preview | Previewed formats | Text files, and indeed it does the job when I apply a visual filter : no more XYS file in the list.
Problem is : even when unchecked, XYS is still considered a {:Text} file in CFA.
Can anyone explain to me what I'm missing ?
Re: Can anyone help with CFA
Posted: 06 May 2021 22:49
by highend
Just move your "Notepad ++" xys>..\..\Notepad++\notepad++.exe entry above the "Notepad3" one?
Re: Can anyone help with CFA
Posted: 06 May 2021 23:05
by Daniel0312
Well thank you... that was very fast and makes me feel a little stupid...
I guess that with all I've tried I missed something and my question wasn't good enough !
I did what you suggested and indeed it works much better than before but...
In my list I have an INI file that will open with notepad3 : is it possible to add notepadd++ as "second choice"?
Re: Can anyone help with CFA
Posted: 06 May 2021 23:41
by highend
Second choice = Display a menu where you can select one of the two when an .ini file is double clicked?
Adapt the paths in the script!
Code: Select all
$options = <<<>>>
Notepad3|D:\Tools\Notepad3\Notepad3.exe|D:\Tools\Notepad3\Notepad3.exe
Notepad++|D:\Tools\Notepad++\notepad++.exe|D:\Tools\Notepad++\notepad++.exe
>>>;
$sel = popupmenu($options, 6:=<crlf>, 7:="|");
if ($sel) {run """$sel"" ""<curitem>"""; }
Save it in your XY scripts folder. E.g. "Open with editor.xys"
And then use such an CEA entry:
"Any editor" ini>::load "<xyscripts>\Open with editor.xys";
Re: Can anyone help with CFA
Posted: 07 May 2021 09:19
by Daniel0312
It doesn't work the way I wanted but... it does the job : I'll just have to get used to it.
Thank you.
I adapted the paths in the script but it brings another question :
is there a way to keep relative paths in the run command ? for both the executable part and the icon part ?
Re: Can anyone help with CFA
Posted: 07 May 2021 09:33
by highend
It doesn't work the way I wanted
Because you didn't describe how it should work exactly and you didn't answer my question regarding it.
is there a way to keep relative paths in the run command ?
Sure, but with that solution your XY script folder is the current root and you have make your way up from there or...
alternatively use <xypath> as your root and do it from there
E.g.: Let's say XYplorer is in D:\Tools\XYplorer and Notepad3 in D:\Tools\Notepad3
Notepad3|<xypath>\..\Notepad3\Notepad3.exe|<xypath>\..\Notepad3\Notepad3.exe
Re: Can anyone help with CFA
Posted: 07 May 2021 10:06
by Daniel0312
My comment wasn't meant as a criticism : your solution is great and working, taught me a few things and made me want to learn more...
I was slowly getting to the <xypath> variable, you saved me some research through the help file !
Thank you !