Clipboard and drop images

Jim MacConnell jmac at consensustech.com
Mon Mar 15 13:13:50 EST 2004


Ken,

Haven't worked on a utility as it's easy to build...
The following is part of a field script I use to drag & drop info into a
field... (Not exactly as used as I adjusted it for clarity after pasting it
in here and may well have screwed it up.... YMMV... )

This seemed to always work for files but...
When I try to drag images from a Word document into the field I have 25 -
35% success. Problems I've had:
1) the images come in pixilated.... Like Rev is trying to adjust resolution;
2) The image comes in blank after I drag more than 2 or 3 images in. I
assume there is a  memory issue but haven't had time to chase it;
3) Imported "pictures" have their light areas changed to transparent more
often than not (which is why I adjust alphaData);
4) Strangely... Word elements like imported tables, imported PowerPoint
charts, etc. come in fine even if other stuff doesn't.

Any clues from others about what could be screwing up the image drop from
Word would greatly be appreciated.

Jim


= = = = = = =
on dragDrop
  -- handle dropped data

  -- If it appears to be text then put it in that way
  if the dragData["text"] is not empty then
    put the dragData["text"] into rawData
    put return & "- - - - -" & return & rawData after me

  else
    -- Since it doesn't seem to be text, treat it like an image

    -- If it isn't an image then bail
    if the dragData["image"] is not empty then

      -- Create an empty image, get its ID and put the dragData into it
      create invisible image
      put the ID of it into currentImage

      -- create an easy to use name for the image
      put the number of images of this card into imageNum
      put "Image_" & imageNum into imageName
      set the name of image ID currentImage to imageName

      -- create an easy to use name for the image
      put the dragData["image"] into image imageName

      -- As the pictures are coming in w/ transparency, make them opaque
      set the alphaData of image imageName to 255

      -- Insert a separator and the "special" character
      -- assign the image ID to the special character
      put return & "- - - - -" & return & "|" after the last line of me
      set the imageSource of char -1 of me to currentImage
      
    end if
  end if
  set the vScroll of me to the textHeightSum of me
end dragDrop

-- 
James H. MacConnell
Consensus Technology, LLC



More information about the use-livecode mailing list