Example Code

Mac CFPreferences Access

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview

This is a example of a LLB file including two VIs that allow access to store and retrieve persistent data in the OS on the Mac.

 

Description

Here are two VIs that allow access to store and retrieve persistent data in the OS on the Mac.

CFPreferences Set Application Value 2012.vi (or CFPreferencesSetAppValue.vi) uses a Call Library Function Node to call the function CFPreferencesSetAppValue to store a string for a given key/applicationID.

CFPreferences Copy Application Value 2012.vi (or CFPreferencesCopyAppValue.vi ) uses the same way to call the function CFPreferencesCopyAppValue to retrieves a string for a given key/applicationID.

Very simple functionality.

 

Requirements

  • LabVIEW 2012 in Mac OS X v10.0 (or compatible)

 

Steps to Implement or Execute Code 

In CFPreferences Set Application Value 2012.vi

  1. Input the value of key/value/applicationID.
  2. Run the VI.

In CFPreferences Copy Application Value 2012.vi

  1. Input the value of key/applicationID.
  2. Run the VI and the value control will show the data.

 

Additional Information or References  

VI Snippet of CFPreferences Set Application Value 2012.vi

set.png

 

VI Snippet of CFPreferences Copy Application Value 2012.vi

copy.png

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.