How to generate the relative path in an import-paint-script?

Reinhold Venzl-Schubert r.venzl-schubert at t-online.de
Mon Feb 27 11:07:45 CST 2006


Hi Klaus and all that red my inquiry,

I found the answer myself :-)

> I tried vainly what you wrote.
> Here is my script. I hope you can find the mistake:
>
>
> on mouseUp
>
>    answer file "Please select an image:"
>    put it into ImportPicture
>
>    if ImportPicture is empty then
>      answer "You did not select an image."
>      exit mouseup
>    end if
>
>    set the itemDel to "/"
>    get the effective filename of stack "Testloader"
>
>    put it into MediaFolder
>    delete last item of MediaFolder
>    put "/Media" after MediaFolder
>
>    put item -1 of Importpicture into ImpPict
>
>    put url ("binfile:" & ImportPicture) into url ("binfile:" &
> MediaFolder & "/" & ImpPict)
>
> ## Now the image is in the Media-Folder
>
> ## 1. advice with tree vain trails:
>
>    import paint from file "MediaFolder/ImpPict"
>    import paint from file "Media/ImpPict"
>    import paint from file (Media & "/" & ImpPict)
>
>   ## 2. advice
>
>    import paint from file Importpicture
>    set the filename of img ImpPict to "Media" & "/" & ImpPict
>
> end mouseUp

I forgot to set the directory. My script may be not perfect but it do  
what it have to do ;-)


on mouseUp

   answer file "Please select an image:"
   put it into ImportPicture

   if ImportPicture is empty then
     answer "You did not select an image."
     exit mouseup
   end if

   set the itemDel to "/"
   put the effective filename of stack "Testlader" into MediaFolder1

   put Mediafolder1 into Mediafolder2
   delete last item of MediaFolder2

   put Mediafolder2 into Mediafolder3
   put "/Media" after MediaFolder3

   put item -1 of Importpicture into ImpPict

   put ImportPicture into IstOrt
   delete last item of IstOrt

   if Mediafolder3 is not IstOrt then
     put url ("binfile:" & ImportPicture) into url \
         ("binfile:" & MediaFolder3 & "/" & ImpPict)
   end if

   set the directory to MediaFolder2

   import paint from file Mediafolder3 & "/" & ImpPict

   set the fileName of img ImpPict to "Media" & "/" & ImpPict

end mouseUp

Thanks for your effort
Reinhold


More information about the metacard mailing list