Picture DATA and how to show it

Mark Schonewille m.schonewille at economy-x-talk.com
Tue Apr 29 20:23:31 EDT 2008


Tom,

> copy the result to file_reference

should be:

copy shell_result to file_reference

It is really confusing that you use .pict as the file extension.

Assuming that you are writing a valid PNG file to disk, you can also  
return this to Revolution instead of the file name:

return shell_result -- applescript

-- revolution:
set rslt to the result
if not (rslt contains "error") then
   set the text of img "Your Image" to rslt
end if

If all this doesn't work, you might try to write the data to a file  
anyway and set the filename of a player to the path to that file,  
because it looks like QT knows how to handle the data.

Best regards,

Mark Schonewille

--

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Our servers may be off-line between 28 April and 1 May. If you have an  
urgent request, you can contact us at <economy.x.talk at gmail.com>.  
Apologies for any inconveniences.





On 29 apr 2008, at 06:13, Thomas McGrath III wrote:

> 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
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list