Jump to content

Search the Community

Showing results for tags 'isregistrystring reg'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. This function will return a boolean value on whether a registry string is correctly formatted. Any suggestions for improvements then please post below. Thanks. Function: ; #FUNCTION# ==================================================================================================================== ; Name ..........: _IsRegKey ; Description ...: Check if a string is a valid registry string. ; Syntax ........: _IsRegKey($sRegistryKey) ; Parameters ....: $sRegistryKey - A registry string. ; $fFullPath - [optional] A fullpath is required. Default is False. ; Return values .: Success - True ; Failure - False ; Author ........: guinness ; Modified ......: Robjong - Improved syntax as well as adding additional parameter to check against a fullpath. ; Example .......: Yes ; =============================================================================================================================== Func _IsRegKey($sRegistryKey, $fFullPath = Default) Local $sPathSRE = $fFullPath ? '+' : '*' ; Requires fullpath Return StringRegExp($sRegistryKey, '(?i)\A\h*HK(CC|CR|CU|LM|U|EY_CLASSES_ROOT|EY_LOCAL_MACHINE|EY_USERS|EY_CURRENT_(USER|CONFIG))(64)?(?:\\[^\\]*)' & $sPathSRE & '\z') = 1 EndFunc ;==>_IsRegKeyExample use of Function: Example() Func Example() _Output('HKLM', True) _Output('HKLM\', True) _Output('HKLM\Example\Test', True) _Output('HKU\Example\Test', True) _Output('HKCU\Example\Test', True) _Output('HKCR\Example\Test', True) _Output('HKCC\Example\Test', True) _Output('HKEY\Example\Test', False) ; This will return False. _Output('HKEY_LOCAL_MACHINE64\Example\Test', True) _Output('HKEY_USERS\Example\Test', True) _Output('HKEY_CURRENT_USER\Example\Test', True) _Output('HKEY_CLASSES_ROOT\Example\Test', True) _Output('HKEY_CLASSES_ROOT\Example\Test', True) _Output('HKEY_CURRENT_CONFIG\Example\Test', True) _Output('HKCR_CLASSES_ROOT\Example\Test', False) ; This will return False. _Output('HKEY_CURRENT_EXAMPLE\Example\Test', False) ; This will return False. EndFunc ;==>Example Func _Output($sString, $fExpect) Local $fResult = _IsRegKey($sString) Local $sSciTEOutput = ($fResult == $fExpect)? '+' : '!' ConsoleWrite($sSciTEOutput & ' [' & $fResult & '] ' & $sString & @CRLF) EndFunc ;==>_Output
×
×
  • Create New...