saleguas/context_menu

Can't pass function arguments

GanerCodes opened this issue · 8 comments

For lists of things ideally you want to be able to pass parameters into python functions

Unfortunately, this is quite difficult to implement with the current state of code, as the functions are ran through the command line. I was thinking of doing something with pickled objects or the sorts, but I need to give it more thought. I'm currently aiming to add MacOS functionality next, but this is definitely on my list. I'll update this issue when I start working on it. Thanks for the feedback!

Hey man, firstly awesome project, I've been enjoying playing about with this. I'm fairly new to python and just learning. Is it possible to pass variables via the command line then input as argv[] to a function. I've been having trouble trying to get the command line to run another python script. On click I want to pass a flag that says "option selected" and then run a function, currently trying to implement a function so I can right click then copy the path of a file

Hello! I could contribute with passing arguments. It seems to be very interesting issue 😃

Had another go tonight, it seems I can pass arguements in this way and using command to run another python script. My issue now is taking an input variable (the file path) from a file you have right clicked on, is there a way to input this?

@mateuszz0000 I would love any pull requests or any help with this project! I should warn you, I'm not sure how friendly the code is right now. The windows portion should be navigable but the linux portion is extremely hard to work with. There is also an issue with the code not updating locally because of the imports, (change from context_menu import menus to instead appending the sys.path and import from there). Regardless, I should be adding changes soon to fix some of these problems.

@malky25 Thanks for playing around with it; I understand your problem as I had the same exact issue in my file sorter implementation of this library. I think I've scrapped the idea for MacOS support right now and will actually start working on this solution now. If it helps, this resource helped me with the windows implementation (especially the %1 part).

If it's of any help, I was able to implement a really janky solution to having one extra argument by adding an "extra value" parameter to like every class I came across, and changing the create_file_select_command to look like https://i.imgur.com/dT7SJyh.png which worked for me

Thanks for the help! I took inspiration from your idea implementing this. Added c2c4b02