Page 1 of 1

Saving To A Text File - Android

Posted: Mon Dec 07, 2015 2:38 am
by Googie85
I am having some issues with saving to a file on an Android device.

I have tried the following:

put "binfile:" & specialFolderPath("engine") & slash & "bell.txt" into textgoal
put "Testing 123" into URL textgoal

Also:

open file textgoal for text
write "Testing 123" to file textgoal
close file testgoal

If anyone could help with this I would be forever greatful...

Many Thanks,

Matthew.

Re: Saving To A Text File - Android

Posted: Mon Dec 07, 2015 3:13 am
by Simon
Hi Matthew,
Not sure if this will solve your problem but;

Code: Select all

put "binfile:" & specialFolderPath("engine") & slash & "bell.txt" into textgoal
--should be
put ("binfile:" & specialFolderPath("engine") & slash & "bell.txt") into textgoal
and you cannot write to specialFolderPath("engine") you should use specialFolderPath("documents") if you want to record a file.

Simon

Re: Saving To A Text File - Android

Posted: Mon Dec 07, 2015 3:19 am
by Googie85
I'm unsure how I would save a .txt file to the documents folder instead of engine...

Many Thanks,

Matthew.

Re: Saving To A Text File - Android

Posted: Mon Dec 07, 2015 3:32 am
by Simon
oops made a little mistake above;

Code: Select all

put URL("binfile:" & specialFolderPath("engine") & slash & "bell.txt") into textgoal
and to write

Code: Select all

put textgoal into URL("binfile:" & specialFolderPath("documents") & slash & "bell.txt") 
ooops ooops!
If bell.txt is really a text file then it's just URl("file:"... not URL("binfile:"...
Text is not a binary file.

Simon

Re: Saving To A Text File - Android

Posted: Mon Dec 07, 2015 8:33 am
by SparkOut
Just for clarity:

specialFolderPath("documents") is a writable location, sandboxed to be accessible only to the app. Other apps will have their own sandboxed documents folder. It is not a generally accessible folder for any and all user documents. The specialFolderPath folders are automatically accessible to you app, but the names are case sensitive (ie lower case only) on mobile (mixed case is OK on desktop, and the paths have different destinations - on desktop "documents" really does mean the user documents folder).

Re: Saving To A Text File - Android

Posted: Mon Dec 07, 2015 2:19 pm
by Klaus
Hi Matt,

please spread the word: the ENGINE folder is TABOO for writing! :D
I'm unsure how I would save a .txt file to the documents folder instead of engine...
We have a specialfolderpath() for both of these, please take a look in the dictionary!


Best

Klaus