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

New Feature: User Defined Menu (Windows Only) #1020

Closed
antekgla opened this issue Oct 20, 2017 · 5 comments
Closed

New Feature: User Defined Menu (Windows Only) #1020

antekgla opened this issue Oct 20, 2017 · 5 comments

Comments

@antekgla
Copy link
Contributor

antekgla commented Oct 20, 2017

Hi!
I want to present a new feature I have added to transgui.
Is a User Defined Menu

This menu is added to the Torrent Context Menu:

user menu torrents

...and is added to File Context Menu:

user menu files

The way to configure this new User Menu is with a new section in transgui.ini
This new section is named [UserMenu] and there you have to define 3 parameters for each menu entry (caption, exename and parameters).
You have to number that entries starting at 1, this way

[UserMenu]
caption1=
exename1=
params1=
caption2=
exename2=
params2=
caption3=
exename3=
params3=

The caption would be the caption display in the menu, the exename is the full path to the program you want to execute and the params would be anything parameter you program need ("%s" is the name of the torrent or file you right clicked and would be the most common param)
If you want to add a divider in the menu add a item with the caption equal to a hyphen
Here a example of the [UserMenu] in my ini what create the menu of the screenshots:

[Usermenu]
Caption1=&Dualcopy
ExeName1=C:\Users\Pablo\Lazarus\DualCopy\1.0.0\Dualcopy.exe
Params1="%s"
Caption2=7zip
ExeName2=C:\Program Files\7-Zip\7zFM.exe
Params2="%s"
Caption3=-
Caption4=&PotPlayer
ExeName4=C:\Program Files\DAUM\PotPlayer\PotPlayerMini64.exe
Params4="%s"
Caption5=&VLC 1
ExeName5=C:\Program Files (x86)\VideoLAN\VLC\vlc.exe
Params5="%s"
Caption6=&VLC 2
ExeName6=C:\Users\Pablo\Portable.Programs\vlc-2.2.0_x64\vlc.exe
Params6="%s"
Caption7=&MPC-HC
ExeName7=C:\Users\Pablo\Portable.Programs\MPC-HC.1.7.10.x64\mpc-hc64.exe
Params7="%s"
Caption8=&SMPlayer
ExeName8=C:\Users\Pablo\Portable.Programs\Smplayer-portable-17.5.0.0\smplayer.exe
Params8="%s"

Notes: I made this feature Windows Only (sorry mac & linux users) because is the OS I know and I have no idea how to execute a process with parameters in linux or mac, but if anyone with the knowledge want to adapt, please do it.
I think what the most hard part to port would be the extract of the icon of exename (I use a ShellApi function, ExtractIconEx), but that can be easy eliminated {$ifdef windows} and the menu would be equally functional (although not so pretty) 😄

@Mattoje
Copy link

Mattoje commented Oct 20, 2017

It breaks compilation on Mac:
main.pas(1993,10) Error: Identifier not found "FUserDefinedMenuEx"
main.pas(1994,10) Error: Identifier not found "FUserDefinedMenuParam"

@antekgla
Copy link
Contributor Author

I think I fix it now.
@sardanap Can you confirm, please?

@Mattoje
Copy link

Mattoje commented Oct 20, 2017

yep it works now. Thanks

@antekgla
Copy link
Contributor Author

Thanks!
@sardanap are you a developer?
...can you try to port this feature to mac?
I think what is not that hard, besides the ExtractIcon part only the ExecRemoteFile is different in linux/mac

@Mattoje
Copy link

Mattoje commented Oct 20, 2017

sorry i'm not. I'm just a sysadmin

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

No branches or pull requests

3 participants