How to store some data in my stack
吉野 孝
yoshino at sys.wakayama-u.ac.jp
Wed Jan 25 10:56:43 EST 2012
Hi, Klaus
Thank you for your quick reply!
I changed my script, but it does not work on an android.
(It does work on my mac.)
The following are the test script.
(URL is very easy! thanks)
- Write button
on mouseUp
put fld "Data" into URL("file:" & specialFolderPath(“documents”) & "/" & “testFile.txt”)
put the result into fld "msg"
end mouseUp
- Read button
on mouseUp
put URL("file:" & specialFolderPath(“documents”) & "/" & “testFile.txt”) into fld "Data"
put the result into fld "msg"
end mouseUp
# "/" -> ":"(mac)
On my mac, those scripts work well.
But, on my android, "can't open file" is shown in field "msg"
On 2012/01/26, at 0:33, Klaus on-rev wrote:
> Konichi-wa Takashi,
>
> Am 25.01.2012 um 16:19 schrieb 吉野 孝:
>
>> Hi,
>>
>> I use LiveCode 5.0.2 for Android devices.
>>
>> I would like to store some data in my stack.
>> But I don't know how to store some data in my stack on an android device.
>>
>> At first, I used a field. But the field data is gone at the next launches.
>>
>> Next, I tried to use file.
>> The following are the test scripts.
>>
>> This is the 'write file' script.
>> on mouseUp
>
> ## : is the Mac specific path delimiter, and will obviously work on a Mac but nowhere else ;-)
>
> ## So ALWAYS use the SLASH as pathdelimiter on ALL platforms:
>> ## put specialFolderPath(“documents”) & ":" & “testFile.txt” into fileName
> put specialFolderPath(“documents”) & "/" & “testFile.txt” into fileName
>> open file fileName
>> write fld "Data" to file fileName
>
> ## If you do not psecify a TARGET (like a filed) for the PUT,
> ## the output will go into the message box
> ## which is not available on ANDROID and iOS!
>> put the result
>> close file fileName
>> end mouseUp
>>
>> This is the 'read file' script
>> on mouseUp
>
> ## Same here, will work with a SLASH!
>> put specialFolderPath(“documents”) & "/" & “testFile.txt” into fileName
>> open file fileName
>> read from file fileName until EOF
>> put it into fld "Data"
>> close file fileName
>> end mouseUp
>>
>> The scripts work on my Mac.
>> But they does not work on an Android device.
>
> See above for the explanation :-)
>
> Hint: you can save some typing by using the short URL syntax (a one-liner):
> ...
> put URL("file:" & specialFolderPath(“documents”) & "/" & “testFile.txt”) into fld "Data"
> ...
>
> Check URL in the dictionary!
>
>> I need your help.
>
> Now you got it :-)
>
>> _.__ ._ _. ._ ._.__ .. ._._. _._ . ..__ ._.__ ._._. ___. .._ __.. __ .._
>> Takashi Yoshino
>
> Best
>
> Klaus
>
> --
> Klaus Major
> http://www.major-k.de
> klaus at major.on-rev.com
>
>
> _______________________________________________
> 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
_.__ ._ _. ._ ._.__ .. ._._. _._ . ..__ ._.__ ._._. ___. .._ __.. __ .._
Takashi Yoshino
http://www.wakayama-u.ac.jp/~yoshino/lab/
Tel: +81-73-457-8441
More information about the use-livecode
mailing list