Page 1 of 1
Volume Mount Message
Posted: Sat May 07, 2011 4:22 pm
by smoke
Is there a way to get a message when a volume is mounted?
Also, a command to unmount a volume?
Thanks!
Re: Volume Mount Message
Posted: Sat May 07, 2011 4:29 pm
by jmburnod
Hi Smoke,
Yes,
the volumes() function return the list of volumes (one volume by line)
Best
Jean-Marc
Re: Volume Mount Message
Posted: Sat May 07, 2011 4:49 pm
by smoke
Thanks Jean-Marc,
But I would have to run an idle handler to constantly query the volumes to know when a new volume is mounted, no?
I was hoping for a message that could trigger a handler?
Re: Volume Mount Message
Posted: Sat May 07, 2011 5:46 pm
by jmburnod
Hi Smoke,
But I would have to run an idle handler to constantly query the volumes to know when a new volume is mounted, no?
Yes. You can do it but maeby someone have a best way
Best
Jean-Marc
Re: Volume Mount Message
Posted: Sat May 07, 2011 8:29 pm
by FourthWorld
The rate at which idle messages are fired is governed by the idleRate property, so you could use it and minimize overhead by setting it to something higher than the default value of 200.
You may also consider a timer instead - this example uses "send in <time>" to generate a VolumeChanged message:
Code: Select all
local sLastVolumes
on CheckVolumesChanged
if the volumes <> sLastVolumes then
dispatch "VolumesChanged" to this cd
end if
put the volumes into sLastVolumes
send "CheckVolumesChanged" to me in 500 millisecs -- or whatever interval you feel is appropriate
end CheckVolumesChanged
You could enhance that to walk through the list to find which volumes have been added or removed and add that as argumens to the VolmesChanges notification it sends.
Re: Volume Mount Message
Posted: Sun May 08, 2011 3:46 am
by shaosean
You can do this through an external and that would save you from having to poll with the idle command..
Re: Volume Mount Message
Posted: Sun May 08, 2011 2:48 pm
by smoke
shaosean wrote:You can do this through an external..
Cool. Where would I find such a beast?
Re: Volume Mount Message
Posted: Sun May 08, 2011 8:00 pm
by shaosean
You would either need to write it yourself, or get someone to write it for you..
Re: Volume Mount Message
Posted: Sun May 08, 2011 8:29 pm
by smoke
I have not written externals for Rev before. Is there an SDK? Some example shells?
Re: Volume Mount Message
Posted: Sun May 08, 2011 9:02 pm
by shaosean