Hi, 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 dialog. 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 SF-ADJUSTMENT "bit width:" WRF_BIT_WIDTH_SETTINGS 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 take. 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 ..... SF-ADJUSTMENT "bit width:" WRF_BIT_WIDTH_SETTINGS 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 works. =============================== (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. Yrs, Alan 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 Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user