-1

RUN_INTERACTIVE gives a dialog with width, height, etc... How do you automate GIMP to pass these parameters?

#!/usr/bin/python
from gimpfu import *
def dialog( pages ):
  try:
    img  = pdb.file_pdf_load(pages, pages, run_mode = RUN_INTERACTIVE )
  except CancelError:
    return
register( "pdf",  "Import PDF",  "Import PDF",
          "Sketch",  "Sketch",  "2018",
          "<Toolbox>/Import/Import PDF...",  "",
          [  (PF_FILE, "pages", "PDF", "")],
          [],  dialog )
main()

Which gives you an interactive dialog.
But I'd like to automate this.
Once I change it to RUN_NONINTERACTIVE

line 6, in dialog
    run_mode = RUN_NONINTERACTIVE )
RuntimeError: calling error

I'd even be fine with an open dialog box,
so long as I could use the script to populate parameters,
but I don't know where you pass those along.

Doyousketch2
  • 2,060
  • 1
  • 11
  • 11

1 Answers1

-1

There are two things, the plugin, and the API to the plugin. Usually the API covers the same parameters as the dialog version, but there are exceptions. file_pdf_load is among them.

All functions in the PDB can be found with Filters>Python-fu>Console and hitting the Browse... button. The API descriptions there (including parameters) are created from the plugin registration data, so there is no secret API...

xenoid
  • 8,396
  • 3
  • 23
  • 49
  • I've already been there. `file_pdf_load` doesn't show the dialog parameters, it shows `(pages, pages, run_mode = RUN_INTERACTIVE )` which is in the code above. – Doyousketch2 Jan 14 '18 at 01:27
  • Yes, which is why you won't find any additional parameters. If the parameters aren't shown there, they don't exist... – xenoid Jan 14 '18 at 01:31
  • They have to exist somewhere. If not through that method, target the dialog box. It's just another container with variables in it. – Doyousketch2 Jan 14 '18 at 01:34
  • Perhaps to some function inside the plugin, but not to the plugin. If you want these externalized, then Gimp is open source, you can change the plugin to suit you. – xenoid Jan 14 '18 at 01:41
  • I'm not re-writing GIMP. I'd sooner write an xdotool script. The point is to be cross-platform though. – Doyousketch2 Jan 14 '18 at 01:59