I'm trying to figure ut if there's any way that choices made by a 
user in dialog widgets can be remembered and used as values of those 
widgets next time dialog runs.

In most other scripting languages I'd save choices to somethng like 
an ini file, and retrieve stored ini file values before displaying 

Hmm.  Ok, a few problems:

(a) How to run code before dialog displays.  I tried this at top 
level (i.e. not enclosed within any procedure:

   (load "F:\\test.scm")

where test.scm contained

  (define WRF_BIT_WIDTH_SETTINGS '(17 0 256 0.1 1 1 1)) ; 

and script-fu-register dialog def included


That seemed to work.  (Now I've just got to figure out how to write 
out valid define statements to test.scm and I'm partly there.  Looks 
like a combination of calls to write-char and write obj may do.)

BUT: if loaded scm contains

  (define WRF_BIT_WIDTH 17)

and script-fu-register dialog def includes:

  SF-ADJUSTMENT "bit width:"   '(WRF_BIT_WIDTH 0 256 0.1 1 1 1)

the value of WRF_BIT_WIDTH loaeded from test.scm doesn't seem to 

Any thoughts as to why?

Another approach I tried was to begin declaration of dialog

   (script-fu-register  WRF_DIALOG_FUNCTION
     (wrf_test_text)   ;menu label
     "Create a Finger Template for Woodrat"  ;description

where (wrf_test_text)   is

(define (wrf_test_text)
  (set! WRF_BIT_WIDTH_SETTINGS '(17 0 256 0.1 1 1 1))
 "Finger..." ; return value

which also seemed to work; in principle I could write code for 
(wrf_test_text) that interrogated an ini file, retrieved values, 
constructed correct lists, initialised variables used in later 
parameters of script-fu-register.  Rather round-the-houses, but 


(b) But: to make this work I need to be able to determine if a file 
exists (error if try to load file that doesn't) and to be well-
behaved, be able to specify a particular folder in which to look for 
ini files (same folder as running script?  GIMP install folder?  GIMP 
share\gimp\2.0\..?).  Any way to test for file existence or determine 
script folder/install folder in script-fu?

Thanks for any help.



It costs me never a stab nor squirm,
To tread by chance upon a worm.
Aha, my little dear, I say,
Your clan will pay me back one day.

      --  Dorothy Parker

===================== +++++  =====================

Gimp-user mailing list

Reply via email to