I is possible to eject a volume from a LC project running on that volume?

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
xyz
Posts: 30
Joined: Sat Feb 29, 2020 4:45 am

I is possible to eject a volume from a LC project running on that volume?

Post by xyz » Thu Apr 09, 2020 10:39 pm

I want to put my app on a USB flash drive. When it quits, I want it to eject the volume on which it resides. Is this possible?

I have been able to eject a flash drive volume when the app was not on it (by issuing a shell command), but I have been unable to eject the volume when the app is on that drive.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: I is possible to eject a volume from a LC project running on that volume?

Post by FourthWorld » Fri Apr 10, 2020 1:00 am

I don't believe an app can eject the volume it's mounted on.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

xyz
Posts: 30
Joined: Sat Feb 29, 2020 4:45 am

Re: I is possible to eject a volume from a LC project running on that volume?

Post by xyz » Fri Apr 10, 2020 1:09 am

I was afraid of that.

Thanks.

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

Re: I is possible to eject a volume from a LC project running on that volume?

Post by SparkOut » Fri Apr 10, 2020 9:30 am

Yes, that would be a bit like trying to lift yourself up off the ground by pulling your shoes. Well, nothing like it at all, but you see where I'm going.
You could write a script file to a temp folder on the PC and when shutting down the LC app, you could launch the temp script to eject the drive, maybe with a slight delay to allow LC app to close gracefully. The temp script could not then delete itself, but it would only leave a little cruft on the computer.

xyz
Posts: 30
Joined: Sat Feb 29, 2020 4:45 am

Re: I is possible to eject a volume from a LC project running on that volume?

Post by xyz » Fri Apr 10, 2020 2:17 pm

Thanks SparkOut for the suggestion. Actually I am working on exactly that. When the app on the flash drive shuts down, it launches another app on a different drive that ejects the flash drive. Not ideal but it will serve the purpose. Now I am trying to figure out how to get the second app (that ejects the drive) to do so automatically without user intervention (like clicking a button).

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

Re: I is possible to eject a volume from a LC project running on that volume?

Post by SparkOut » Fri Apr 10, 2020 3:34 pm

From LC
"launch"
or maybe "open process"

And actually this open source tool is apparently able to eject the drive it is on... go figure. Or test, anyway

https://quickandeasysoftware.net/softwa ... sk-ejector

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: I is possible to eject a volume from a LC project running on that volume?

Post by FourthWorld » Fri Apr 10, 2020 4:04 pm

xyz wrote:
Fri Apr 10, 2020 2:17 pm
Thanks SparkOut for the suggestion. Actually I am working on exactly that. When the app on the flash drive shuts down, it launches another app on a different drive that ejects the flash drive. Not ideal but it will serve the purpose. Now I am trying to figure out how to get the second app (that ejects the drive) to do so automatically without user intervention (like clicking a button).
Uninstallers do that, including LiveCode's, which is made in LiveCode.

On launch it checks the folder it's in, and if it's not in temp it copies itself to temp, launches it, and quits. Then the new copy in temp takes over, and because there's no active app in the app folder it can then delete that folder and it's contents.
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”