Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easily override/toggle portable file associations. #475

Closed
duarteframos opened this issue Sep 29, 2021 · 2 comments
Closed

Easily override/toggle portable file associations. #475

duarteframos opened this issue Sep 29, 2021 · 2 comments

Comments

@duarteframos
Copy link

I use TE portably both at home and work. I have all my file associations set up trough Tools > Options > Menus > Default, and it works quite well, no issues there. Some times when I move computers, I prefer to momentarily use an installed app rather than the portable one.

Currently I just go to the menu and replace whatever file extension filter with something like -----, but this is cumbersome and destructive, and one has to manually revert it later.

Is there an easy way to disable, toggle off or override a file association set up through the method above without totally removing it?
Maybe through javascript set up a file association with some if clause? Maybe make it machine name dependent, or perhaps check the existence of an exe file. Say something along the lines of pseudocode:

if computer.name='WORK_COMPUTER' c:/program Files/Company/Application.exe else ..\Portable\App.exe

or

if file.exists'C:/program Files/Company/Application.exe' else ..\Portable\App.exe

@tablacus
Copy link
Owner

Using VBScript, it looks like the following.

Type

VBScript

Options

pg = "C:\Program Files\paint.net\PaintDotNet.exe"
if fso.FileExists(pg) then
  wsh.Run PathQuoteSpaces(pg) + ExtractMacro(te, " %Selected%")
else
  wsh.Run PathQuoteSpaces(BuildPath(GetParentFolderName(te.Data.Installed), "Portable\PaintDotNet.exe")) + ExtractMacro(te, " %Selected%")
end if

image

Regards,

@duarteframos
Copy link
Author

duarteframos commented Sep 30, 2021

Works like a charm! Excellent, this will save me some daily maintenance work.

Added to documentation about default menus, also took the opportunity to add some base explanation about the usage since it was empty.

Feel free to point any mistakes or improvements I can make

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants