GimpTalk Announcement :
Try your digital-art skills against your fellow gimpers in GIMPtalk's Biweekly Art competition !


Board index » GIMP Art Galleries and Resources » GIMP Plugins, Filters, and Scripts Web Development Services . Convert FLV to Cell Phone Format
Featured Tutorial : Learn how to create characters by Griatch
Search for :  


Post new topic Reply to topic   [ 5 posts ]  


Author Message
Offline
 Post subject: How can I transmit filename variable to script-fu-register?
PostPosted: Mon Mar 01, 2010 8:59 am 

Joined:
Thu Jan 21, 2010 3:42 pm

Topics:
Posts: 7

Find User's Topics

I'd like to:
1. User opens image in gimp
2. Then he press hot key and executing script.

In the script i'd like to get filename (for example "picture.jpg) and pass it to parameters

Code:
(script-fu-register "script-fu-anketa"
        "<Toolbox>/Script-Fu/anketa"
        "Обработка анкеты"
        "www.gimp.org"
        "made with gimp"
        "27 February 2010"
        ""
        SF-IMAGE "Image" 0
        SF-DRAWABLE "Drawable" 0
   SF-VALUE "Filename" "Original_image_filename"
)


So how can i pass it to script-fu-register function:
for example it would be:
Code:
(script-fu-register "script-fu-anketa"
        "<Toolbox>/Script-Fu/anketa"
        "Обработка анкеты"
        "www.gimp.org"
        "made with gimp"
        "27 February 2010"
        ""
        SF-IMAGE "Image" 0
        SF-DRAWABLE "Drawable" 0
        SF-VALUE "Filename" "picture.jpg"
)




Top
 Profile E-mail  
 
Offline
 Post subject: Re: How can I transmit filename variable to script-fu-register?
PostPosted: Mon Mar 01, 2010 1:34 pm 
GT Manager

User avatar

Joined:
Mon Jun 13, 2005 11:15 am

Topics:
Posts: 10850

Find User's Topics
i can't answer to your question but this

Quote:
"<Toolbox>/Script-Fu/anketa"


is wrong, there are no more menu in the toolbar.
Still somehow gimp usually remap the menu location but i am not sure will do in this case

Even if will do new location will be hard to guess most of the script that were registered in the toolbox are remapped in File/Create menu, were usually nobody think to look for scripts..but that if the path was something as <Toolbox>/Xtras/ Logos in your case i am not sure

i hope somebody else may help for the question

_________________
Image

http://www.flickr.com/photos/97844002@N00/


Top
 Profile  
 
Online
 Post subject: Re: How can I transmit filename variable to script-fu-register?
PostPosted: Mon Mar 01, 2010 2:21 pm 
Retired Staff

User avatar

Joined:
Mon Aug 22, 2005 8:35 pm

Topics:
Posts: 5318

Find User's Topics
gothica wrote:
I'd like to:
1. User opens image in gimp
2. Then he press hot key and executing script.

In the script i'd like to get filename (for example "picture.jpg) and pass it to parameters

It can't be done. The initial values for the registration parameters are determined when Script-fu is initialized (i.e., when GIMP is first started, or when a Refresh Scripts is performed). These initial values are as declared in the 'script-fu-register' call. Once a particular script is run, subsequent calls of the script will employ the last setting of these values.

Consider this example:
Code:
(script-fu-register "script-fu-anketa"
...
...
   SF-FILENAME "Filename" "Original_image_filename")


When you open GIMP, the initial setting for the filename parameter will be "Original_image_filename" and when you run the 'script-fu-anketa' script for the first time, the dialog will fill in the associated text box with that filename. If the user changes that text to something such as "some_other_filename" then the next time the 'script-fu-anketa' script is run, the dialog will present "some_other_filename" in the associated text box.

If you want a dialog to be presented which has its settings initialized to values based on the active image, you will need to write a plug-in (not a script) which handles the creation and management of the dialog manually.


NOTE: SF-VALUE is used for numeric parameters. For filenames one should use either SF-FILENAME or SF-STRING.

_________________
Everybody makes their own fun. If you don't make it yourself it's not fun, it's entertainment.


Top
 Profile  
 
Offline
 Post subject: Re: How can I transmit filename variable to script-fu-register?
PostPosted: Mon Mar 01, 2010 2:34 pm 

Joined:
Thu Jan 21, 2010 3:42 pm

Topics:
Posts: 7

Find User's Topics
saulgoode wrote:
If you want a dialog to be presented which has its settings initialized to values based on the active image, you will need to write a plug-in (not a script) which handles the creation and management of the dialog manually.


But how? I'd like to get filename of image (which was opened by user) in dialog window...


Top
 Profile E-mail  
 
Offline
 Post subject: Re: How can I transmit filename variable to script-fu-register?
PostPosted: Wed Mar 03, 2010 4:00 am 
GT Manager

User avatar

Joined:
Mon Jun 13, 2005 11:15 am

Topics:
Posts: 10850

Find User's Topics
Quote:
I'd like to get filename of image (which was opened by user) in dialog window...


and what if the image has not a real filename but only a ID because was not opened but created (or even paste from clipboard) ?
Not sure if for what you wish "untitled" that is the default name for new or paste images ( till are not saved ) will be usable for your intent

If not or you will have to handle "untitled " that is a very commune case as a error and/or prompt the user to save (that is the only way to give to similar image a different filename ) before use the plugin

_________________
Image

http://www.flickr.com/photos/97844002@N00/


Top
 Profile  
 
Display posts from previous:  Sort by  

Post new topic Reply to topic
 [ 5 posts ] 



Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Related Website
Gimp tutorials database
All rights reserved © GimpTalk 2008
forum software by
phpBB