How to export the images of a stack

Dave Cragg dcragg at lacscentre.co.uk
Thu Aug 18 06:12:33 CDT 2005


On 18 Aug 2005, at 11:23, Klaus Major wrote:

> Hi Reinhold.
>
>
>> Hello Dave!
>>
>>>>   repeat with i = 1 to num of lines in ImagePath
>>>>     put line i of ImagePath into ImageName
>>>>     repeat with k = 1 to 6
>>>>       delete char 1 of ImageName
>>>>     end repeat
>>>>     put url ("binfile:" & "ImagePath") into url ("binfile:Export/
>>>> ImageName")
>>>>   end repeat
>>>>
>>>>
>>> Try this:
>>> put url ("binfile:" & ImageName) into url ("binfile:Export/" &
>>> ImageName)
>>>
>> I tried as you suggested. The copies of the file has the correct  
>> name but they are empty (0 Bytes).
>>
>> :-(
>>
>
> sounds like there are no files with/in the name/path -> ImagePath,
> so you end with empty (bin)files...
>
> Please doublecheck ImagePath/ImageName!
>
> Try:
> ...
> answer (there is a file ImageName)
> ## should be -> true

As always, I fully agree with Klaus.

Looking back at an earlier mail, I see the possible problem. You say  
the imagePath variable contains a list of files like this:

Media/StrainUndef.jpg
Media/StrainTriaxOblat1.jpg
Media/StraintriaxOblat2.jpg
Media/DeformStrain.jpg
Media/DeformTrans.jpg
Media/DeformRotat.jpg

I assume the current defaultFolder is the folder where the "Media"  
folder is contained. Your script deletes the folder name to get the  
filename. But then the path to the original file is wrong. This  
should be better:

   set the itemDel to "/"
   repeat with i = 1 to num of lines in ImagePath
     put line i of ImagePath into ImagePathName
     put item -1 of ImagePathName into ImageFileName
     if there is a file ImagePathName then
        put url ("binfile:" & ImagePathName) into url  
("binfile:Export/" & ImageFileName)
     else
         answer "No such file." & return & ImagePathName
     end if
   end repeat

Cheers
Dave


More information about the metacard mailing list