PDA

View Full Version : Simple lua question



benbell
April 24th, 2008, 03:06 PM
Hi again,

I'd like to write a lua script that when triggered will open TheaterTek if a regular DVD is in the tray and PowerDVD if a blu-ray is in. I figure the easiest way of doing this would be to look at how large the disc is in megabytes (eg - open TheaterTek if size is < 8 GB or open PowerDVD if size is > 8GB). My problem is that I'm not sure how to make lua check disc size.



if size == <8GB then
gir.TriggerEvent('TheaterTek', 18)
elseif size == >8GB then
gir.TriggerEvent('PowerDVD', 18)
else
print('Unexpected state')
end


Any suggestions with those if statements?

Thanks,

Ben

quixote
April 24th, 2008, 06:17 PM
Try this after changing the drive letter and let me know if it works.



local size,free = win.GetDiskFreeSpace("g:\\")

if not size then print('Unexpected state')
elseif size <= 8000 then
gir.TriggerEvent('TheaterTek', 18)
elseif size >= 8000 then
gir.TriggerEvent('PowerDVD', 18)
end

benbell
April 27th, 2008, 08:13 PM
Thanks for the script quixote. I won't have a chance to test it on my BD machine till Friday. Will let you know if it works then.

For anyone else thinking about using this under Windows XP, you'll need to have the UDF 2.5 driver installed so that windows can see how big the drive is (http://files.digital-digest.com/downloads/articles/XBOX360.HD-DVDRom.UDF.Reader.v2.5.WindowsXP-BluePrint.rar) (included with Vista).

benbell
May 4th, 2008, 12:04 AM
Thanks! This works great!

Ben

quixote
May 5th, 2008, 01:30 AM
Good! Glad to here it worked.

You're welcome!