Picture DATA and how to show it
Thomas McGrath III
3mcgrath at comcast.net
Tue Apr 29 00:13:55 EDT 2008
I really need some help on this one!!!
So far I can get the artwork and read the result in AS, then again in
applescript I can write the hex to a file where it is now binary and
read that file in RR. It works but this is a sloppy solution as it is
Mac only for one and Applescript is doing all the work where I would
like RR to handle the encoding etc. Then I can make this a cross
platform solution.
Here is my applescript:
try
tell application "iTunes"
set my_Artwork to the (data of artwork 1 of track "One" of playlist
"U2") as picture
end tell
-- This sets the path to the pictures folder of iTunes
set file_path to (path to "pdoc" as string)
set file_name to (the file_path & "MyArtwork" & ".pict") as string
do shell script "cd " & (POSIX path of file_path) & " ;ls | grep \""
& "MyArtwork" & ".pict\" ; " & "echo '.'"
set shell_result to the result as string
open for access file_name write permission 1
copy the result to file_reference
-- Here is where I can write to the file as a picture, this
turns the data into binary
write myTrack starting at 0 to file_reference as picture
close access file_reference
-- here I return the file_name for Revolution to then set the
filename of image "Artwork" to the returned result
return file_name
end try
The problem with this is that I have to write to the users pictures
folder for one and that each time I access the script I am writing
over the previous file. I would like to just encode this and not write
to a file at all if possible.
What i would really like to do is either have RR open a file and write
to it the my_Artwork as a picture (thereby setting it to binary) or
better yet just have RR write to a custom Prop and encode that as
binary and set an image to that when done.
The new applescript would then look like this:
try
tell application "iTunes"
set my_artwork to the (data of artwork 1 of track "One" of
playlist "U2) as picture
return my_artwork
end tell
end try
I have done this and tried to encode the result in RR with no success.
I have tried every version of binaryEncode with no results and a lot
of force quits.
Does anyone here have some ideas on where to go from here?????
Thanks
Tom McGrath
On Apr 28, 2008, at 6:09 PM, Thomas McGrath III wrote:
> Mark et. al.
>
> Also if I use Applescript to write the Data to a pict file I
> actually get this:
> which looks like binary data and states it IS a png file after all.
>
> But I can't import this file to RR and have a picture come out. How
> do you recommend converting this from binary to an image?
>
> Ideas???
>
> Thanks
>
> Tom McGrath
More information about the use-livecode
mailing list