Add custom commands to context menu ?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
CookieMonster

Re: Add custom commands to context menu ?

Post by CookieMonster »

Can someone point me to how I can test Sammay script, the setup procedure, or what it's called in the documentation ?

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Add custom commands to context menu ?

Post by bdeshi »

That was a multiscript. It shows a menu. Each quoted line is a caption for a menu item. and clicking one item then executes the script that's written after it (till the next caption).

You still haven't said what commandline program you wanted to run.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

klownboy
Posts: 4459
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8037 at 100% 2560x1440

Re: Add custom commands to context menu ?

Post by klownboy »

Stef123 wrote:Yes, please do this, Ken. I must try to see how I get along,
Hi Stef123, I decided to post an example script in the Script Exchange section. Of course you need to spend a few minutes setting up the script to use your own file types and associated programs. After just a little use, I'm finding it easier and quicker to use than going through the normal context menus or PFAs.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Add custom commands to context menu ?

Post by bdeshi »

btw, this is also possible in the tree.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

klownboy
Posts: 4459
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8037 at 100% 2560x1440

Re: Add custom commands to context menu ?

Post by klownboy »

Hey Sammay, I'm not sure if you referring to my example script posted in the scripting section mentioned above or previous entries, but yes, I know about CEA_TreeRightClickOnWhite. I didn't want to complicate the explanations or the script, but someone could do the same for the tree as well. At some point I'm going to ask Don to revisit this CEA white space business and get allowance to use middle click on tree and list white space and more flexibility on double click (ie., split up CEA_TreeListDoubleClickOnWhite and allow separate definitions for double click in tree and list. Heck at that point, we could do almost anything we wanted script-wise via right, middle, and double clicking on list and tree white space without having to visit the Toolbar with the mouse. :whistle:

Stef123

Re: Add custom commands to context menu ?

Post by Stef123 »

klownboy wrote:I decided to post an example script in the Script Exchange section. .... After just a little use, I'm finding it easier and quicker to use than going through the normal context menus or PFAs.
Thank you Ken. Been playing with it. It's great. Still busy furnishing it with my own stuff. :beer:

CookieMonster

Re: Add custom commands to context menu ?

Post by CookieMonster »

How do I setup your script, is what I want to know to try it out ? I haven't spend much time in this area so I don't know :)

Stef123 script at present has overrode, if I want to double click to open a notepad file I get the XYplorer script pane with an error; Script file 'MyContextMenu.xys" not found. I assume I have to remove this, first, then run your script ?
SammaySarkar wrote:That was a multiscript. It shows a menu. Each quoted line is a caption for a menu item. and clicking one item then executes the script that's written after it (till the next caption).

You still haven't said what commandline program you wanted to run.

Stef123

Re: Add custom commands to context menu ?

Post by Stef123 »

The misunderstandings don't stop. If you get the error you reported, you have not yet set up your script file "MyContextMenu.xys"
Stef123 wrote: Example entry for your PFA:

Code: Select all

|"My &Context Menu" \;*>::load "MyContextMenu.xys"
So after right-clicking a file, first you click on "Open with...", then you click on My Context Menu (or press C) - et voila - your list of commands, either by adding them as UDC or by writing them directly into MyContextMenu.xys
Heed the last sentence - you need to add your code into a plain text file "MyContextMenu.xys" that you save into \Data\Scripts\MyContextMenu.xys. What code you have to add, the specifics of your command line stuff - that was Sammay's question to be able to help you out. And he's still awaiting your answer.
SammaySarkar wrote: this would be the skeleton of the script you'll need:

Code: Select all

"Option 1"
  run quote("program.exe") . " /commands" . " -commands". quote(<file>) . " - more commands"
"Option 2"
  run quote("program.exe") . " -c -o -m -m -a -n -d -s" . " -other -cmd". quote(<files>) . "no " . "more commands" . " please";
!!THIS SCRIPT WONT DO ANYTHING (MEANINGFUL) YET!!
Again, heed the last sentence, the example is just a skeleton, a template pattern, meant to be filled by you.

CookieMonster

Re: Add custom commands to context menu ?

Post by CookieMonster »

What do you mean by UDC ?

Stef123

Re: Add custom commands to context menu ?

Post by Stef123 »

User Defined Command. Here the lo-down:
You either enter your custom command line call directly into the .xys script file - or
you enter it into a UDC - category "run script" - the dialog will then show you the assigned command ID in the lower right corner. Consult the help file about it.

CookieMonster

Re: Add custom commands to context menu ?

Post by CookieMonster »

I read though the entire thread again, to get a understanding of the direction everyone in this thread is coming from :)

First question, I place all the commands from the command line program into a file called "MyContextMenu.xys" place this into \Data\Scripts, is there a format to which an XYS file must be written ?

Klownboy has the right idea for the script :)

Sammay - The command line program is called openEXRmaketiled, I want all the options within this program available in the context menu, only when EXR files are selected, I acctually have another program for non EXR files, first focus on this one.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Add custom commands to context menu ?

Post by bdeshi »

CookieMonster wrote:Sammay - The command line program is called openEXRmaketiled, I want all the options within this program available in the context menu, only when EXR files are selected
part of this package: http://www.openexr.com/downloads.html ?
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

CookieMonster

Re: Add custom commands to context menu ?

Post by CookieMonster »

Yes. :)
SammaySarkar wrote:
CookieMonster wrote:Sammay - The command line program is called openEXRmaketiled, I want all the options within this program available in the context menu, only when EXR files are selected
part of this package: http://www.openexr.com/downloads.html ?

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Add custom commands to context menu ?

Post by bdeshi »

You need at least XYplorer version v15.00.0311 or better to run the script.
exrmaketiled.zip
[/size]Select one or more exr files and run the script. You can now set up the programs options, including output file. All controls have tooltips. Read them. Particularly the tooltip of "Outfile pattern".
(btw, I don't know how the -f switch works, so its tooltip example might be wrong.)
Try it out on a set of test files first.

SETUP:
  • First, download and extract the script and open it in a text editor. At the very top, you should see this:

    Code: Select all

    $exrmaketiledexe = "C:\openexr\bin\exrmaketiled.exe";
    Put in the correct path to exrmaketiled.exe in your system then save the script.
  • How to quickly run the script: without going into all that one-click ctx menu idea and the ensuing confusion, I suggest you associate this script to a custom toolbar button. Here are the directions: http://www.xyplorer.com/xyfc/viewtopic.php?f=10&t=13364
EXECUTION:
Options have descriptive tooltips. Changing them shouldn't be a problem. Only two controls can need any explanation.
  • The -f switch turns off low-pass filtering for a channel, It can be specified more than once or multiple channels.
    To keep the script simple, I've used a textbox: "Lowpass filter command". Enter -f switches there.
  • The Outfile pattern box requires attention.
    The script can operate on selected EXR files, whether only one is selected or a hundred.
    "Outfile pattern" defines how the output file will be saved. You can use these in the pattern:
    * = inputfile base name, ? = inputfile extension. Full or relative paths can be used. Relative paths are parsed relative to current input file. If no path is given in pattern, then output is saved to the same folder as input file.

    For example, suppose you run the script after selecting a file called "image.exr". If Outfile pattern is "*_tile.?", then the output will be saved as "Image_tile.exr".
    Now suppose you've selected three files: C:\work\image_1.exr, C:\work\graphic.exr, C:\tmp\Demo.img
    • if the Outfile pattern is "C:\tiled\*.?",
      then output will be resp. C:\tiled\image_1.exr, C:\tiled\graphic.exr, C:\tiled\Demo.img
    • if the Outfile pattern is ".\tile\*.?",
      then output will be resp. C:\work\tile\image_1_tiled.exr, C:\work\tile\graphic.exr, C:\tmp\tile\Demo.img
Let me know if there are problems.
To see the attached files, you need to log into the forum.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

CookieMonster

Re: Add custom commands to context menu ?

Post by CookieMonster »

Can the script be executed, if and only if I have an EXR file selected and only by right clicking on an empty part of the selected window pane in XY, instead of selecting the EXR file and going to the script in the Custom Toolbar menu ?

Can the -o option be renamed to One_Level
-m option be renamed to MIP_MAP_Levels
-r option be renamed to RIP_MAP_Levels ?

The tooltip popup for out file pattern, disappears too quickly, can that stay up for a longer duration ?

A output file pattern is helpful, except if I enter in a relative path, and that path doesn't exist can it prompt to make that folder ?

You can also move the OK button to the opposite side of where the close button is ;-) All that exists there is "done" text that flickers then disappears. The script works well, makes it more efficient then loading the command prompt, moving the file to the location where the EXR tools exist, entering the command .... etc etc etc.

Post Reply