Skip to content

Instantly share code, notes, and snippets.

@altbdoor
Created July 6, 2017 06:48
Show Gist options
  • Select an option

  • Save altbdoor/20ba51dbdb457986317f7067094040fd to your computer and use it in GitHub Desktop.

Select an option

Save altbdoor/20ba51dbdb457986317f7067094040fd to your computer and use it in GitHub Desktop.
Cleans orphan bonemod files in chara folder
#NoEnv
#NoTrayIcon
#SingleInstance force
SetWorkingDir %A_ScriptDir%
GUI:
Gui, Font, s10, Arial
Gui, Add, Text, x10 y10, Game Folder (Please select HoneySelect_64.exe):
Gui, Add, Edit, w300 h25 x10 yp+20 vGameFolder, C:\illusion\HoneySelect
Gui, Add, Button, w70 h25 xp+300 gBrowseFolder, Browse
Gui, Add, Button, Default Center w100 h25 xp+80 gScanFolder, Scan
Gui, Add, Text, w480 x10 yp+35 0x10
Gui, Add, Text, x10 yp+10, Bonemod files without chara card (Double-click to open file location):
Gui, Font, s10, Consolas
Gui, Add, ListView, w370 r10 Grid AltSubmit gBonemodFileList, Gender|File Name|Bonemod File Path
Gui, Font, s10, Arial
Gui, Add, Button, w100 xp+380 gDeleteFiles, Delete All
Gui, Show, Center w500, AHK HS Bonemod Clean v1.0
Return
BrowseFolder:
FileSelectFile, SelectGameFolder, , C:\, Please select HoneySelect_64.exe in your game folder
SelectGameFolder := RegExReplace(SelectGameFolder, "\\[^\\]+?$", "")
If (SelectGameFolder != "") {
GuiControl, , GameFolder, %SelectGameFolder%
}
Return
ScanFolder:
Gui, Submit, NoHide
; ensure game folder has last slash
GameFolder := GameFolder . "\"
GameFolder := RegExReplace(GameFolder, "\\+$", "\")
FemaleCharaFolder := GameFolder . "UserData\chara\female\"
MaleCharaFolder := GameFolder . "UserData\chara\male\"
LV_Delete()
GuiControl, -Redraw, BonemodFileList
Loop, Files, %FemaleCharaFolder%\*.png.bonemod.txt, F
{
BonemodFilename := A_LoopFileName
BaseFilename := RegexReplace(BonemodFilename, "\.png\.bonemod\.txt$", "")
ImageFilename := BaseFilename . ".png"
If (!FileExist(FemaleCharaFolder . ImageFilename)) {
LV_Add("", "Female", BaseFilename, A_LoopFileLongPath)
}
}
Loop, Files, %MaleCharaFolder%\*.png.bonemod.txt, F
{
BonemodFilename := A_LoopFileName
BaseFilename := RegexReplace(BonemodFilename, "\.png\.bonemod\.txt$", "")
ImageFilename := BaseFilename . ".png"
If (!FileExist(MaleCharaFolder . ImageFilename)) {
LV_Add("", "Male", BaseFilename, A_LoopFileLongPath)
}
}
Loop, 3
{
LV_ModifyCol(A_Index, "AutoHdr")
}
GuiControl, +Redraw, BonemodFileList
Return
BonemodFileList:
If (A_GuiEvent == "DoubleClick") {
LV_GetText(FullPath, A_EventInfo, 3)
Run % "explorer.exe /n,/select, """ FullPath """"
}
Return
DeleteFiles:
If (LV_GetCount() == 0) {
MsgBox, 0x40, Info, No Bonemod files without chara card.
}
Else {
MsgBox, 0x34, Confirm Delete, Are you sure you want to delete the Bonemod files without chara card? This action is not reversible!
IfMsgBox, Yes
{
Loop, % LV_GetCount()
{
LV_GetText(FullPath, A_Index, 3)
If (FileExist(FullPath)) {
FileDelete, %FullPath%
}
}
GoSub, ScanFolder
}
}
Return
GuiClose:
ExitApp
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment