Page 1 of 1

Copy file

Posted: Tue Aug 28, 2012 8:18 am
by Neurox66
Hi,
I'm crazy out with this code :-(
My code is attempt to copy the text file from "engine folder" to "Documents folder" but
in my Iphone 4 the message is ever "File not found".
Any hints ?

Code: Select all

on preOpenStack
      if the environment is "mobile" then
         put "file:" & specialFolderPath("engine") & "/dati.txt"  into vEngine
         put "file:" & specialFolderPath("documents") & "/dati.txt"  into vDocuments
         if there is a file url vDocuments then
            answer "The file is present, step 1"
            put url vDocuments into fDocuments
            if fDestinazione is empty then
               answer "The file is present but is empty, step 1.1"
               put url vEngine into fDocuments
               put  fDocuments into url vDocuments 
               close file vDocuments
            else
               answer "The file is present and is not empty step 1.2"
            end if
         else
            answer "The file not found, step 1.3"
            put url vEngine into fDestinazione
            put  fDocuments into url vDocuments 
            close file vDocuments
         end if
         
         //New check
         wait 25 milliseconds with messages
         if not (there is a file url vDocuments) then answer "The file not found Step 2"
            
      try
      catch pErr
         answer pErr
      end try
   end if
   
end preOpenStack

Re: Copy file

Posted: Tue Aug 28, 2012 8:31 am
by Dixie

Code: Select all

on preOpenStack
   put specialFolderPath("documents") & "/dati.txt" into documentFilePath
   if there is not a file documentFilePath then
      put URL("file:" & specialFolderPath("engine") & "/dati.txt") into URL("file:" & specialFolderPath("documents") & "/dati.txt")
   end if
end preOpenStack
be well,

Dixie

Re: Copy file

Posted: Tue Aug 28, 2012 8:50 am
by Neurox66
Hi Dixie,
your code go very well :D
Thank you!

Paolo

Re: Copy file

Posted: Tue Aug 28, 2012 11:15 am
by Klaus
Hi Neurox66,

1. welcome to the forum :D
2. Check these stacks to get the basics of Livecode:
http://www.runrev.com/developers/lesson ... nferences/ 8)


Best

Klaus