It is currently Sat Aug 15, 2026 3:15 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Script crashes when executed
PostPosted: Wed Apr 30, 2014 10:03 am  (#1) 
Offline
New Member

Joined: Apr 30, 2014
Posts: 1
I am writing this script to create specific sized new images by selecting the name of the item from a menu. The menu works, but when select the item and click ok, I get an insuficent arguments error.
What do I need to correct this error?

(script-fu-register "TMETurboBrand"
"<Toolbox>/Xtns/Script-Fu/TMEturboBrand"
"turbobrand"
"azimuthcgi"
"JL Clifford"
"april 2014"
""
SF-OPTION "SF-OPTION" '("STL" "Bar" "Square" "Highboy" "Executive Tower")
SF-IMAGE "The Image" 0
SF-DRAWABLE "The Layer" 0

)

(if (= SF-OPTION 0)

(let* (
(thisImage (car (gimp-image-new 1024 469 0)))
(thisLayer (car (gimp-image-get-active-layer thisImage)))
)
(gimp-display-new thisImage)
()
)
(if (= SF-OPTION 1)

(let* (
(thisImage (car (gimp-image-new 1024 657 0)))
(thisLayer (car (gimp-image-get-active-layer thisImage)))
)
(gimp-display-new thisImage)
)
(if (= SF-OPTION 2)

(let* (
(thisImage (car (gimp-image-new 1024 657 0)))
(thisLayer (car (gimp-image-get-active-layer thisImage)))
)
(gimp-display-new thisImage)
)
(if (= SF-OPTION 3)

(let* (
(thisImage (car (gimp-image-new 1024 657 0)))
(thisLayer (car (gimp-image-get-active-layer thisImage)))
)
(gimp-display-new thisImage)
)
(if (= SF-OPTION 4)

(let* (
(thisImage (car (gimp-image-new 1024 657 0)))
(thisLayer (car (gimp-image-get-active-layer thisImage)))
)
(gimp-display-new thisImage)
)
(gimp-message "Please pick an item")

)))))


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Script crashes when executed
PostPosted: Wed Apr 30, 2014 10:23 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
the Define of the script is missing

_________________
"Where am I ?"


Top
 Post subject: Re: Script crashes when executed
PostPosted: Wed Apr 30, 2014 10:38 am  (#3) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
There's a few things that need to be addressed.

First you need to 'define' a procedure that will accept the arguments (the SF-OPTION, SF-IMAGE, etc) that are specified in your 'script-fu-register' call. This procedure should have the same name as the first argument to 'script-fu-register' ("TMETurboBrand").

Second, it is not necessary to specify SF-IMAGE and SF-DRAWABLE because your script is creating them, rather than using pre-existing ones.

Third, your use of 'gimp-image-new' is correct, however, the image created does not have any layers yet (so 'gimp-image-get-active-layer' will fail). You need to use 'gimp-layer-new' and 'gimp-image-insert-layer' to add a new layer to your image.

The following code addresses the first two issues; I leave it to you to address the third.

(script-fu-register "TMETurboBrand"
  "<Toolbox>/Xtns/Script-Fu/TMEturboBrand"
  "turbobrand"
  "azimuthcgi"
  "JL Clifford"
  "april 2014"
  ""
  SF-OPTION "SF-OPTION" '("STL" "Bar" "Square" "Highboy" "Executive Tower")
  )

(define (TMETurboBrand option)
  (if (= option 0)
    (let* (
           (thisImage (car (gimp-image-new 1024 469 0)))
           (thisLayer (car (gimp-image-get-active-layer thisImage)))
          )
      (gimp-display-new thisImage)
      ()
      )
    (if (= option 1)
      (let* (
             (thisImage (car (gimp-image-new 1024 657 0)))
             (thisLayer (car (gimp-image-get-active-layer thisImage)))
            )
        (gimp-display-new thisImage)
        )
      (if (= option 2)
        (let* (
               (thisImage (car (gimp-image-new 1024 657 0)))
               (thisLayer (car (gimp-image-get-active-layer thisImage)))
              )
          (gimp-display-new thisImage)
          )
        (if (= option 3)
          (let* (
                 (thisImage (car (gimp-image-new 1024 657 0)))
                 (thisLayer (car (gimp-image-get-active-layer thisImage)))
                )
            (gimp-display-new thisImage)
            )
          (if (= option 4)
            (let* (
                   (thisImage (car (gimp-image-new 1024 657 0)))
                   (thisLayer (car (gimp-image-get-active-layer thisImage)))
                  )
              (gimp-display-new thisImage)
              )
            (gimp-message "Please pick an item")
            ))))))

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group