Files and Folders
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Files and Folders
I have a question that is probably going to be trivial when answered, but it has me stumped. I've found lots of information, but have unable to put it together to solve my problem.'
The bottom line is that I want to write a text file to the Android phone and the retrieve it with windows explorer via usb, or any of the other bluetooth, wifi, etc. connectivity.
For example, I can read and write my file to the specialfolderpath("documents"), but I can't find the folder, much less the text file using Windows Explorer with the Android linked via usb.
On the other hand, I can easily read the folders and files on the sd card with Windows Explorer, but I can't find the right syntax to write a file to the sd card from the Android! I have tried every way I can think of the set the default folder to the sd card root, or a folder within, without success. It would seem that if I could do this, then I could write to a folder on the sd card and retrieve the file with Windows. Or, if I could find the specialfolders ("cache" or "documents") with Windows, then I could retrieve it that way.
So, can anyone spell it out for me how I go about putting information gathered with my app to somewhere on the Android so that it can be accessed for use by my desktop computer.?
A solution would be much appreciated.
Thanks, Gene
The bottom line is that I want to write a text file to the Android phone and the retrieve it with windows explorer via usb, or any of the other bluetooth, wifi, etc. connectivity.
For example, I can read and write my file to the specialfolderpath("documents"), but I can't find the folder, much less the text file using Windows Explorer with the Android linked via usb.
On the other hand, I can easily read the folders and files on the sd card with Windows Explorer, but I can't find the right syntax to write a file to the sd card from the Android! I have tried every way I can think of the set the default folder to the sd card root, or a folder within, without success. It would seem that if I could do this, then I could write to a folder on the sd card and retrieve the file with Windows. Or, if I could find the specialfolders ("cache" or "documents") with Windows, then I could retrieve it that way.
So, can anyone spell it out for me how I go about putting information gathered with my app to somewhere on the Android so that it can be accessed for use by my desktop computer.?
A solution would be much appreciated.
Thanks, Gene
Re: Files and Folders
You might look at this post http://forums.runrev.com/viewtopic.php? ... ard#p52707
and as well, this stack http://dl.dropbox.com/u/11957935/filebrowser.livecode should let you click around through your file system (starting at specialfolderpath("engine") which due to the sandbox is basically /)
Can't interact with the files, but clicking the folders in the left pane will let you look around the file system.
You'll also need to make sure the "write external storage" is checked in the android standalone settings. there is probably an sdcard folder as well as a mnt/sdcard folder (as indicated in the posts linked above) If both exist they should be one and the same. (sdcard as a symboilic link to /mnt/sdcard)
and as well, this stack http://dl.dropbox.com/u/11957935/filebrowser.livecode should let you click around through your file system (starting at specialfolderpath("engine") which due to the sandbox is basically /)
Can't interact with the files, but clicking the folders in the left pane will let you look around the file system.
You'll also need to make sure the "write external storage" is checked in the android standalone settings. there is probably an sdcard folder as well as a mnt/sdcard folder (as indicated in the posts linked above) If both exist they should be one and the same. (sdcard as a symboilic link to /mnt/sdcard)
Re: Files and Folders - PROBLEM SOLVED
sturgis - thank you for responding. I was beginning to think I was going to be stumped on this. Actually, the answer hit me after I decided to give it a rest and head for the grocery store. Isn't that the way it always happens?sturgis wrote:You might look at this post http://forums.runrev.com/viewtopic.php? ... ard#p52707
and as well, this stack http://dl.dropbox.com/u/11957935/filebrowser.livecode should let you click around through your file system (starting at specialfolderpath("engine") which due to the sandbox is basically /)
Can't interact with the files, but clicking the folders in the left pane will let you look around the file system.
You'll also need to make sure the "write external storage" is checked in the android standalone settings. there is probably an sdcard folder as well as a mnt/sdcard folder (as indicated in the posts linked above) If both exist they should be one and the same. (sdcard as a symboilic link to /mnt/sdcard)
It's so elementary, I kicked myself. The reason I couldn't find the right syntax to read the contents of the sdcard was that I was loading the app on my device using the usb connection. Fine - except that while the device is connected, the sdcard is disabled - hence, trying to read the contents was obviously futile with the usb connection still active.
When I loaded the app on the device, then unplugged the usb, and waited for the status bar notification to indicate, "preparing internal storage," then I was able use the app to work to the sdcard any way I wanted. The ultimate goal was to proceed to create a directory, and write a text file to it. This, of course, fell into place once I verified the syntax and ability to at least see the sdcard from the app.
Also, you were right, I didn't have the standalone option ticked for writing to external storage. I don't think that would affect the ability to read the external storage, but I think it would have given me additional fits when I went on to trying to create my text file. Fortunately, you stopped the fits before they got started with your advice to look at the external storage option.
The file explorer link you sent is interesting, and I intent to explore the code for whatever I can learn from it. I also looked at the link you provided to a previsous posting (I don't know how I missed it), which brought up basically the same question. However, the thread seemed to trail off without resolution. Even though it's an old link, I'm tempted to reply to it anyway with what I learned.
It's all good now, and I really appreciate the tips.
- Gene
Re: Files and Folders
Glad you got it figured out. That link I sent was mostly just showing where the sdcard folder should show up.
As for the file explorer, theres almost nothing to it (shoved together as quick as I could) so not sure you'll get much otu of it. Mostly I just use it to poke around the filesystem and see whats what. (and hoped it might help you locate the sdcard folder)
Also glad to know the sdcard won't show when usb is plugged in. Thats yet another thing I didn't know!
As for the file explorer, theres almost nothing to it (shoved together as quick as I could) so not sure you'll get much otu of it. Mostly I just use it to poke around the filesystem and see whats what. (and hoped it might help you locate the sdcard folder)
Also glad to know the sdcard won't show when usb is plugged in. Thats yet another thing I didn't know!
Re: Files and Folders
When I bleed off some of my eagerness to press forward with the app, I'm going to try this whole exercise using the simulator and see what that looks like. I usually don't use the simulator because it is so slow to load, and I get more comfort out of testing on a physical device.
One last thing - I lied about the grocery store. I went to the pub. I have logged it as a two beer problem.
One last thing - I lied about the grocery store. I went to the pub. I have logged it as a two beer problem.
Last edited by Gene on Wed Jun 27, 2012 1:40 am, edited 1 time in total.
Re: Files and Folders
a 2 beer problem isn't bad at all. If it turns into a vodka problem let me know.
Re: Files and Folders
Hi, I downloaded the stack.. but when I open this stack in Livecode 5.0.2 then it does not open. and says that it is not an valid stack.
I would be very much interested in viewing this stack code as it would help to understand the files and folder system.. please provide me the version which i can use on 5.0.2
thanks
pradeep
I would be very much interested in viewing this stack code as it would help to understand the files and folder system.. please provide me the version which i can use on 5.0.2
thanks
pradeep
sturgis wrote:You might look at this post http://forums.runrev.com/viewtopic.php? ... ard#p52707
and as well, this stack http://dl.dropbox.com/u/11957935/filebrowser.livecode should let you click around through your file system (starting at specialfolderpath("engine") which due to the sandbox is basically /)
Can't interact with the files, but clicking the folders in the left pane will let you look around the file system.
You'll also need to make sure the "write external storage" is checked in the android standalone settings. there is probably an sdcard folder as well as a mnt/sdcard folder (as indicated in the posts linked above) If both exist they should be one and the same. (sdcard as a symboilic link to /mnt/sdcard)
Re: Files and Folders
Try it now, its saved as a legacy stack, so re-download and give it a shot. Worst case i'll post the code. (its ultra simple would need lots of fleshing out to be a "real" file browser.)
In fact, heres the script. (set up a card with 2 scrolling list fields)
In the card script put this:
In the field that will contain the folders (field 1) put this script:
In fact, heres the script. (set up a card with 2 scrolling list fields)
In the card script put this:
Code: Select all
on opencard
set the width of field 1 to the width of this card / 2 --these lines just set things to use the whole screen
set the width of field 2 to the width of field 1 --no rotation code, just bare minimum
set the height of field 1 to the height of this card
set the height of field 2 to the height of this card
set the topleft of field 1 to the topleft of this card
set the topright of field 2 to the topright of this card
fillfilesfolders --this fills the 2 fields with files and folders based on default folder.
end opencard
command fillfilesfolders --see above.
put the folders into field 1
put the files into field 2
end fillfilesfolders
Code: Select all
on mouseup
set the defaultfolder to the defaultfolder & "/" & the clicktext --changes the default folder based on the clicktext from field 1
fillfilesfolders --refresh the fields.
end mouseup
pkmittal wrote:Hi, I downloaded the stack.. but when I open this stack in Livecode 5.0.2 then it does not open. and says that it is not an valid stack.
I would be very much interested in viewing this stack code as it would help to understand the files and folder system.. please provide me the version which i can use on 5.0.2
thanks
pradeep
sturgis wrote:You might look at this post http://forums.runrev.com/viewtopic.php? ... ard#p52707
and as well, this stack http://dl.dropbox.com/u/11957935/filebrowser.livecode should let you click around through your file system (starting at specialfolderpath("engine") which due to the sandbox is basically /)
Can't interact with the files, but clicking the folders in the left pane will let you look around the file system.
You'll also need to make sure the "write external storage" is checked in the android standalone settings. there is probably an sdcard folder as well as a mnt/sdcard folder (as indicated in the posts linked above) If both exist they should be one and the same. (sdcard as a symboilic link to /mnt/sdcard)