Macros and XBS files

Ask for help and post your question on how to use XnView Classic.

Moderators: XnTriq, xnview

Post Reply
ericonhisway
Posts: 3
Joined: Mon Feb 18, 2013 3:40 pm

Macros and XBS files

Post by ericonhisway »

Hello,

I am trying to do something simple, but I can't make it work.
I did search a lot on the net, but did not find an adequate answer.

In View mode, I would like to click a button that would resize the displayed image to a specific height (960 pixels for example).

I want to add the command to : Options, Interface, Toolbars, Buttons, View, "Command:"

I was thinking that something like "cmd_Resize [Height=960]", or something close would work,
but it doesn't. I tried the following at the command prompt:

1 - cmd_Resize -> shows me the resize dialog box (I don't need a new button for that)

2 - resize( 1 lanczos 0 960 0 1 0 ) : does not work this way (syntax of an XBS file)

3 - cmd_Resize [ 1 lanczos 0 960 0 1 0 ] : does not care about the arguments, shows me the resize dialog box

Another option would be to write an XBS file, which I can do, and have it run by simply
clicking on my new button. However, if I add my file.XBS to the command prompt, the
XBS file is opened in a text editor, but not executed.
Having a button that would load the XBS file, then execute it would work for me.
I know that an XBS file can be loaded manually, but it takes more clicks than using the
existing resize dialog box.

Basically, I just want to resize the height to 960 (keep ratio) with one click of a button.

Thanks
User avatar
helmut
Posts: 8219
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: Macros and XBS files

Post by helmut »

Hmm, a good question. At the moment I know of a three click solution, only:

Preparation: Create an .XBS Script
This preparation is done once, only:
1.) In XnView browser, open batch processing using "Tools > Batch processing..."
2.) Switch to "Transformations" tab.
3.) In tree list of transformations select Image > Resize and press "Add" button to add this transformation.
4.) In the "Parameters" panel, specify 960 for width and height.
5.) Save the script by pressing "Save..." in the Script panel. Save the script in suggested folder or any other folder. Name your script "Resize 960px.xbs" for example.

Execution: Start and Execute batch processing using the .xbs script
This execution is done for resizing one or multiple images. It requires three clicks (not just one):
1.) In XnView browser, select the images that you want to resize / batch process.
2.) Select "Tools > Batch processing..." menu.
3.) In Script panel, select your script "Resize 960px.xbs" in the drop down list.
4.) Start the batch processing by clicking on "OK" button.

But I guess you are familiar with this way of batch processing, already, so the above might not help. In combination with an automation tool like the freeware AutoIt you might get even closer to what you want to achieve.
Post Reply