123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537 |
-
-
-
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input
- SetWorkingDir %A_ScriptDir%
- SourceFile = glife.txt
- OutAllFile = Image List - All.txt
- OutUsedFile = Image List - Used.txt
- OutMissFile = Image List - Missing.txt
- OutAutoFile = Image Paths - Auto List.txt
- OutManFile = Image Paths - Manual List.txt
- SearchRegEx = i)<img\s+src\s*=\s*"(.*?)"
- Search2RegEx = i)\bview\s*'+(.*?)'+
- CommentRegEx = ^\s*!
- MarkMissRegEx = i)!.*?:\s+IMAGE NEEDED\s*~\s*.*?<img\s+src\s*=\s*"(.*?)"
- FileEncoding, UTF-16
- IfNotExist %SourceFile%
- {
- MsgBox, 16, Get Image Paths, Unable to locate "%SourceFile%" in "%A_WorkingDir%", 10
- Exit
- }
- ifExist %OutAllFile%
- {
- FileMove, %OutAllFile%, %OutAllFile%.bak, 1
- FileDelete, %OutAllFile%
- }
- ifExist %OutUsedFile%
- {
- FileMove, %OutUsedFile%, %OutUsedFile%.bak, 1
- FileDelete, %OutUsedFile%
- }
- ifExist %OutMissFile%
- {
- FileMove, %OutMissFile%, %OutMissFile%.bak, 1
- FileDelete, %OutMissFile%
- }
- ifExist %OutAutoFile%
- {
- FileMove, %OutAutoFile%, %OutAutoFile%.bak, 1
- FileDelete, %OutAutoFile%
- }
- ifExist %OutManFile%
- {
- FileMove, %OutManFile%, %OutManFile%.bak, 1
- FileDelete, %OutManFile%
- }
- FileRead, Source, %SourceFile%
- VarSetCapacity(OutAll, 4194304)
- VarSetCapacity(OutUsed, 4194304)
- VarSetCapacity(OutMiss, 4194304)
- VarSetCapacity(OutAuto, 1048576)
- VarSetCapacity(OutMan, 1048576)
- Loop, Parse, Source, `n, `r
- {
- if trim(A_LoopField) = ""
- continue
-
-
- FoundCmntPos := RegExMatch(A_LoopField, CommentRegEx)
- if (ErrorLevel)
- {
- MsgBox, 48, Get Image Paths, RegExMatch runtime error: %ErrorLevel%`n`nFound searching string: %A_LoopField%`n`nusing search: %CommentRegEx%
- break
- }
-
- if (FoundCmntPos)
- {
- FoundPos := RegExMatch(A_LoopField, MarkMissRegEx, Match)
- if (ErrorLevel)
- {
- MsgBox, 48, Get Image Paths, RegExMatch runtime error: %ErrorLevel%`n`nFound searching string: %A_LoopField%`n`nusing search: %MarkMissRegEx%
- break
- }
- if (FoundPos)
- {
- Match1 := StrReplace(Match1, "/", "\")
- IfExist %Match1%
- {
- OutMiss .= Spacer(Match1) . "- Missing file exists`n"
- }
- else
- {
- OutMiss .= Match1 . "`n"
- }
- }
- Continue
- }
-
- LineNo := A_index
-
-
- FoundPos := 1
- Haystack := A_LoopField
- Loop, 200
- {
-
-
- FoundPos := RegExMatch(Haystack, SearchRegEx, Match, FoundPos)
- if (ErrorLevel)
- {
- MsgBox, 48, Get Image Paths, RegExMatch runtime error: %ErrorLevel%`n`nFound searching string: %Haystack%`n`nusing search: %SearchRegEx%
- break
- }
-
- if (FoundPos = 0)
- {
- break
- }
- else
-
- {
- IdxTxt := " (L:" . LineNo . ", P:" . FoundPos . ")"
- Match1 := StrReplace(Match1, "/", "\")
- OutAll .= Match1 . "`n"
-
- if inStr(Match1, "<<")
- {
-
- if inStr(Match1, "FUNC(''$face_image''")
- {
- if GetImageFiles("images\body\hairstyles", "hcol*.jpg", OutUsed, "", "FR")
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\body\hairstyles\*\hcol*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\body\hairstyles\*\hcol*.jpg' " . IdxTxt . "`n"
- }
-
- }
- else if inStr(Match1, "FUNC(''$clothing_image''")
- {
- if GetImageFiles("images\clothes", "vatnik.jpg", OutUsed)
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\clothes\vatnik.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\clothes\vatnik.jpg' " . IdxTxt . "`n"
- }
-
-
- if GetImageFiles("images\clothes", "jeans*.jpg", OutUsed, "i)jeans\d+\.jpg")
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\clothes\jeans*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\clothes\jeans*.jpg' " . IdxTxt . "`n"
- }
- if GetImageFiles("images\clothes", "yoga*.jpg", OutUsed, "i)yoga\d+\.jpg")
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\clothes\yoga*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\clothes\yoga*.jpg' " . IdxTxt . "`n"
- }
- if GetImageFiles("images\clothes", "sarafan*.jpg", OutUsed, "i)sarafan\d+\.jpg")
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\clothes\sarafan*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\clothes\sarafan*.jpg' " . IdxTxt . "`n"
- }
- if GetImageFiles("images\clothes", "short*.jpg", OutUsed, "i)short\d+\.jpg")
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\clothes\short*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\clothes\short*.jpg' " . IdxTxt . "`n"
- }
- if GetImageFiles("images\clothes", "skirt*.jpg", OutUsed, "i)skirt\d+\.jpg")
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\clothes\skirt*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\clothes\skirt*.jpg' " . IdxTxt . "`n"
- }
- if GetImageFiles("images\clothes", "dress*.jpg", OutUsed, "i)dress\d+\.jpg")
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\clothes\dress*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\clothes\dress*.jpg' " . IdxTxt . "`n"
- }
- if GetImageFiles("images\clothes", "profi*.jpg", OutUsed, "i)profi\d+\.jpg")
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\clothes\profi*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\clothes\profi*.jpg' " . IdxTxt . "`n"
- }
- if GetImageFiles("images\clothes", "pants*.jpg", OutUsed "i)pants\d+\.jpg")
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\clothes\pants*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\clothes\pants*.jpg' " . IdxTxt . "`n"
- }
- if GetImageFiles("images\clothes", "latex*.jpg", OutUsed, "i)latex\d+\.jpg")
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\clothes\latex*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\clothes\latex*.jpg' " . IdxTxt . "`n"
- }
- if GetImageFiles("images\clothes", "hooker*.jpg", OutUsed, "i)hooker\d+\.jpg")
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\clothes\hooker*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\clothes\hooker*.jpg' " . IdxTxt . "`n"
- }
- if GetImageFiles("images\clothes", "k*.jpg", OutUsed, "i)k\d+\.jpg")
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\clothes\k*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\clothes\k*.jpg' " . IdxTxt . "`n"
- }
- if GetImageFiles("images\clothes\newclo", "*.jpg", OutUsed, "i)\d+\.jpg")
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\clothes\newclo\*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\clothes\newclo\*.jpg' " . IdxTxt . "`n"
- }
- if GetImageFiles("images\img\dress", "ero*.jpg", OutUsed, "i)ero\d+\.jpg")
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\img\dress\ero*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\img\dress\ero*.jpg' " . IdxTxt . "`n"
- }
- }
- else if inStr(Match1, "images\qwest\card")
- {
- if GetImageFiles("images\qwest\card", "*.jpg", OutUsed, "", "FR")
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\qwest\card\*\*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- No files found in 'images\qwest\card\*\*.jpg' " . IdxTxt . "`n"
- }
- }
-
- else if inStr(Match1, "images\BDSM_Club\<<$BDSMrole>>")
- {
- BDSMRegEx := "i)(_\d+)\.jpg"
- BDSMPos := RegExMatch(Match1, BDSMRegEx , BDSMatch)
- if (ErrorLevel)
- {
- MsgBox, 48, Get Image Paths, RegExMatch runtime error: %ErrorLevel%`n`nFound searching string: %Match1%`n`nusing search: %BDSMRegEx%
- break
- }
-
- BDSMRegEx := "i)[rg]?\d+" . BDSMatch1 . "\.jpg"
-
- if GetImageFiles("images\BDSM_Club", "*.jpg", OutUsed, BDSMRegEx)
- {
- OutAuto .= Spacer(Match1) . "- Found 'images\BDSM_Club*.jpg'`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- no files found in 'images\BDSM_Club*.jpg' " . IdxTxt . "`n"
- }
- }
-
- else if inStr(Match1, "FUNC")
- {
- OutMan .= Spacer(Match1) . "- Unknown Function " . IdxTxt . "`n"
- }
-
- else if inStr(Match1, "$")
- {
- OutMan .= Spacer(Match1) . "- Used String Variable " . IdxTxt . "`n"
- }
-
- else if GetImagefromPath(Match1, OutUsed)
- {
- OutAuto .= Spacer(Match1) . "- Found image files`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- Files not found " . IdxTxt . "`n"
- }
- }
-
- else
- {
- IfExist %Match1%
- {
- OutUsed .= Match1 . "`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- File not found " . IdxTxt . "`n"
- }
- }
- FoundPos += 8 + StrLen(Match1)
- }
- }
-
-
-
- FoundPos := 1
- Haystack := A_LoopField
- Loop, 200
- {
-
-
- FoundPos := RegExMatch(Haystack, Search2RegEx, Match, FoundPos)
- if (ErrorLevel)
- {
- MsgBox, 48, Get Image Paths, RegExMatch runtime error: %ErrorLevel%`n`nFound searching string: %Haystack%`n`nusing search: %Search2RegEx%
- break
- }
-
- if (FoundPos = 0)
- {
- break
- }
- else
-
- {
- IdxTxt := " (L:" . LineNo . ", P:" . FoundPos . ")"
- Match1 := StrReplace(Match1, "/", "\")
- OutAll .= Match1 . "`n"
-
- if inStr(Match1, "<<")
- {
- if inStr(Match1, "FUNC")
- {
- OutMan .= Spacer(Match1) . "- Unknown Function " . IdxTxt . "`n"
- }
-
- else if inStr(Match1, "$")
- {
- OutMan .= Spacer(Match1) . "- Used String Variable " . IdxTxt . "`n"
- }
-
- else if GetImagefromPath(Match1, OutUsed)
- {
- OutAuto .= Spacer(Match1) . "- Found image files`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- Files not found " . IdxTxt . "`n"
- }
- }
-
-
- else
- {
- IfExist %Match1%
- {
- OutUsed .= Match1 . "`n"
- }
- else
- {
- OutMan .= Spacer(Match1) . "- File not found " . IdxTxt . "`n"
- }
- }
- FoundPos += 5 + StrLen(Match1)
- }
- }
- }
- OutAll := StrReplace(OutAll, "\", "/")
- OutUsed := StrReplace(OutUsed, "\", "/")
- OutMiss := StrReplace(OutMiss, "\", "/")
- OutAuto := StrReplace(OutAuto, "\", "/")
- OutMan := StrReplace(OutMan, "\", "/")
- Sort, OutAll, U
- Sort, OutUsed, U
- Sort, OutMiss, U
- Sort, OutAuto, U
- Sort, OutMan, U
- FileAppend, %OutAll%, %OutAllFile%
- FileAppend, %OutUsed%, %OutUsedFile%
- FileAppend, %OutMiss%, %OutMissFile%
- FileAppend, %OutAuto%, %OutAutoFile%
- FileAppend, %OutMan%, %OutManFile%
- Exit
- Spacer(TxtStr = "")
- {
- Static SpaceFill := " "
-
-
-
-
- return TxtStr . SubStr(SpaceFill, strlen(TxtStr)+1) . "`t"
-
- }
- GetImageFiles(FilePath, FileName, ByRef Output, FileNameRegEx := "", FileLoopMode := "F")
- {
-
-
-
- IfNotExist, %FilePath%
- {
- MsgBox, 48, Get Image Paths, Error in GetImageFiles()`n`nUnable to locate "%FilePath%" folder, Filename '%FileName%'.`n`nCurrent working dir is "%A_WorkingDir%"
- return false
- }
-
- SaveWorkDir := A_WorkingDir
- Setworkingdir, %FilePath%
-
- found := false
-
-
- Loop, Files, %FileName%, %FileLoopMode%
- {
- if(FileNameRegEx)
- {
- FndPos := RegExMatch(A_LoopFileName, FileNameRegEx)
- if (ErrorLevel)
- {
- MsgBox, 48, Get Image Paths, RegExMatch Error in function GetImageFiles()`n`nruntime error: %ErrorLevel%`n`nFound searching string: %A_LoopFileName%`n`nusing search: %FileNameRegEx%
- break
- }
- if (not FndPos)
- {
- continue
- }
- }
- fp := FilePath . "\" . A_LoopFileFullPath
- Output .= fp . "`n"
- found := true
- }
-
- Setworkingdir, %SaveWorkDir%
- return found
- }
- GetImagefromPath(FilePath, ByRef Output)
- {
- FindRegEx := "<<.*?>>"
- ReplaceStr := "*"
- fp := StrReplace(FilePath, "/", "\")
- fp := RegExReplace(fp, FindRegEx, ReplaceStr)
-
- splitpath, fp, FileName, Dir, Ext
-
- if inStr(Dir, "*")
- {
-
- return false
- }
- FileNameRegEx := StrReplace(FileName, "*", "\d+")
- FileNameRegEx := "i)" . StrReplace(FileNameRegEx, ".", "\.")
-
- return GetImageFiles(Dir, FileName, Output, FileNameRegEx)
- }
|