set the defaultfolder to USB drive

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
DavJans
Posts: 270
Joined: Thu Dec 12, 2013 4:21 pm
Location: Spokane, WA USA

set the defaultfolder to USB drive

Post by DavJans » Thu Jun 21, 2018 5:53 pm

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?
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

Klaus
Posts: 13820
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: set the defaultfolder to USB drive

Post by Klaus » Thu Jun 21, 2018 6:06 pm

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

DavJans
Posts: 270
Joined: Thu Dec 12, 2013 4:21 pm
Location: Spokane, WA USA

Re: set the defaultfolder to USB drive

Post by DavJans » Thu Jun 21, 2018 6:11 pm

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.
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7228
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: set the defaultfolder to USB drive

Post by jacque » Fri Jun 22, 2018 6:54 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”