TIP: isImagLoaded function

MisterX b.xavier at internet.lu
Wed Jun 22 02:50:31 EDT 2005


Hi all!

Here's a couple new TAOO XOSMediaLib functions im sure many are going to
enjoy!

However I know this one feature is much needed so i can release it outside
the TAOO framework. 

here's the little add-on-script i made to see if an image existed or was
loaded and by what stack. 

To use it, just script

get imageNameexists(987654)
get imageidexists(987654)

 -- it will return which stack or false.



<script>
global xos
  
function ImageIDExists imgID
 RefreshGlobalImages
  get the keys of xos
  filter it with "stackimages,*"
  sort it
  repeat for each line thisstack in it
    if imgID is among the items of xos[thisstack]
    then return item 2 of thisstack
  end repeat
  return false
end ImageIDExists

function ImageNameExists imgName
 RefreshGlobalImages
  get the keys of xos
  filter it with "stackimages,*"
  sort it
  repeat for each line thisstack in it
    if imgName is among the items of xos[thisstack]
    then return item 2 of thisstack
  end repeat
  return false
end ImageNameExists

on RefreshGlobalImages
  put the windows into wlist
  repeat for each line thisstack in wlist
    put the number of images in stack thisstack into imgcount
    if imgcount is not xos["stackimages",thisstack,"imgcount"] then
      put imgcount into xos["stackimages",thisstack,"imgcount"]
      repeat with x = 1 to imgcount
        put the properties of img x of stack thisstack into imgprops
        put imgprops["id"],imgprops["name"] into \
          line x of xos["images",thisstack]
      end repeat
    end if
  end repeat
end RefreshGlobalImages
</script>


You dont have to wait anymore for another rev release to do this and rev
doesn't have to waste their time on this one either. All in all we gained a
lot of time! 

Time is money, so i hope that each time this function doesn't return false,
you will be motivated to visit my paypal for that "if i had a penny each
time i crashed runrev because of an image id manipulation"...

;)

This script will be quickly incorporated into the xosmedialib for added
media management in RunRev via TAOO. Other sub-functions of this will be
added like liststackimages(All,<stackname>,<filter>) etc... 

XOSMediaLib manages images in the TAOO workflow world - it manages among
other things image ids, and names for a large library of images which are
used across the TAOO framework and templates or any stack opened. It also
manages icons and patterns whence you change an image id for example. It's
available on MonsieurX.com with the latest release notes in the
MonsieurX.com/forums.

Enjoy
Xavier
--
http://monsieurx.com/taoo - just flow with it



More information about the use-livecode mailing list