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

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


Hello Klaus!

Am 25.02.2006 um 19:00 schrieb metacard-request at lists.runrev.com:

> "relative" always means "relative to the current folder = the  
> directory"
>
> So if "the directory" is something like:
>
> Win
> C:/Folder1/subfolder2/the current project
> resp. Mac
> /Volumes/harddisk 1/Folder1/subfolder2/the current project
>
> and in this folder you have you folder with your images.
> Absolute path:
>
> Win
> C:/Folder1/ subfolder2 /the current project/the images
> resp. Mac
> /Volumes/harddisk 1/Folder1/subfolder2/the current project/the images
>
> You can simply script:
> ...
> import paint from file "the images/name of image.jpg"
> ...
>
> Or do you mean to set the filename like the "importer" stack does?
>
> In that case:
> ...
> set the filename of img "whatsoever" to "the images/name of image.jpg"
> ...
>
> That's it :-)
>
> Hope that helps.


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

In the stack-script I put this:

on preopenstack
   get the effective filename of this stack
   set the itemdel to "/"
   delete last item of it
   set the directory to it
   start using "libURL"
end preopenstack


perplexed
Reinhold



More information about the metacard mailing list