dScope prices from just US$4395/GB£3264 Request your personal on-line demo NOW!
Spectral Measurement Logo
Prism Sound Logo
  • Touch navigation
  • Home
    • News/Press
    • Offers
    • Corporate
    • Heritage
    • Events
    • Careers
    • Other Sites:
      • Recording and Production
      • Logging and Transcription
      • SADiE
      • Imerge
      • Audiophile
      • XiVA
    • Links
      • Reviews
      • Users
  • PRODUCTS
    • dScope Series IIIdScope
      Series III
      Digital and Analogue Audio Analyzer
    • dScope M1dScope
      M1
      Digital and Analogue Audio Analyzer
    • I/O SwitcherSwitcher
      dS-NET 16 x 2 I/O Switcher
    • VSIO adapterVSIO
      Digital Serial Interface Adapter
    • LPFdS-LPF
      Filter for digital amplifier tests
    • AutoTestSQL
      Production Test System
    • Auto Sequence
      Organizer, Automation & Reporting
    • TTC Loudspeaker Test ChamberTTC
      Loudspeaker Test Chamber
    • Other:
      • Recording and Production
      • Logging and Transcription
      • SADiE products
      • Imerge
      • Audiophile
  • APPLICATIONS
    • A/D and D/A conversion
    • Automotive Audio
    • Bluetooth Audio
    • Broadcast
    • Computer Audio
    • Education
    • Electro-acoustics
    • Home Entertainment
    • Manufacturing
    • Mobile Audio
    • Music Industry
    • Pro-Audio
    • R&D
    • Semiconductor
    • Service
  • SUPPORT
    • Support Home
    • FAQ
    • Downloads
    • Resources
    • Tech Support Form
    • Register Product
  • CONTACTS
    • Company Contact Info
    • Dealers and Distributors
    • Enquiry Form
    • Quotation Form
    • Mailing List Form
  • Home:
    • News/Press
      News stories and press releases
    • Offers
      Offers and promotions
    • Corporate
      Company information and history
    • Heritage
      Prism Sound heritage
    • Events
      Upcoming shows, exhibitions and events
    • Careers
      Jobs, careers and opportunities at Prism Sound
    • Other Sites:
      • Recording and Production
        Link to Prism Sound Recording and Production site
      • Logging and Transcription
        Link to Prism Sound Logging and Transcription site
      • SADiE
        Link to SADiE website
      • Imerge
        Link to Imerge website
      • Audiophile
        Link to Audiophile website
      • XiVA
        Link to XiVA website
    • Links
      Links to Prism Sound User's sites
      • Reviews
        Link to Prism Sound product reviews
      • Users
        Links to Prism Sound User's sites
  • PRODUCTS:
    • dScope Series IIIdScope
      Series III
      Digital and Analogue Audio Analyzer
    • dScope M1dScope
      M1
      Digital and Analogue Audio Analyzer
    • I/O SwitcherSwitcher
      dS-NET 16 x 2 I/O Switcher
    • VSIO adapterVSIO
      Digital Serial Interface Adapter
    • LPFdS-LPF
      Filter for digital amplifier tests
    • AutoTestSQL
      Production Test System
    • Auto Sequence
      Organizer, Automation & Reporting
    • TTC Loudspeaker Test ChamberTTC
      Loudspeaker Test Chamber
    • Other:
      • Recording and Production
        Recordind and Production products
      • Logging and Transcription
        Link to Prism Sound Logging and Transcription site
      • SADiE products
        Link to SADiE website
      • Imerge
        Link to Imerge website
      • Audiophile
        Link to Audiophile website
  • APPLICATIONS:
    • A/D and D/A conversion
    • Automotive Audio
    • Bluetooth Audio
    • Broadcast
    • Computer Audio
    • Education
    • Electro-acoustics
    • Home Entertainment
    • Manufacturing
    • Mobile Audio
    • Music Industry
    • Pro-Audio
    • R&D
    • Semiconductor
    • Service
  • SUPPORT:
    • Support Home
      Product technical support
    • FAQ
      FAQ's, Tips and Techniques
    • Downloads
      Software, Firmware and Manuals
    • Resources
      Reference material and downloadable resources
    • Tech Support Form
      Technical Support form
    • Register Product
      Studio products registration form
  • CONTACTS:
    • Company Contact Info
    • Dealers and Distributors
    • Enquiry Form
      Quick and Simple Enquiry Form
    • Quotation Form
      Request prices, loan or demo equipment
    • Mailing List Form
      Register for our mailing list

Scripts and Automation: File Selection from a script

A small example script that uses VBScript and the ScriptDlg DLL to create a file selection drop-list.

This script illustrates using the File System Object to select files. This could be used for choosing a test to run (as is done here) or for selecting a file of information (such as microphone calibration data). The basic concept is that we set up a user interface with ScriptDlg which incorporates a drop-list. This lists all the files in a particular folder of a particular type plus a button to open or execute the selected file. The description that follows assumes some knowledge of the basics of VB Script and is only concerned with the use of the File System Object to list files in a folder.

Test selection script screenshot


The File System Object
The File System Object (FSO) object model allows you to use the "object.method" syntax with a rich set of properties, methods, and events to process folders and files. It is primarily intended for use with developing web sites using server side scripting, but is accessible from the Windows Scripting Host using VBS and dScope DSS scripts.
To access it, we need to create the object using the line:

    Set FSO = CreateObject("Scripting.FileSystemObject")


We now have access to the file system object's methods and properties which we can use to gain access to the folders and files on the computer. The next step in the example given here is to list all the files in a particular folder. We do this by:

    Set strFolder = FSO.GetFolder(strpath) ' Loop through files, adding those with dss extension to the drop-list
    For Each strFile in strFolder.files
    strName = strFile.Name 
    If (right(strName, 3) = "dss") then	
        strName = left(strname, (len(strname)-4))
        selector.TestSel.AddString strName 
    End If
    Next

    'Select the first test so as not to leave the box blank
    selector.TestSel.cursel = 0

There is quite a bit in the above code that is out of the scope of the discussion here, but the pertinent lines are the first line, which sets the folder we are working with as an object in its own right, and the line beginning "For Each" which gets each file in the defined folder. The remaining lines in the For-Next loop retrieve the name of the file, check whether the last three characters are "dss", and add them to the drop-list of tests if they do. The last line simply selects the first file as the one to display in the drop-list so that the drop-list is not empty.

Usage
Download the script and unzip it to the dScope /scripts/automation folder. You can run it from the "automation/run script" menu option or from the "run script" button on the toolbar.

Because it is a script, you can open it to copy and paste relevant parts, or modify it to do what you want. To run it, simply select it from the "run script" dialogue in the dScope software. It is set in the script to look for the dScope installation path and then list all the dss scripts in the "scripts/automation" folder, but this can easily be changed.

Warning
Note that some functions of the FSO are very powerful and are open to abuse by virus writers. For this reason, good anti-virus software will often stop scripts running that use the FSO to access files. This is good news in the sense that it means that your anti-virus software is doing a good job, but it can be a nuisance too. You should be able to tell the anti-virus software to allow the script to run, but use this type of thing with care.



Resource Type: Scripts and Automation (File Download)
Download Link (https:): Test_Selection.zip
Size: 2 KiB  
Date 2005-09-23

Relevant Products:
product icondScope Series III
Analogue & Digital Audio Test System
product icondScope Series IIIA
Analogue Audio Test System
product icondScope Series IIIA+
Analogue-Plus Audio Test System
product icondScope Series IIIE
Digital and Analogue Essentials test system


info icon We're using a few cookies to make your visit here run smoothly. If you're happy with this, just continue to use the site as normal. To find out more, visit our cookie control page.

UK: +44 1353 648888




  Prism Media Products Limited trading as Spectral Measurement (formerly Prism Sound Test and Measurement); Registered in the UK, Reg. No. 2719511
  Address: Unit 1A, Grovemere House, Lancaster Way Business Park, Ely, Cambridgeshire, CB6 3NW, UK