The solution, which I don't particularly care for is to use a Bash script to get the available space on the USB drive, dump the answer in a text file, then import that text file into Base. It's messy, but works.
I was hoping that the structure shown below would have worked with Base, alas it did not. Maybe someone does know how to make it work.
The code below is on Page 503 of "
Useful Macro Information For OpenOffice.org" By Andrew Pitonyak
Code: Select all
vRC = Shell("C:\andy\TSEProWin\g32.exe", 2, "c:\Macro.txt")
The line of code below executes the bash script. The variable "
strDisplayDestination" is the location of the USB drive as captured by the
FolderPicker
Code: Select all
shell("/home/steve/MP3_Copy_Project/USBFreeSpace.sh " + strDisplayDestination)
The Bash script below writes the available space found on the USB drive to the text file "
USBFreeSpace.txt".
Code: Select all
#!/bin/bash
df ${1} | tr -s ' ' ' ' | cut -f4 -d' ' | sed "1 d" > /home/steve/MP3_Copy_Project/USBFreeSpace.txt
The (expanded) code below, located in Base, copies the available space into a Base (HSQLDB) table so that it is available to the program.
Code: Select all
If TableExists(strUSBTableName) Then
Dim oForm As Object
Dim dblUSBSize as double
Call Application.OpenConnection(ThisDatabaseDocument)
Set oForm = AllForms(strFormName)
docmd.runSQL("SET TABLE """ + strUSBTableName + """ SOURCE OFF;")
shell("/home/steve/MP3_Copy_Project/USBFreeSpace.sh " + strDisplayDestination)
docmd.runSQL("SET TABLE """ + strUSBTableName + """ SOURCE ""USBFreeSpace.txt"";")
docmd.runCommand("DBRefreshTables")
Set oRecordset = Application.CurrentDb().OpenRecordset("USBTableName")
oRecordset.movefirst
dblUSBSize= Round(CDbl(oRecordset.Fields("FREESPACETXT").Value) *GigabyteConv,4)
Forms(strFormName).Controls("TextBox6").value = str(dblUSBSize)
oRecordset.mclose
end if