Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '-------------------------------------------------------------------------'
- ' '
- ' [jTool] - Alle Befehle auslesen '
- ' j_cmdsAusgeben.vbs '
- ' '
- ' Version 1.1 - 11.12.2014 '
- ' '
- ' © Jeffry '
- ' '
- '-------------------------------------------------------------------------'
- Set fs = CreateObject("Scripting.FileSystemObject")
- pfad = fs.GetParentFolderName(Wscript.ScriptFullName)
- If(fs.FileExists(pfad & "\AlleBefehle.txt")) Then
- Set wFile = fs.OpenTextFile(pfad & "\AlleBefehle.txt", 8)
- wFile.WriteLine ""
- wFile.WriteLine ""
- Else
- Set wFile = fs.CreateTextFile(pfad & "\AlleBefehle.txt", True)
- End If
- wFile.WriteLine "----" & CStr(Now) & "----"
- cmds = 0
- Set sDir = fs.getfolder(pfad)
- For Each file In sDir.Files
- If(LCase(Right(file.path, 4)) = ".pwn") Then
- Set rFile = fs.OpenTextFile(file.path, 1)
- blockcomment = false
- Do While rFile.AtEndOfStream <> true
- str = ""
- str = rFile.ReadLine
- If(InStr(str, "*/") And blockcomment = true) Then blockcomment = false
- If(blockcomment = false) Then
- comment = InStr(str, "//")
- bcomment = InStr(str, "/*")
- ccomment = InStr(str, "*/")
- If(bcomment <> 0 And ccomment = 0) Then comment = bcomment
- tmp = InStr(str, "dcmd_")
- If(tmp And (comment > tmp Or comment = 0) And (ccomment < tmp Or bcomment > tmp) And (bcomment > tmp Or bcomment = 0)) Then
- If(InStr(tmp, str, "),") = 0 And InStr(tmp, str, ");") = 0 And InStr(str, "#define") = 0) Then
- tmpstr = Mid(str, tmp+5, InStr(tmp, str, "(")-(tmp+5))
- wFile.WriteLine "/" & tmpstr
- cmds = cmds + 1
- End If
- End If
- tmp = InStr(str, "ocmd:")
- If(tmp And (comment > tmp Or comment = 0) And (ccomment < tmp Or bcomment > tmp) And (bcomment > tmp Or bcomment = 0)) Then
- tmpstr = Mid(str, tmp+5, InStr(tmp, str, "(")-(tmp+5))
- wFile.WriteLine "/" & tmpstr
- cmds = cmds + 1
- End If
- tmp = InStr(str, "ocmd@")
- If(tmp And InStr(tmp+1, str, ":") = (tmp+6)) Then
- again = true
- start = InStr(tmp+1, str, ":")
- Do While again <> false
- again = false
- If(tmp And (comment > tmp Or comment = 0) And (ccomment < tmp Or bcomment > tmp) And (bcomment > tmp Or bcomment = 0)) Then
- If(start And InStr(start+1, str, ",") < InStr(start+1, str, "(")) Then
- tmpstr = Mid(str, start+1, InStr(start+1, str, ",")-(start+1))
- wFile.WriteLine "/" & tmpstr
- cmds = cmds + 1
- again = true
- Else
- If(start) Then
- tmpstr = Mid(str, start+1, InStr(start+1, str, "(")-(start+1))
- wFile.WriteLine "/" & tmpstr
- cmds = cmds + 1
- End If
- End If
- End If
- start = InStr(start+1, str, ",")
- Loop
- End If
- tmp = InStr(str, "YCMD:")
- If(tmp And (comment > tmp Or comment = 0) And (ccomment < tmp Or bcomment > tmp) And (bcomment > tmp Or bcomment = 0)) Then
- tmpstr = Mid(str, tmp+5, InStr(tmp, str, "(")-(tmp+5))
- wFile.WriteLine "/" & tmpstr
- cmds = cmds + 1
- End If
- if(tmp = 0) Then
- tmp = InStr(str, "CMD:")
- Else
- tmp = 0
- End If
- If(tmp And (comment > tmp Or comment = 0) And (ccomment < tmp Or bcomment > tmp) And (bcomment > tmp Or bcomment = 0)) Then
- tmpstr = Mid(str, tmp+4, InStr(tmp, str, "(")-(tmp+4))
- wFile.WriteLine "/" & tmpstr
- cmds = cmds + 1
- End If
- tmp = 0
- again = true
- Do While again <> false
- tmp = InStr(tmp+1, str, "strcmp(cmd")
- If(tmp) Then start = InStr(tmp, str, """")
- again = false
- If(tmp And (comment > tmp Or comment = 0) And (ccomment < tmp Or bcomment > tmp) And (bcomment > tmp Or bcomment = 0)) Then
- If(InStr(tmp, str, "/") = (start+1)) Then
- tmpstr = Mid(str, start+2, InStr(start+1, str, """")-(start+2))
- wFile.WriteLine "/" & tmpstr
- cmds = cmds + 1
- again = true
- End If
- End If
- Loop
- tmp = 0
- again = true
- Do While again <> false
- tmp = InStr(tmp+1, str, "strcmp(""/")
- If(tmp And InStr(tmp+1, str, "cmd")) Then start = InStr(tmp, str, """")
- again = false
- If(tmp And (comment > tmp Or comment = 0) And (ccomment < tmp Or bcomment > tmp) And (bcomment > tmp Or bcomment = 0)) Then
- If(InStr(tmp, str, "/") = (start+1)) Then
- tmpstr = Mid(str, start+2, InStr(start+1, str, """")-(start+2))
- wFile.WriteLine "/" & tmpstr
- cmds = cmds + 1
- again = true
- End If
- End If
- Loop
- If(InStr(str, "/*") And InStr(str, "*/") = 0 And blockcomment = false) Then blockcomment = true
- End If
- Loop
- rFile.Close()
- End If
- Next
- wFile.close()
- If(cmds > 0) Then
- MsgBox "Es wurden " & cmds & " Befehle gefunden und gespeichert."
- Else
- MsgBox "Es wurden keine Befehle gefunden."
- End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement