Jump to content

Search the Community

Showing results for tags '$cmdline parse'.

  • 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. Would be nice to have a function that can simplify $cmdline parsing and function a bit like like iniRead() does. $cmdline = ' -debug /param "c:"' $debug = cmdline('debug',False) Func cmdline($switchtofind, $default = '') EndFunc Found a function by Prog@ndy that would be nice to unitize for this but there is a bug: can't read when parameter ends with " Any idea how to fix? #include <Array.au3> $CMDString = '/a:"value" -big="this -test:1"23 is & $#@ _ your life" -installpath "c:" -test=th_3 -tte -äß$=/ätest/h.b' $ResultArray = _ParseCMDLine($CMDString) _ArrayDisplay($ResultArray) ;=============================================================================== ; ; Function Name: _ParseCMDLine($CMDString) ; Description:: Parses a CMD-String to Parameters with Values ; Parameter(s): $CMDString -> String to parse ; Requirement(s): ? ; Return Value(s): Error: 0 and @error = StringRegExp-Error ; Success: 2 Dimensional Array: ; $array[$i][0] : Parameter including value ; $array[$i][1] : Parameter ; $array[$i][2] : Value with quotation marks (only if value has quotaion marks) ; $array[$i][3] : Value without quotation marks ; Author(s): Prog@ndy ; ; Basis: http://regexlib.com/REDetails.aspx?regexp_id=1220 ;=============================================================================== ; Func _ParseCMDLine($CMDString) Local $y, $j, $i, $entry Local $x = StringRegExp($CMDString,'(?:s*)(?<=[-|/])(?<name>[^s-|/:|]*)(?:(?:[:|](?:("(?<value1>.*?)(?<!)")|(?<value>S*)))|w*?)',4) If @error Then Return SetError(@error,0,0) Local $ResultArray[UBound($x)][4] For $i = 0 To UBound($x)-1 $entry = $x[$i] For $y = 0 To UBound($entry)-1 $j = $y If $y > 3 Then $j = 3 $ResultArray[$i][$j] = $entry[$y] Next Next Return $ResultArray EndFunc
×
×
  • Create New...