[APBeta] Script help

I.R. van de Stadt irvandestadt at hotmail.com
Sat Jul 9 10:09:47 PDT 2011


Thanks Jeff,
I'll try it out, hopefully tomorrow (I'm not at home right now)
Clear Skies!
Inge

From: jey at adobe.com
To: apbeta at lists.astroplanner.net
Date: Sat, 9 Jul 2011 15:18:06 +0100
Subject: Re: [APBeta] Script help



Inge, The sorting doesn’t destroy the usefulness of the script (it just means M2 sorts after M19), so I went ahead and cleaned it up a bit (and added editing of image height and width in case anyone uses those) and published it. (It’s under Other / Images in the By Category section.) Let me know if you find any issues. Cheers,Jeff.  From: apbeta-bounces at lists.astroplanner.net [mailto:apbeta-bounces at lists.astroplanner.net] On Behalf Of I.R. van de Stadt
Sent: Saturday, July 09, 2011 1:56 AM
To: apbeta at lists.astroplanner.net
Subject: Re: [APBeta] Script help I sincerely hope that Paul will help you out.
A really useful script-idea and I'm looking forward to that one.
IngeFrom: jey at adobe.com
To: APBeta at lists.astroplanner.net
Date: Sat, 9 Jul 2011 01:12:02 +0100
Subject: [APBeta] Script helpPaul, I’ve written the following script to allow editing of user image descriptions (and some of the flags).  The first dialog shows a list of user images.  Double-clicking one of them brings up an edit dialog which allows you to edit the description and two of the flags. The first dialog list is doing a string-sort instead of an ID-sort, though.  Is there a way to return ID for the MultiFieldObject’s ColumnType so the list will sort correctly? Thanks,Jeff. function EditImage(img as Image) as boolean     dim editor as Dialog, imgCanvas as Canvas     editor = new Dialog     imgCanvas = Dialog.NewCanvas(500, 500)     imgCanvas.DrawImage(img, 0, 0, 500)          editor.CanvasParameter(imgCanvas)     editor.StringParameter("Description", img.Description)     editor.BooleanParameter("Color", img.IsColor)     editor.BooleanParameter("Black on White", img.IsBlackOnWhite)          if editor.show("Edit User Image for " + img.ID) then           img.Description = editor.StringParameter("Description")           img.IsColor = editor.BooleanParameter("Color")           img.IsBlackOnWhite = editor.BooleanParameter("Black on White")           return true     end if          return falseend functionfunction toStr(b as boolean) as string     if b then           return "true"     else           return "false"     end ifend functionclass ImageMetaData      implements MultiFieldObject     ID as string     Desc as string     isColor as boolean     isBlackOnWhite as boolean     index as integer     function ColumnName(idx as integer) as string           if idx = 1 then                return "ID"           elseif idx = 2 then                return "Description"           elseif idx = 3 then                return "Color"           elseif idx = 4 then                return "Black on White"           elseif idx = 5 then                return "Index"           end if     end function     function ColumnType(idx as integer) as integer           if idx = 1 then                return vtype_String           elseif idx = 2 then                return vtype_String           elseif idx = 3 then                return vtype_Boolean           elseif idx = 4 then                return vtype_Boolean           elseif idx = 5 then                return vtype_Integer           end if     end function     function ColumnValue(idx as integer) as string           if idx = 1 then                return ID           elseif idx = 2 then                return Desc           elseif idx = 3 then                return toStr(isColor)           elseif idx = 4 then                return toStr(isBlackOnWhite)           elseif idx = 5 then                return Str(index)           end if           return "undefined column (" + Str(idx) + ")"     end function     function nColumns() as integer           return 5     end functionend classfunction getImageMetaData(img as Image, idx as integer) as ImageMetaData     dim metadata as ImageMetaData     metadata = new ImageMetaData          metadata.ID = img.ID     metadata.Desc = img.Description     metadata.isColor = img.IsColor     metadata.isBlackOnWhite = img.IsBlackOnWhite     metadata.index = idx          return metadataend functionsub main()try     dim imageData(1000) as ImageMetaData          dim i, idx as integer, img as Image     i = 0     for idx = 1 to Image.Count           img = Image.Get(idx)           if img.IsUser then                imageData(i) = getImageMetaData(img, idx)                i = i + 1           end if     next     redim imageData(i-1)          dim browser as Dialog     while true           browser = new Dialog           browser.ListChoiceParameter("User Images", 0, imageData, true, 50, true)           browser.ParameterWindowNoCancel()           browser.ParameterWindowOKCaption("Done")                      if browser.show("User Image Browser") then                if browser.DoubleClickedList() = "User Images" then                     i = browser.ListChoiceParameter("User Images")                     idx = imageData(i).index                     img = Image.Get(idx)                     if EditImage(img) then                           imageData(i) = getImageMetaData(img, idx)                     end if                else                     return                end if           else                return           end if     wendcatch   print "My bad.  Image Browser script generated an exception."end tryend sub
_______________________________________________ APBeta mailing list APBeta at lists.astroplanner.net http://lists.astroplanner.net/listinfo.cgi/apbeta-astroplanner.net
_______________________________________________
APBeta mailing list
APBeta at lists.astroplanner.net
http://lists.astroplanner.net/listinfo.cgi/apbeta-astroplanner.net 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.astroplanner.net/pipermail/apbeta-astroplanner.net/attachments/20110709/a83146c6/attachment-0003.htm>


More information about the APBeta mailing list