Share this topic on AskShare this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on TwitterShare this topic on YahooShare this topic on Google buzz

Author Topic: Changing the Menu Location of Your GIMP Scripts  (Read 1535 times)

0 Members and 1 Guest are viewing this topic.

Offline fencepost

  • Member
  • **
  • Posts: 2,626
  • Karma: 0
    • fence-post.deviantart.com
Changing the Menu Location of Your GIMP Scripts
« on: February 20, 2008, 10:21:35 PM »
If you would like to move your GIMP scripts to a new location, read on.....it is a very simple operation to do so!  Here's how:

Open up the desired script you would like to change and go down to the bottom of the script.  Look for code that resembles something like this:

This coding format is generally found in older scripts

(script-fu-register "script-fu-basic2-logo"
    "Basic II..."

(script-fu-menu-register "script-fu-basic2-logo"   
"<Toolbox>/Xtns/Logos")

-OR-

This coding format is generally found in newer scripts (this is the only format I use)

(script-fu-register    "fp-satin-script"
"<Image>/Filters/Render/Satin..."


Notice, the older format utilizes two separate "commands" to tell GIMP where to place it in the menu.  If you look at the bold parts of the code in script-fu-register, it tells you that the name of the script the user will see is "Basic II..."  The script-fu-menu-register tells GIMP to place it under Xtns > Logos.  So, the combination of these two commands sets the menu as follows: Xtns > Logos > Basic II...

The newer code utilizes only one "command" to place the script in the menu. 

To change the script to a new menu location, but leave the menu name the same, simply change this part of the code:

"<Toolbox>/Xtns/Logos"

To move it under the Xtns menu by itself (Xtns > Basic II...), the code would need to be changed to "<Toolbox>/Xtns"
If you want to move it move it to a NEW menu where none exists (Xtns > Darth > Basic II...), change it to this: "<Toolbox>/Xtns/Darth"
The same is true for the newer code format.  "<Image>/Filters/Render/Satin..." appears under Filters > Render > Satin...  To move it to Filters > Fencepost > Satin... change the code to this:   "<Image>/Filters/Fencepost/Satin..."

Moving a script from the <Toolbox> menu to an <Image> does not convert the <Toolbox> script to an <Image> script, it only changes the menu location.  There are programming differences between the two types and simply moving the menu location does not make the necessary changes.

Save your script and refresh them to see if they've been placed in the desired menu locations.  Let me know if you have any questions or need clarification.

Art
« Last Edit: May 15, 2010, 09:26:46 PM by Hi-T3k~HillBilly »
I'd rate you as an upper-middle-lower-mod with pro-novice-inter tendencies.....and a twist of lime!  Of course, my rating scale is completely objectively subjective, but ALWAYS consistently inconsistent.

Offline Darth_Gimp

  • Number One
  • *****
  • Posts: 2,894
  • Karma: 0
  • Faith, Folk, Family!
    • lds-jedi.deviantart.com
    • Odinic Rite
Re: Changing the Menu Location of Your GIMP Scripts
« Reply #1 on: February 20, 2008, 10:26:03 PM »
very cool thanks Fence!
GimpDome Group: http://gimpdome.deviantart.com/
My DeviantArt: http://lds-jedi.deviantart.com/

There's no worse feeling than that millisecond you're sure you are going to die after leaning your chair back a little too far.

Offline PhotoComiX

  • Member
  • **
  • Posts: 86
  • Karma: 0
Re: Changing the Menu Location of Your GIMP Scripts
« Reply #2 on: March 11, 2008, 05:06:40 AM »
Quote
Do NOT move a <Toolbox> script to <Image> and vice versa.  They won't that way.

could you explain better this point?

...time ago  moved some toolbox script in image menu (for the very simple reason i wanted in the "render" submenu there)

then i didn't know how to transform a "toolbox" in a "Image script" (not sure to know now if not in theory, but thank to your tuts now i should be able to try) but when i tried the "misplaced scripts" were ,apparently working as they should (well 2 on 3 were  working...3 refused to work)...i mean working as a Toolbox script not as image script but still they were working even if called from the image menu

         

Offline a2j3

  • Member
  • **
  • Posts: 501
  • Karma: 0
Re: Changing the Menu Location of Your GIMP Scripts
« Reply #3 on: March 11, 2008, 06:18:33 AM »
Great work Fence. Thank you.

Offline fencepost

  • Member
  • **
  • Posts: 2,626
  • Karma: 0
    • fence-post.deviantart.com
Re: Changing the Menu Location of Your GIMP Scripts
« Reply #4 on: March 11, 2008, 07:44:32 AM »
could you explain better this point?

...time ago  moved some toolbox script in image menu (for the very simple reason i wanted in the "render" submenu there)

then i didn't know how to transform a "toolbox" in a "Image script" (not sure to know now if not in theory, but thank to your tuts now i should be able to try) but when i tried the "misplaced scripts" were ,apparently working as they should (well 2 on 3 were  working...3 refused to work)...i mean working as a Toolbox script not as image script but still they were working even if called from the image menu

         

Actually, I should clarify what I wrote above as my statement isn't entirely correct, but my *intent* was.   :)

You can move the menu from the Toolbox to the Image and vise versa, and the scripts will work fine.  However, I didn't want someone to think that just because they moved the menu location from the Toolbox to the Image that the script was now an "Image" script.  It isn't, it just runs from the menu of an open image.  For those who haven't read my/other people's tutorials on scripting, you might not be aware that there are actually differences in the scripting methods between the two types.  Even if an Image/Toolbox script do the exact same thing, they have to be programmed differently.    You are correct in stating that they do work correctly.  Thanks for pointing that out.  I'll fix the language in my first post so that it's correct.
I'd rate you as an upper-middle-lower-mod with pro-novice-inter tendencies.....and a twist of lime!  Of course, my rating scale is completely objectively subjective, but ALWAYS consistently inconsistent.


Offline PhotoComiX

  • Member
  • **
  • Posts: 86
  • Karma: 0
Re: Changing the Menu Location of Your GIMP Scripts
« Reply #5 on: March 11, 2008, 10:09:46 AM »
well ...anyway may be some issue

for one (i think was flame.scm from the plugin registry) was nothing to do, it just refused to work from  the image menu...

About the others maybe i should try to port them as Image script..


rainwalker

  • Guest
Re: Satin script 103a and others
« Reply #6 on: March 11, 2008, 12:38:26 PM »
Art:
   I changed the "random" to "rand" in the "while" portion of the toolbox satin script and everything works just fine. I'll now proceed with your image satin script,(103b) using the same changes to "while" and cutting and pasting from the GIMP 2.2 toolbox satin script.
   The toolbox satin script also solved another problem for me. Phillippe Demartin updated a "liquid water" script to version 0.3 for GIMP 2.4. (GIMP SCRIPTS, newbielink:http://www.gimpscripts.com/?page_id=5 [nonactive] ) This used the same "plug-in-rgb-noise" as the satin tool box script. I wasn't able to find an earlier version of the script to find out what was originally used, but the toolbox satin script gave me the answer. I replaced the plugin name and left the rest of the parameters. Everything works fine.
   I also worked on the "test-sphere" script. For GIMP 2.2, you might consider amending your "SF-COLOR" comment to say that the numeric values are the only acceptable arguments. Don't know why GIMP 2.2 won't take "color", but it won't. I made the changes in "background color" and "sphere color" and it works great. This is a teriffic learning tool.
   Thanks again for all your help.  Rainwalker

Offline fencepost

  • Member
  • **
  • Posts: 2,626
  • Karma: 0
    • fence-post.deviantart.com
Re: Satin script 103a and others
« Reply #7 on: March 11, 2008, 12:45:34 PM »
Glad you were able to get it to work for you and it helped with your other scripts!

   I also worked on the "test-sphere" script. For GIMP 2.2, you might consider amending your "SF-COLOR" comment to say that the numeric values are the only acceptable arguments. Don't know why GIMP 2.2 won't take "color", but it won't. I made the changes in "background color" and "sphere color" and it works great. This is a teriffic learning tool.
   Thanks again for all your help.  Rainwalker


Actually, that file came from the GIMP developers within the GIMP source code.  The only thing I modified in it was to get it to actually work in GIMP 2.4 (don't know why they put in a script that doesn't work, but I'm sure it's the least of their worries).  I really don't want to modify too much as I'm not versed enough with scripting and I don't want to give out inaccurate information and people blame me for that.  So, I'll just leave it as is and hopefully folks won't run into too many troubles. 

Glad to be of help and I'm pleased that you found the tutorials to be a good resource!  ;)

Art
I'd rate you as an upper-middle-lower-mod with pro-novice-inter tendencies.....and a twist of lime!  Of course, my rating scale is completely objectively subjective, but ALWAYS consistently inconsistent.

Tags:
 

anything