Hallo Gleichgesinnte,
ich habe mal wieder eine kleine Frage in der Hoffnung dass jemand von euch da draussen mehr weis als ich ?
Ich möchte ein Programm schreiben, dem ich "command-line parameters" mitgeben möchte. Folgend ist schon mal das
Gerüst und es funktioniert auch schon soweit:
--- copy & paste ---
If $CmdLine[0] = 0 Then
MAIN()
Exit
Endif
If StringInStr($CmdLine[1],"/path=",0) Then
;ConsoleWrite($CmdLine[1])
$CmdL=StringSplit($CmdLine[1],"=")
If StringLen($CmdL[2])>0 Then
MsgBox(0, "", $CmdL[2])
Else
HELPME()
Endif
Else
HELPME()
Endif
func MAIN()
MsgBox(0, "MAIN", "ok, its working - no paramaters given")
Exit
EndFunc
func HELPME()
MsgBox(0, "tool.exe", "available parameters: /path=YOURPATH")
Exit
EndFunc
--- copy & paste ---
Nun habe ich das Problem, dass ich bei "func MAIN()" natürlich keine MsgBox ausgeben möchte, sondern weitere Befehle und Abfragen durchführen möchte, welche aber in weiteren "Func" -> "EndFunc" eingebettet sind. z.B.
--- copy & paste ---
#include <Array.au3>
Func _RecursiveFileListToArray($sPath, $sPattern, $iFlag = 0, $iFormat = 1, $sDelim = @CRLF)
Local $hSearch, $sFile, $sReturn = ''
If StringRight($sPath, 1) <> '\' Then $sPath &= '\'
$hSearch = FileFindFirstFile($sPath & '*.*')
If @error Or $hSearch = -1 Then Return SetError(1, 0, $sReturn)
While True
$sFile = FileFindNextFile($hSearch)
If @error Then ExitLoop
If StringInStr(FileGetAttrib($sPath & $sFile), 'D') Then
If StringRegExp($sPath & $sFile, $sPattern) And ($iFlag = 0 Or $iFlag = 2) Then $sReturn &= $sPath & $sFile & '\' & $sDelim
$sReturn &= _RecursiveFileListToArray($sPath & $sFile & '\', $sPattern, $iFlag, 0)
ContinueLoop
EndIf
If StringRegExp($sFile, $sPattern) And ($iFlag = 0 Or $iFlag = 1) Then $sReturn &= $sPath & $sFile & $sDelim
WEnd
FileClose($hSearch)
If $iFormat Then Return StringSplit(StringTrimRight($sReturn, StringLen($sDelim)), $sDelim, $iFormat)
Return $sReturn
EndFunc ;==>_RecursiveFileListToArray
--- copy & paste ---
Kann mir jemand sagen, wie ich Funktionen in Funktionen packen kann ohne in Fehler zu laufen :O ?