CFREGISTRY


CFREGISTRY

The CFREGISTRY tag enables you to read, write, and delete values from the system registry.

Depending on the action that you choose to perform with the CFREGISTRY tag, the attributes that the tag takes are slightly different. In this section, we quickly run down all available action options and the attributes associated with each.

ACTION="getAll"

With the CFREGISTRY action "getAll", CFREGISTRY returns all keys and values present in the specified registry branch. After they are returned, you have access to these values as you would with any other ColdFusion recordset.

Table 12.5 gives an overview of the attributes associated with the CFREGISTRY tag when the "getAll" action is specified.

Table 12.5. Attributes for CFREGISTRY with the "getAll" Action

Attribute

Description

branch

This is a required attribute that specifies the name of the registry branch from which you would like to retrieve values.

type

This is an optional attribute that specifies the type of data that you would like to retrieve. Valid parameters for this attribute are as follows:

  • string

  • dword

  • key

  • any

name

This is a required attribute that enables you to specify the name of the recordset in which the returned values will be stored.

sort

This is an optional attribute that enables you to sort the data returned as you would any ColdFusion recordset.

ACTION="get"

With the CFREGISTRY action "get", CFREGISTRY returns a specific registry value and stores it for you in a ColdFusion variable, as shown in the following code:

 <html>  <head>  <title>  EXAMPLE OF CFREGISTRY USAGE  </title>  </head>  <body>  <!---USE CFREGISTRY TO DISPLAY CURRENT JRE VERSION--->  <cfregistry action="get"       branch="HKEY_LOCAL_MACHINE\SOFTWARE\Javasoft\Java Runtime Environment"       type="String"       entry="CurrentVersion"       variable="myversion">  <!---OUTPUT THE RESULTS--->  <cfoutput>  JRE Version: #myversion#<br>  </cfoutput>  <!---USE CFREGISTRY TO GET THE JRE HOME DIRECTORY FROM THE VERSION NUMBER--->  <cfregistry action="get"       branch="HKEY_LOCAL_MACHINE\SOFTWARE\Javasoft\Java Runtime  Environment\#myversion#"       type="String"       entry="JavaHome"       variable="myhome">  <!---OUTPUT THE RESULTS--->  <cfoutput>  JRE Home Directory: #myhome#<br>  </cfoutput></body>  </html> 

Table 12.6 gives an overview of the attributes associated with the CFREGISTRY tag when the "get" action is specified.

Table 12.6. Attributes for CFREGISTRY with the "get" Action

Attribute

Description

branch

This is a required attribute that specifies the name of the registry branch from which you would like to retrieve values.

type

This is an optional attribute that specifies the type of data you would like to retrieve. Valid parameters for this attribute are as follows:

  • string

  • dword

  • key

entry

This is a required attribute that specifies to ColdFusion exactly which registry entry you would like to retrieve.

variable

This is a required attribute that specifies the name of the ColdFusion variable in which you would like the data that is retrieved to be stored.

ACTION="set"

With the CFREGISTRY action of "set", CFREGISTRY enables you to set the value of a registry entry or add a new entry altogether.

Table 12.7 gives an overview of the attributes associated with the CFREGISTRY tag when the "set" action is specified.

Table 12.7. Attributes for CFREGISTRY with the "set" Action

Attribute

Description

branch

This is a required attribute that specifies the name of the registry branch that contains (or will contain) the values that you wish to set.

type

This is an optional attribute that specifies the type of data you would like to set. Valid parameters for this attribute are as follows:

  • string

  • dword

  • key

entry

This is a required attribute that specifies to ColdFusion exactly which registry entry you would like to set.

variable

This is an optional attribute that specifies the data value to be set.

ACTION="delete"

With the CFREGISTRY action of "delete", CFREGISTRY enables you to delete a specific registry value.

Table 12.8 gives an overview of the attributes associated with the CFREGISTRY tag when the "delete" action is specified.

Table 12.8. Attributes for CFREGISTRY with the "delete" Action

Attribute

Description

branch

This is a required attribute and must include one of the following:

  • To delete a key, you must specify the name of the registry key to be deleted. If you want to delete an entire key, do not specify an entry.

  • To delete a value, include the name of the branch in which the value is contained and make sure to specify an entry to be deleted within that branch.

entry

This attribute is required when you want to delete a value. Enter the name of the value that you want to delete.



Inside ColdFusion MX
Inside Coldfusion MX
ISBN: 0735713049
EAN: 2147483647
Year: 2005
Pages: 579

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net