Page 1 of 1

set the defaultfolder to USB drive

Posted: Thu Jun 21, 2018 5:53 pm
by DavJans
I have built a simple game that looks in a folder of photos, randomly picks one and shows it to you with 4 name buttons. Its a great tool for us to learn peoples names and faces. I have however a need to get this game mobile but the thing with USB sticks is they don't always receive the same drive letter with different PC's.

Is there a way to check the file location of the app.exe when it opens and set the default directory to that location?

Re: set the defaultfolder to USB drive

Posted: Thu Jun 21, 2018 6:06 pm
by Klaus
And on the Mac you don't even have "drive letters"! :-D

You can always check "the filename of this stack" and strip out everything you don't need.

Code: Select all

...
set itemdel to "/"
## Windows
answer "Drive letter of this USB Stick:" && item 1 of the filename of this stack
## On a Mac:
answer "This volume is named:" & item 3 of the filename of this stack
...
However on a Mac you need to add "/Volumes/" before that name of the USB Stick:
/Volumes/MyStick

Re: set the defaultfolder to USB drive

Posted: Thu Jun 21, 2018 6:11 pm
by DavJans
Thank you, I will give that a shot. Also if anyone feels that this would be a useful tool Its very simple and took only a few hours to write back when I had no clue as to what I was doing with livecode, but I am more than wiling to share it with anyone so that you don't have to.

Re: set the defaultfolder to USB drive

Posted: Fri Jun 22, 2018 6:54 pm
by jacque
Have you tried accessing a USB drive from a mobile device? The last time I tried it you need special hardware adapters and software, at least on Android. I'm not sure how iOS handles it.