Jump to content

Getopt


piccaso
 Share

Recommended Posts

here is my (rather simple) approach

func GetOpt ($option)
  local $i
  for $i = 1 to $CmdLine[0]
    if $CmdLine[$i] == $option Then
    if $i+1 > $CmdLine[0] Then
      return 1
     else
      return $CmdLine[$i+1]
    endif
    endif
  next
  return 0
endfunc

for example

Getopt("/a") Returns 'Hello' if you start the prog using 'filename /a Hello'

Getopt("/a") Returns 'Hell o' if you start the prog using 'filename /a "Hell o" '

Getopt("/x") Returns 1 if you start the prog using 'filename /x'

Getopt("/x") Retuns 0 if you start the prog using 'filename /a /v /c lalala' or no parameters

looks nice until here :D

but Getopt("/a") Retuns '/x' if you start the prog using 'filename /a /x'

ok you can still use 'if Getopt("/a") <> 0 Then...'

did anybody out there do something better?

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...