No subject

Mark Schonewille m.schonewille at economy-x-talk.com
Mon Jul 25 07:29:40 EDT 2011


Hi ...,

Your scripts looks correct, but you got some small mistakes in your script, which might make it fail. I also think your could improve your scripting style to make it more readable, which will help you to avoid mistakes. You set the defaultFolder for no apparent reason. References to card fields are a relic from the HyperCard days and I can't imagine you need that for iOS apps.

The tendency of programmers to use non-human-like language for object names really drives me more than nuts. LiveCode allows for spaces in object and file names. Use them!

-- write
put specialFolderPath("documents") & "/Defaults" into myPath
// I don't know whether you need the next line, just let's be sure it exists
if not (there is a folder myPath) then create folder myPath
// mind that LiveCode allows for readable object names.
// The same applies to files names. Use spaces!!!
put myPath & slash & "Students Group" && the hilitedLines of fld "Group Theme Titles" into myFile
open file myFile for write
write fld "Students" to file myFile
close file myFile

The read script is almost the same, using read from instead of write to. Note that I'm not using the defaultFolder because there is no need for it.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

What does that error mean? Buy LiveCodeErrors for iPhone now http://qery.us/v4 A must-have for LiveCode programmers. 





On 25 jul 2011, at 04:35, <gwendalwood at cox.net> <gwendalwood at cox.net> wrote:

> I did figure out how to get to writing and reading files on ios, but on my 
> second app it does not work. I still can't figure out how to print from inside 
> ios on the iPad 2. I think maybe it can't be done yet. 
> I forgot to tell you my results. I get nothing in the variable it or the variable results
> Following is my code snippets for files: 
> ************** 
> --write 
>  getPathsFromFile 
>   put specialfolderpath("documents") into temppath 
>   set defaultfolder to temppath 
>   put temppath&"/Defaults" into newtempath 
>   set defaultfolder to newtempath 
>   put the hilitedlines of cd fld "GroupThemeTitles" into grpCount 
>   put "StudentsGroup"&grpCount into temp1 
>   open file temp1 for write 
>   write cd fld "Students"  to file temp1 
>   close file temp1 
> 
> -- read 
>   put specialfolderpath("documents") into temppath 
>         set defaultfolder to temppath 
>      put temppath&"/Defaults" into newtempath 
>      set defaultfolder to newtempath 
>   put the hilitedlines of me into newgroup 
>   put "StudentsGroup"&newgroup into temp1 
>   open file temp1 for read 
>      read from file temp1  until eof 
>      put it  into cd fld "Students" 
>      put the number of lines in it into studentcount 
>   close file temp1 
> 
> 
> **************
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list