get name of flashdrive.

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

CAsba
Posts: 413
Joined: Fri Sep 30, 2022 12:11 pm

get name of flashdrive.

Post by CAsba » Fri Apr 12, 2024 9:46 am

Hi all,
Is it possible to get the name of the USB stick that a livecode stack is on and put it into a field within the stack ?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10013
Joined: Wed May 06, 2009 2:28 pm

Re: get name of flashdrive.

Post by dunbarx » Fri Apr 12, 2024 3:04 pm

Casbah

There is a function, "the volumes" that returns all mounted, er, volumes. Identifying a particular volume that happens to contain the name of a certain liveCode stack is another task.

But if you are already looking for a stack with a certain name, then why do you need to find it somewhere? Why not just put that name into the field?

There is more here, eh?

Craig

CAsba
Posts: 413
Joined: Fri Sep 30, 2022 12:11 pm

Re: get name of flashdrive.

Post by CAsba » Fri Apr 12, 2024 5:03 pm

Hi,
I'm trying to make a security measure (of sorts). Basically, I have a stack on a USB stick. This can be copied, so, to try to stop that, I want the stack to run after checking a field, the contents of which match the name of the USB stick, and if there is no match, the stack won't run. So I have to find a way that the stack can check if the name of the USB stick it's copied to will match. For that to happen the stack must have some code that will get the name of the USB stick, if there is a name.

A simple task for you, surely ?? (being ironical here).

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7320
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: get name of flashdrive.

Post by jacque » Fri Apr 12, 2024 5:19 pm

The filename of the stack should include the volume name.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

CAsba
Posts: 413
Joined: Fri Sep 30, 2022 12:11 pm

Re: get name of flashdrive.

Post by CAsba » Fri Apr 12, 2024 6:41 pm

Hi Jacque,
Thanks, but - I'm a bit lost..What's a volume name? and how would it work (in simple logic terms, if that's possible..)

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7320
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: get name of flashdrive.

Post by jacque » Fri Apr 12, 2024 9:14 pm

CAsba wrote:
Fri Apr 12, 2024 6:41 pm
Hi Jacque,
Thanks, but - I'm a bit lost..What's a volume name? and how would it work (in simple logic terms, if that's possible..)
Put this in a button or handler in your stack:

Code: Select all

put the filename of this stack
Then look at the response in the message box. The volume name is the disk name. If the name of the flash drive is in the response then it's your flash drive.

In the real script you'd get the filename and check if the right name is in there without using the message box of course.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

CAsba
Posts: 413
Joined: Fri Sep 30, 2022 12:11 pm

Re: get name of flashdrive.

Post by CAsba » Fri Apr 12, 2024 10:45 pm

Many thanks, Jacque, It's a bit late now, but I'll try it tomorrow (if circumstances allow..).
Once again, many thanks.

SparkOut
Posts: 2896
Joined: Sun Sep 23, 2007 4:58 pm

Re: get name of flashdrive.

Post by SparkOut » Sat Apr 13, 2024 7:06 am

There is a very old thread on the topic of interrogating volumes on Windows.
I don't know whether any of it still applies.
viewtopic.php?t=2357&start=0

CAsba
Posts: 413
Joined: Fri Sep 30, 2022 12:11 pm

Re: get name of flashdrive.

Post by CAsba » Sat Apr 13, 2024 10:30 am

Hi Jacque,
I tried that - it's exactly what's needed, so my heartfelt thanks to you.
Thanks also to the other contributors for their kind concern.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9960
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: get name of flashdrive.

Post by FourthWorld » Sat Apr 13, 2024 7:36 pm

Does Windows now identify volumes by name rather than letter designation?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

SparkOut
Posts: 2896
Joined: Sun Sep 23, 2007 4:58 pm

Re: get name of flashdrive.

Post by SparkOut » Sun Apr 14, 2024 12:00 am

Windows has always used volume names. Those volumes may or may not be assigned a drive letter.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10013
Joined: Wed May 06, 2009 2:28 pm

Re: get name of flashdrive.

Post by dunbarx » Mon Apr 15, 2024 12:01 am

Jacque.

Always impressed by your LC knowledge.

The "filename of stack". Really. What will they think of next??

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9960
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: get name of flashdrive.

Post by FourthWorld » Mon Apr 15, 2024 6:37 am

SparkOut wrote:
Sun Apr 14, 2024 12:00 am
Windows has always used volume names. Those volumes may or may not be assigned a drive letter.
In file paths, such as the value returned from "the long name of this stack"?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

SparkOut
Posts: 2896
Joined: Sun Sep 23, 2007 4:58 pm

Re: get name of flashdrive.

Post by SparkOut » Mon Apr 15, 2024 8:09 am

That wasn't what I was answering. Windows uses volume names for drive referencing (by humans). LiveCode returns a resolved file path on Windows which invariably has a drive letter.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9960
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: get name of flashdrive.

Post by FourthWorld » Mon Apr 15, 2024 8:35 am

SparkOut wrote:
Mon Apr 15, 2024 8:09 am
That wasn't what I was answering. Windows uses volume names for drive referencing (by humans). LiveCode returns a resolved file path on Windows which invariably has a drive letter.
Yes, that was my concern about the solution the OP is considering.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”