home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / setprofilestring.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  2.4 KB  |  80 lines

  1. <!---This example uses SetProfileString to set the 
  2.      timeout value in an initialization file. --->
  3.  
  4. <HTML>
  5. <HEAD>
  6. <TITLE>
  7. SetProfileString Example
  8. </TITLE>
  9. </HEAD>
  10.  
  11. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  12.  
  13. <BODY  bgcolor="#FFFFD5">
  14.  
  15. <H3>SetProfileString Example</H3>
  16.  
  17. This example uses SetProfileString to set the value of timeout in an initialization file. Enter the full path of your initialization file, specify the timeout value, and submit the form.
  18.  
  19. <!---  This section of code checks to see if the form was submitted.
  20.        If the form was submitted, this section sets the initialization
  21.        path and timeout value to the path and timeout value specified 
  22.        in the form                                                        --->
  23. <CFIF Isdefined("Form.Submit")>
  24.  
  25.     <CFSET IniPath = #form.iniPath#>
  26.  
  27.     <CFSET Section = "boot loader">
  28.     
  29.     <CFSET MyTimeout = #form.MyTimeout#>
  30.     
  31.     <CFSET timeout = GetProfileString(IniPath, Section, "timeout")>
  32.  
  33.     <CFIF timeout Is Not MyTimeout>
  34.         <CFIF MyTimeout Greater Than 0>
  35.             <HR size="2" color="#0000A0">
  36.             <P>Setting the timeout value to <CFOUTPUT>#MyTimeout#</CFOUTPUT></P>
  37.             <CFSET code = SetProfileString(IniPath, "boot loader", "timeout", MyTimeout)>
  38.             <P>Value returned from SetProfileString: <CFOUTPUT>#code#</CFOUTPUT></P>
  39.         <CFELSE>
  40.             <HR size="2"  color="red">
  41.             <P>Timeout value should be greater than zero in order to provide time for user response.</P>
  42.             <HR size="2"  color="red">    
  43.         </CFIF>
  44.     <CFELSE>
  45.         <P>The timeout value in your initialization file is already <CFOUTPUT>#MyTimeout#</CFOUTPUT>.</P>    
  46.     </CFIF>
  47.  
  48.     <CFSET timeout = GetProfileString(IniPath, "boot loader", "timeout")>
  49.     
  50.     <CFSET default= GetProfileString(IniPath, "boot loader", "default")>
  51.     
  52.     
  53.     <H4>Boot Loader</H4>
  54.     <P>Timeout is set to: <CFOUTPUT>#timeout#</CFOUTPUT>.</P>
  55.     <P>Default directory is: <CFOUTPUT>#default#</CFOUTPUT>.</P>
  56.             
  57. </CFIF>
  58.  
  59. <FORM ACTION="setprofilestring.cfm" METHOD="POST">
  60. <HR size="2" color="#0000A0">
  61. <table cellspacing="2" cellpadding="2" border="0">
  62. <tr>
  63.     <td>Full Path of Init File</td>
  64.     <td><input type="Text" name="IniPath" value="C:\myboot.ini"></td>
  65. </tr>
  66. <tr>
  67.     <td>Timeout</td>
  68.     <td><input type="Text" name="MyTimeout" value="30"></td>
  69. </tr>
  70. <tr>
  71.     <td><input type="Submit" name="Submit" value="Submit"></td>
  72.     <td></td>
  73. </tr>
  74. </table>
  75.  
  76. </FORM>
  77. <HR size="2" color="#0000A0">
  78.  
  79. </BODY>
  80. </HTML>