On Sat, Apr 1, 2023 at 10:47 AM Richard Kimberly Heck <rikih...@gmail.com>
wrote:

> On 3/31/23 17:30, Matthew Bandy wrote:
>
> Dear fellow Lyx enthusiasts -
>
> I am developing some scripts that automate table creation in Lyx based on
> database queries. I'm using lyxserver, but I am running into some issues.
> Please help!
>
> The following commands will insert a 1x2 table and populate the first cell
> with some text and the second with a graphics inset.
>
> LYXCMD:copilot:tabular-insert:1 2
> LYXCMD:copilot:repeat:2 char-left
> LYXCMD:copilot:self-insert:Here is some text
> LYXCMD:copilot:char-right:
> LYXCMD:copilot:inset-apply:graphics filename photo.png
>
> I need to modify the properties of the graphics inset, let's say to set
> the width at 3 inches. I can't figure out how to either 1) apply more than
> one property (filename, width, lyxscale, etc) when the inset is created
>
> The way to find this out is the open the Messages pane and activate the
> "action" messages. Then you can see the actual dispatch messages being
> produced on the fly. In this case, you just enter the extra arguments as
> well, e.g.:
>
> graphics filename graphics/HeadShot-200.jpg scale 80 clip
>
> The pane shows these as on new lines, but I don't think that's required.
> (I hope not.)
>
> 2) change the properties after the inset is already in place.
>
> inset-apply will modify an inset. It's just an alias to inset-modify or
> inset-insert, depending. So you could just use inset-modify, too. See Help>
> LyX Functions for the details.
>
> Riki
>

Thanks, Riki -

It turns out that the order of the arguments is important. Specifically,
filename has to come last. So:

 LYXCMD:copilot:inset-apply:graphics width "3in" lyxscale 50 filename
photo.png

.... works, while

LYXCMD:copilot:inset-apply:graphics filename photo.png width "3in" lyxscale
50

... does not. I really wish this stuff were documented somewhere...

Matt
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users

Reply via email to