Page 1 of 1

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

Posted: Thu Apr 09, 2020 10:39 pm
by xyz
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.

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

Posted: Fri Apr 10, 2020 1:00 am
by FourthWorld
I don't believe an app can eject the volume it's mounted on.

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

Posted: Fri Apr 10, 2020 1:09 am
by xyz
I was afraid of that.

Thanks.

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

Posted: Fri Apr 10, 2020 9:30 am
by SparkOut
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.

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

Posted: Fri Apr 10, 2020 2:17 pm
by xyz
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).

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

Posted: Fri Apr 10, 2020 3:34 pm
by SparkOut
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

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

Posted: Fri Apr 10, 2020 4:04 pm
by FourthWorld
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.