Help with Saving File needed

101 views
Skip to first unread message

Leman Kendrick

unread,
Mar 27, 2025, 6:19:54 PMMar 27
to DroidScript
I am having problems trying to save a file in a location where I can later access it. I am developing a simple app that downloads a .csv file that is then rearranged and saved as another file. I need to be able to access the rearranged file so it can be imported into another app. I have been playing with the code below but I can't find the location of the file that it should create. Any guidance would be greatly appreciated!!!!

function OnStart()
{
   
    //var myPath = app.GetInternalFolder()
    var myPath = app.GetExternalFolder()
    var myFile
    myFile = myPath + "/myFileText.txt"
   
    app.WriteFile( myFile, "Hello World from Write\n", "Append" );
    var txt = app.ReadFile(myFile);
    alert("txt= " + txt + " ....myFile " + myFile)
    var length = txt.split("\n").length;
    app.ShowPopup("myFile contains " + length + " lines");
}

On another note, I seem to remember a post about purchasing a lifetime subscription for $99. I currently subscribe monthly. if the lifetime subscription is available, how doI purchase it?

Thanks in advance

Alan Hendry

unread,
Mar 27, 2025, 7:00:56 PMMar 27
to DroidScript
HI,
If you use
 app.GetSpecialFolder("downloads")+"/folder/file.txt"
or "documents" it should write a txt file to a top level folder
in your internal storage
(parameter pictures/movies/music for images/videos/sounds)
Regards, ah

Alan Hendry

unread,
Mar 27, 2025, 7:09:01 PMMar 27
to DroidScript
HI,
If you don't get an answer here about subscriptions 
then you could email support
Regards, ah

Dave

unread,
Mar 28, 2025, 9:22:45 AMMar 28
to DroidScript
You may find that on very recent versions of Android you can't even access the downloads folder (due to security changes in Android).  If that is the case, you should check out the "Storage Access" sample and see how to ask the user for permissions to access certain folders that are outside your apps, 'scoped storage' area.  Once your app has permission granted to access a folder (eg the Documents folder or a sub-folder Documents), your app can permanently use that folder to save files.

Leman Kendrick

unread,
Apr 3, 2025, 12:21:39 AMApr 3
to DroidScript
Thanks for the insights. After a lot of testing, I was able to write to the file using the GetSpecialFolder. I'm sure this issue was due to scoped storage. I really appreciate the quick responses....this Group is very helpful to a newbie like myself. I really appreciate the gudance/

Leman


Reply all
Reply to author
Forward
0 new messages