[Gimp-user] small bug in GIMP 2.6.7, windows, SF-DIRNAME?
I was trying to find something to put in a SF-DIRNAME widget that would work on all platforms. I tried /. Bad choice on *nix/Mac, cause it leaves you at root of file system. On windows, / is displayed as \; the parameter associated with the SF-DIRNAME displays with gimp-message as \, but throws an error when used as argument to SF-DIRNAME string-append. If it is genuinely coming back as a single backslash I can see why (string-append would have problems with it (a single escape \ shouldn't be allowed, and indeed generates an error in e.g. (define x \) in the console) So, something a bit wrong there? And back to my original problem: is there any way to make sure I land in a sensible folder (like $HOME or windows %USERPROFILE) when using SF-DIRNAME? ~ doesn't work for Windows. Null string ends up in GIMP install\bin on windows, $HOME I think on Mac/*nix. Yrs, Alan Fac ut gaudeam: Make my day. = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] fractional small-step for SF-ADJUSTMENT
Hi, I wanted to have a spinner (roller-box), measurement in inches, jumping by 0.0625 (1/16) every time user clicked the spinner. Doesn't seem to work. Looks like small-step, large-step have to be integral values. That match what everyone else finds? Sample code: (define (wrf_test inBoardWidth inBoardWith2) 0 ) (script-fu-register wrf_test _A Test... Testing Menu Naming; description Alan Campbell no copyright today ; adjustment: title (start-value min-value max-value ; small-step large-step [int=0 or float=1] [slider=0 or roll-box=1]) SF-ADJUSTMENT Board width: (list 4.00 0 12 .03125 0.625 1 1) SF-ADJUSTMENT Board width: (list 4.00 0 12 1 10 1 1) SF-OPTION Shoulder type '(two none one) ) (script-fu-menu-register wrf_test Image/File/Create/) Yrs, Alan 24 hours in a day, 24 beers in a case. Coincidence? = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu-menu-register with space in folder name?
On Mon Oct 25 10:03:38 PDT 2010 Sven Neumann said: but if I try, subfolder Joint Scripts doens't appear Any way to get a space in a subfolder name? Are you sure? I wonder how all the scripts in the Alpha to Logo folder register themselves then. Perhaps you should register the menu branch first? Can you perhaps show us a simple example script to illustrate the problem? No. Now I can't replicate problem. Tried all sorts of ways. Must have been something else I screwed up in script. Sorry to bother. Yrs, Alan Recedite, plebes! Gero rem imperialem!: Stand aside plebians! I am on imperial business. = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] script-fu-menu-register with space in folder name?
I'd like to do (script-fu-menu-register some_func Image/File/Create/Joint Scripts) but if I try, subfolder Joint Scripts doens;t appear (script-fu-menu-register some_func Image/File/Create/JointScripts) works fine. Any way to get a space in a subfolder name? gimp-plugin-menu-branch-register shows same behaviour. Yrs, Alan If you don't know where you're going, you're never lost. = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] (Fwd) Re: script-fu: underscore?; script-fu-regist
The version of my woodrat script I refrred to below works on Mac GIMP version 2.6.7 Ubuntu GIMP version 2.6.8 Win GIMP version 2.6 10 Haven't tried 2.6.11 yet. --- Forwarded message follows --- From: Alan Campbell To: gimp-user@lists.XCF.Berkeley.EDU Subject:Re: [Gimp-user] script-fu: underscore?; script-fu- register; script-fu-menu-register Send reply to: gimp-u...@alancampbelllists.ukfsn.org Date sent: Mon, 04 Oct 2010 21:06:43 0 On 4 Oct 2010 at 10:21:16 PDT saulgoode at flashingtwelve.brickfilms.com wrote: It is not a problem with the branch register command not being processed, but that branch registration seems to require that plug-in be associated with it (see 'plugin_menu_branch_register_invoker()' in app/pdb/plug-in-cmds.c). Apparently, when processed at the top level of a Script-fu, there is no current-active-plugin; and this leads to 'gimp_marshal_VOID__STRING_STRING_STRING' failing because it is missing one of its parameters (the plug-in name). Don't have source code, so I'll pass on the c. But I get the idea. I did this: (define (wrf_register_menu_branch) (gimp-plugin-menu-branch-register Image/File/Create/W_oodrat) _Finger... ) (script-fu-register wrf_create_template_finger (wrf_register_menu_branch); menu label which works. (script-fu-register when it runs has to call (wrf_register_menu_branch), which does the register thing. A clever solution. However, I was unable to make it work with GIMP 2.6.10+. What version of GIMP are you using? 2.6.10 win32 on XP. Anyway, my kludge seems to work. Thanks for pointer on how to do it. I'm not sure how robust your kludge is. If it is not version specific then it may be working for you (and not me) because of something other going on than just the code you posted here (multiple procedure registrations in the same file perhaps). Could you provide a complete listing of your script? 2000 lines overall, 1200 lines of code. Perhaps a bit excessive to paste into a posting here. So for moment it's in woodrat.zip at https://docs.google.com/leaf?id=0B6M_pjcD- RRwNTZjODc0NzQtYjliMy00ZDBlLTgzZWItNDAyNDExMTA2YzU3hl=enauthkey=CMGn 5i4 or http://bit.ly/btzFxD or http://www.freedrive.com/folder/282054 In version posted I invoke (wr_register_menu_branch) 3 times, with argument (the value to return each time). It also worked for me when I just invoked it once (on the first (script-fu-register)). Any comments or crits on code very welcome, e.g. if you happen to notice me doing anything wildly inefficient. To actually run the script you need the pattern file included in the zip. --- End of forwarded message ---Yrs, Alan Anything worth fighting for is worth fighting dirty for. = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register
On 4 Oct 2010 at 10:21:16 PDT saulgoode at flashingtwelve.brickfilms.com wrote: It is not a problem with the branch register command not being processed, but that branch registration seems to require that plug-in be associated with it (see 'plugin_menu_branch_register_invoker()' in app/pdb/plug-in-cmds.c). Apparently, when processed at the top level of a Script-fu, there is no current-active-plugin; and this leads to 'gimp_marshal_VOID__STRING_STRING_STRING' failing because it is missing one of its parameters (the plug-in name). Don't have source code, so I'll pass on the c. But I get the idea. I did this: (define (wrf_register_menu_branch) (gimp-plugin-menu-branch-register Image/File/Create/W_oodrat) _Finger... ) (script-fu-register wrf_create_template_finger (wrf_register_menu_branch); menu label which works. (script-fu-register when it runs has to call (wrf_register_menu_branch), which does the register thing. A clever solution. However, I was unable to make it work with GIMP 2.6.10+. What version of GIMP are you using? 2.6.10 win32 on XP. Anyway, my kludge seems to work. Thanks for pointer on how to do it. I'm not sure how robust your kludge is. If it is not version specific then it may be working for you (and not me) because of something other going on than just the code you posted here (multiple procedure registrations in the same file perhaps). Could you provide a complete listing of your script? 2000 lines overall, 1200 lines of code. Perhaps a bit excessive to paste into a posting here. So for moment it's in woodrat.zip at https://docs.google.com/leaf?id=0B6M_pjcD- RRwNTZjODc0NzQtYjliMy00ZDBlLTgzZWItNDAyNDExMTA2YzU3hl=enauthkey=CMGn 5i4 or http://bit.ly/btzFxD or http://www.freedrive.com/folder/282054 In version posted I invoke (wr_register_menu_branch) 3 times, with argument (the value to return each time). It also worked for me when I just invoked it once (on the first (script-fu-register)). Any comments or crits on code very welcome, e.g. if you happen to notice me doing anything wildly inefficient. To actually run the script you need the pattern file included in the zip. Yrs, Alan Never put anything smaller than your elbow into your ear. = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register
One of uses of an underscore is to pick out the shortcut character in a menu item: (script-fu-register wrdhb_create_half_blind_dovetail _Half blind dovetail... ;menu label Create Template for Half blind Dovetail ) There also appears to be (script-fu-register wrdhb_create_half_blind_dovetail _Half blind dovetail... ;menu label ... ) whch I gather has something to do with translation: I assume it would have no effect in this particular case because it's sadly unreasonable to expect translation dictionaries (po files??) to know blind or dovetail. That so? == script-fu-register wrdhb_create_half_blind_dovetail _Half blind dovetail... ;menu label ) Also, I've been using this style of getting a script registered for use in create menu: (script-fu-menu-register wrdhb_create_template_half_blind_dovetail Image/File/Create/Woodrat) (a) Can I combine the two, putting path in second parameter of script-fu-register? (b) Is there anyway of getting a letter of the submenu Woodrat to be a shortcut key? I've tried variations of underscore in the Image/File/Create/Woodrat parameter, doesn't work. Yrs, Alan Never accept a drink from a urologist. -- Erma Bombeck = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register
Hi Sven, On 3 Oct 2010 at 14:19, Sven Neumann wrote: On Sun, 2010-10-03 at 12:59 +, Alan Campbell wrote: One of uses of an underscore is to pick out the shortcut character in a menu item: (script-fu-register wrdhb_create_half_blind_dovetail _Half blind dovetail... ;menu label Create Template for Half blind Dovetail ) There also appears to be (script-fu-register wrdhb_create_half_blind_dovetail _Half blind dovetail... ;menu label ... ) whch I gather has something to do with translation: I assume it would have no effect in this particular case because it's sadly unreasonable to expect translation dictionaries (po files??) to know blind or dovetail. That so? If you want your scripts to be translated, then you need to put your scripts into a separate translation domain and ship the translations with them. You can of course not expect the strings from your scripts to be part of the standard script-fu translation domain. Yikes. Okay, will now go find out what a translation domain is. However, since woodrats I think are only sold only with English instructions, I guess their owners will probably read engish... Also, I've been using this style of getting a script registered for use in create menu: (script-fu-menu-register wrdhb_create_template_half_blind_dovetail Image/File/Create/Woodrat) (a) Can I combine the two, putting path in second parameter of script-fu-register? Using a path in the script-fu-register call is deprecated. Please use script-fu-menu-register. Have done, thanks. (b) Is there anyway of getting a letter of the submenu Woodrat to be a shortcut key? I've tried variations of underscore in the Image/File/Create/Woodrat parameter, doesn't work. You need to explicitly create the submenu using gimp-plugin-menu-branch-register. This procedure should accept mnemonics marked with an underscore. Tried (gimp-plugin-menu-branch-register Image/File/Create W_oodrat) (gimp-plugin-menu-branch-register Image/File/Create _Woodrat) followed by (script-fu-menu-register wrdhb_create_half_blind_dovetail Image/File/Create/W_oodrat) or (script-fu-menu-register wrdhb_create_half_blind_dovetail Image/File/Create/_Woodrat) or (script-fu-menu-register wrdhb_create_half_blind_dovetail Image/File/Create/Woodrat) Always got the Woodrat folder under File | Create menu, no shortcut key indicated. Yrs, Alan Law of Cybernetic Entomology: There is always one more bug. = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register
Always got the Woodrat folder under File | Create menu, no shortcut key indicated. On 3 Oct 2010 at 11:17:05, Sven Neumann wrote: I am pretty sure that it theoretically should work this way. After all the Script-Fu extension itself creates sub-menus this way and those sub-menus do have mnemonics. You definitely should not use the underscore in the menu-register call. I was calling (gimp-plugin-menu-branch-register from top level, i.e. it was a statement in scm file along with many (defines. So how does that work? script-fu interpreter processes defines first, then any (script-fu-register*) statements, nothing else? Any other precedence rules? However the problem is most likely that Script-Fu doesn't provide you any means to call this procedure before the menu-register call is executed. There would probably have to be a script-fu-menu-branch-register() wrapper added for this purpose. I did this: (define (wrf_register_menu_branch) (gimp-plugin-menu-branch-register Image/File/Create W_oodrat) _Finger... ) (script-fu-register wrf_create_template_finger (wrf_register_menu_branch); menu label which works. (script-fu-register when it runs has to call (wrf_register_menu_branch), which does the register thing. A possible solution would be to write your scripts in Python. Oh dear. I've had enough mental exercise for this year learning script-fu. Not sure by brain could take relearning python. Also that would require that end users of script, generally assumed not to be highly computer literate, would have to install python as well as GIMP. Anyway, my kludge seems to work. Thanks for pointer on how to do it. Yrs, Alan Never say anything on the phone that you wouldn't want your mother to hear at your trial. -- Sydney Biddle Barrows the Mayflower Madam = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: saving dialog choices
On 10 Sep 2010 at 9:35, Rob Antonishen wrote: Ta for reply. use the https://bugzilla.gnome.org/show_bug.cgi?id=572865 Thanks, got that working. Instead of parasites consider using gimp_gimprc_set() and gimp_gimprc_query() which don't seem to have this issue. In Script-fu console (gimp_gimprc_set xxx ) on my win 2.6.10 installation gives Error: eval: unbound variable: gimp_gimprc_set Did I miss something? Yrs, Alan No one is listening until you make a mistake. = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: saving dialog choices
On Sat, 2010-09-11 at 16:53 +, Alan Campbell wrote: On 11 Sep 2010 at 12:26, Sven Neumann wrote: In Script-Fu it's gimp-gimprc-set. Works, ta. That's really an abuse of the gimprc though. So it's really only meant for GIMP and GIMP plugin settings? Also it looks like once I've called gimp-gimprc-set, no way to remove expunge evil deed from the gimprc file? It would be much better to get the parasites problem fixed. Sure. I'm not in no hurry. Lots more wrok to do on my woodrat scripts. Any guess re timescale? Yrs, Alan Sometimes I wonder if men and women really suit each other. Perhaps they should live next door and just visit now and then. -- Katharine Hepburn = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] script-fu: saving dialog choices
Hi Saul, Many thanks for instant help. I'm trying to figure ut if there's any way that choices made by user in dialog widgets can be remembered and used as values of those widgets next time dialog runs. That is precisely how script dialogs currently behave; the last used values are presented. These last values will be reset to their original default values if 1) Script-fu is refreshed (Filters-Script-fu-Refresh Scripts) or 2) GIMP is restarted. Sorry, I mis-stated my problem. I'd like dialog to come up with same widget values next time GIMP is started up. ...(snip)... Tick quoting does not result in evaluation of the list elements. Use 'list' so that WRF_BIT_WIDTH gets evaluated and replaced by its numeric value: Thanks, I think it I read that bit in the Scheme manual and forgot it. ...(snip)... If, however, the issue you are attempting to address is having the last values retained across sessions (or survive a Script Refresh), this would be possible by storing your script's last values in the gimpdir/parasiterc file: (define (script-fu-woodrat image drawable bit-width) ; Substitute function owing to buggy parasite-attach behavior (define (fu-parasite-attach parasite) (gimp-parasite-attach parasite) (while (not (string=? (caddr parasite) (caddar (gimp-parasite-find (car parasite) (gimp-parasite-attach parasite))) ; Save the user-specified bit-width to an application parasite (fu-parasite-attach (list WRF_BIT_WIDTH 1 (number-string bit- width))) ... ) (script-fu-register script-fu-woodrat : : : SF-IMAGE ... SF-DRAWABLE ... SF-VALUE Bit width (catch 17 ; fallback value if first-time run (string-number (caddar (gimp-parasite-find WRF_BIT_WIDTH))) ) Note that 'gimp-parasite-find' is only executed once: when GIMP is initially loaded (or if scripts are refreshed). Even though the parasite is saved every time the script is executed, it is actually GIMP's internally stored last value (not the parasite) that is used in determining the value for the 'bit-width' parameter. The only reason you'd want to take these steps is to support last values across different sessions. The behavior you desired (as expressed in the first paragraph of your post) is already supported by GIMP. Sorry, mis-stated by requirement. parasites are just what I need. Can't find much about them. (list WRF_BIT_WIDTH 1 (number-string bit-width))) First list member: parasite ID string. What's the second list member? Flags, I understand from one search result I found. Used? Third list member: parasite value (must always be a string). So an RGB colour value would have to be stringified. unstrbreakup maybe? Generally: do all the gimp-*-parasite-attach methods suffer from same bug, so should be reapplied til they work? Yrs, Alan Public speaking is very easy. -- Vice President Dan Quayle to reporters in 10/88 = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] dependant scm files and script-fu load
I have several scm files; they all live in a single folder (which is on GIMP search path for scripts). I have common code for three of the scripts which all goes into a fourth. A fifth has defines which user of scripts may wsh to alter; the fourth script depends on it. If I just leave nature -- or GIMP to take it's course, the scripts don't load when scripts come up, unless I arrange for the most- depended on script (the fifth) to have a name prceeding all others in alphabetical sort order, the fourth the next in order. If I refresh scripts, name order doesn't seem to matter, all works fine. Okay, so to avoid problem I'd like to explicitly load one file from another. But (load script) seems to require an absolute path. I don't want to specify absolute path because other users of scripts (which are mean to be distributed) could put scripts anywhere. Is there a way to refer to something like folder in which curent script resides or user GIMP configuration folder (e.g. on my machine Docs and Settings\UserName\.gimp-2.6)? Yrs, Alan The more you complain, the longer God lets you live. = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] script-fu: saving dialog choices
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
Re: [Gimp-user] gimp-image-set-unit ineffective on 2.67 for windows
Hi Sven, But I've set GIMP preferences Default Image and Image Size in mm, and Default Grid in mm. If I do File | New, image is displayed with mm units n status bar. Why doesn't that happen for an image created from a template created from my script? Is there some other preference I should change? On Sun, 2009-11-01 at 18:38 +, Alan Campbell wrote: I'm trying to get a script to generate an image with default units (as displayed in status bar at bottom of image window) to be mm instead of pixels. My script does The units displayed in the status bar are the image's display units. The display unit is different from the image unit and it can only be changed by the user, not by a script. Sven Yours, Alan Campbell BRIGHTON, UK Every program has at least one bug and can be shortened by at least one instruction -- from which, by induction, one can deduce that every program can be reduced to one instruction which doesn't work. = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] gimp-image-set-unit ineffective on 2.67 for windows
Hi, I'm trying to get a script to generate an image with default units (as displayed in status bar at bottom of image window) to be mm instead of pixels. My script does (gimp-image-set-unit 2) and I've even set default image grid (in preferences) in mm. No joy. Can it be done? Short exchange at http://www.gimptalk.com/forum/gimp-image-set-unit--t45138.html suggests not. Thanks for any help. Yrs, Alan Mind Like A Steel Trap -- Rusty And Illegal In 37 States = + = ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user