I see. You will need to use the full path for tImageName. That will be true for 
all of the file names you have stored on your cards and stacks. 

With images, the filename can be either the full path or a relative path, 
relative to the defaultFolder or the folder the stack is saved in. RevCopy only 
assumes names without full paths to be relative to the defaultFolder, not the 
stack location. RevCopy is definitely better when on desktop systems. 

One way to only see full paths is by turning on ‘Always use absolute file paths 
for images’ in the Files & Memory section of the main LC prefs. Or you could 
set the defaultFolder to specialFolderPath(“resources”) if you would prefer to 
keep relative paths in the file lists. 

Relying on ‘item n1 to n2’ for working out the origin path is not always going 
to be right, especially if you have been using relative paths in your script. 
Best to use full paths for both tImageName and tDestinationPath. 

Just make sure there wasn’t a space after ‘ellora’ as in your sample.

I’m confident you will work this out. As you said, it can’t be hard :) It is 
working fine using both methods here so I’m sure it’s going to be something 
simple you end up kicking yourself about. 

All the best. 

> On 7 Sep 2020, at 15:11, Sannyasin Brahmanathaswami via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> Goal: to get a folder a disk that can be copied to the web server. We have 
> all kinds of files on disk. So, I am trying to copy a list of filename in the 
> cards of stack. It can't that hard. But I think the method for doing the 
> tRelativeName of filename is "broken" where are get the defaultFolder.
> 
> So I tried this. As it as simple as revCopyFile (as I discovered in that 
> dictionary)
> 
> But this don't work!
> 
> on mouseUp
>   local tImageName, tDestinationPath, tDefaultFolder
>   get the effective filename of this stack
>   set the itemdelimiter to "/"
>   put item 1 to -2 of it into tDefaultFolder
> 
>   set the defaultFolder to tDefaultFolder 
>   put the  defaultFolder
>   # it appears correct
> 
>   --put the filename of img "slideImage" into tImageName
> 
>   put "ellora /DC123344.jpg" into tImageName
>   put   "_ForWebSite" into tDestinationPath
> 
>   revCopyFile tImageName, tDestinationPath
> 
> end mouseup
> 
> # I'm against the wall on this!
> ____________
> # but directed at your attempt did not work 
> # as expected, no file was written
> 
> # a new attempt at your email was expecting
> # but the defaultFolder was entirely different!
> 
> on mouseUp
>   local tRelativeURL
> 
>   set the itemdelimiter to "/"
>   put (the item -2 to -1 of the filename of img "slideimage" ) into 
> tRelativeURL
>   # this works is: there is a path
>   # 1-ellora/dsc1234.jpg
> 
>   # this will work
>   Set the defaultFolder to item 1 to -3 of the filename of img "slideimage"
>   put the defaultFolder
> # a defaultFolder appeared that was older
> 
>     put URL("binfile:" & tRelativeURL ) into URL("binfile:_ForWebSite/"& 
> tRelativeURL)
> 
> end mouseUp
> 
>  Pi Digital wrote:
> 
>    I’ll try that again::
> 
>    # I’m going to assume this was a hiccup too and now fixed:
>      set the filename of img “slideimage” to (item 1 to -3 of the filename of 
> img “slideimage” & “/_ForWebSite/” & tRelativeURL)
> 
>> On 6 Sep 2020, at 23:01, Pi Digital via use-livecode 
>> <use-livecode@lists.runrev.com> wrote:
>> 
>> # I’m going to assume this was a hiccup too and now fixed:
>>  set the filename of img “slideimage” to URL(“binfile:_ForWebSite/” & 
>> tRelativeURL)
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to