Sunday, July 26, 2009

Linking to audio file from database record - method 2

Earlier posts showed a method of creating a html page containing links to audio files in a folder on the computer and linking this file to a record in DB / TextWorks.

There is another way to create a link from the database record to an audio file on a computer so that when the link in the display form is clicked the audio file will play automatically. This method uses the UNC path to link to audio files and video files.

The initials UNC stand for Uniform Naming Convention. Instead of describing the location of a file or directory by drive letter, the Network Group will use a UNC path to describe the actual location of a file or directory. A UNC path is specific and applies to all operating systems.

Step 1
Locate the folder containing the audio files on the computer using My Computer or My Documents

Click the folder using the right button on the mouse

Click Sharing and Security

In Network Sharing and Security section

(Even though the computer may be stand alone this needs to be done)

Tick Share this folder on the network box

Enter the name of the folder to be shared eg TestAudio

Tick Allow network users to share my files

Click OK

NB If the above options are not available and the screen looks like the one on the left, click the link in this section for information about understanding the risks of file sharing to enable this function.

If you only want to enable file sharing just choose the file sharing option instead of the Network Setup Wizard.

Once the sharing of files has been enabled repeat the above steps to enable the contents of the folder to be shared.

See How to configure file sharing on a Windows XP computer
Step 2
Either create a database for audio files or add an additional field to the data structure in an existing database to contain the UNC path.
  • When entering the filename in the record, the syntax to use is:
  • Make sure that the field with the link appears in the Display report form.
  • To listen to the audio file, click the link in the Display report form.

To locate the computer name:
  • Locate the My Computer icon
  • Click the My Computer icon using the right button on the mouse
  • Click Properties
  • Select Computer Name tab
To locate the exact UNC path for the folder:
  • Click My Computer icon
  • Click the My Network Places Link
  • Click the required folder using the right button on the mouse
  • Click Properties
The Comment section contains the path to the folder - add name of required audio file to the path eg \\fred\TestAudio\football.mp3

NB: This method was tested using the Windows XP operating system.

Saturday, July 11, 2009

Linking to an audio file

A request was made at an Inmagic Museum Users Group meeting about the ability to play an oral history audio file directly from a link in a database record.

This can be done by following the steps in the previous post, Linking to files from database record, and linking to a html file stored in the same folder as the audio files are stored. The html file would either contain information about a particular audio file including the code - a href="nameaudiofile.mp3" Play audio file followed by /a or contain a list of audio files with the code linking to the audio file for each item.

The link provided would look like Play audio file

An example page for a list of audio files might be

Ron Smith recounts memories of attending Smithville Primary School during the 1930s
Play audio file

Ellen Brown recounts her days as postmistress in Smithville
Play audio file

NB links in above section are not functional links

When the html page and the audio file are in the same folder or the path to the audio file is included if in a different folder, clicking on the link will start the playing of the audio file.

Example of sample code for html page

NB. The above will only work if
1. there is a built in media player on the computer and
2. there is an internet browser installed (there does not have to be an internet connection).

Linking to files from database record

This example is using a DB/TextWorks database but there should be ways to also do this in other databases.

As well as being able to link database records to images, DB/TextWorks has the ability to link from a field in a database to another file such as a word document, spreadsheet, html file etc.

A number of steps are required:

1. To activate the facility to create the link
Open DB/TextWorks and go to the Tools menu then select Options and then Display.
Tick the box Detect URLs, EMail links, etc. and convert to hypertext links then click OK

2. A field needs to be added to the database to include the link directly to a word document, spreadsheet, pdf , html file etc which will open in a new window.

In the data structure include a field called (for example) File Name. It is a normal text field.
Go to the Maintain menu, select Edit Textbase Structure then Edit Fields
Type the name of the new field (for example) File Name and then click Add. Use the Close button to close the box and then OK.

3. If basic forms are not being used it will be necessary to alter edit and display forms to include the new field.
Go to the Display menu and then select Design form. Choose the form to be altered.
Click Add form box icon, select the name of the required field (for example) Field Name and then click the Add button

When designing the Display report form added text is required
Display - Form Designer - click required field eg Field Name - Tools - Box Properties - Format - Added Text - In the Beginning text box type file:// then click Apply

5. In the Edit form, if linking to an item is required, put in the full path to locate the item - C:\database\test.doc

6. View the record in the display form.

The result is that the display report form then allows the inclusion of a link to the required document in a new window.

The Maxus website contains a technical tip providing information on Live Hypertext Links in DB/TextWorks which also refers to linking to documents etc.