anonymous1184

https://redd.it/vn0lta

Jun 28th, 2022 (edited)
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; UIA check
  2. #SingleInstance Force
  3. if (!A_IsCompiled && !InStr(A_AhkPath, "_UIA.exe")) {
  4.         newPath := RegExReplace(A_AhkPath, "\.exe", "U" (32 << A_Is64bitOS) "_UIA.exe")
  5.         Run % StrReplace(DllCall("Kernel32\GetCommandLine", "Str"), A_AhkPath, newPath)
  6.         ExitApp
  7. }
  8.  
  9. #Warn ; Enable warnings to assist with detecting common errors.
  10. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  11. SetWorkingDir % A_ScriptDir ; Ensures a consistent starting directory.
  12.  
  13. EnvGet OneDrive, ONEDRIVE
  14. root := OneDrive "\Backup\Optimal\Scripts\Other\Playnite\Citra mods\Mods 2"
  15.  
  16. Buttons := {}                                                                  ; Create Object for the Folder Names and Related Paths
  17. loop Files, % root "\*.*", D
  18. {
  19.         Gamename := A_LoopFileName     ; save game name
  20.         Gamepath := A_LoopFileFullPath ; save game path
  21.         loop Read, % A_ScriptDir "\Destination.txt"
  22.         {
  23.                 MsgBox % "Dateizeile pruefen: " A_LoopReadLine " spielname: " Gamename
  24.                 if (InStr(A_LoopReadLine, Gamename))
  25.                 {
  26.                         MsgBox yes
  27.                         Destination := StrReplace(A_LoopReadLine, Gamename, "")
  28.                 }
  29.         }
  30.         loop Files, % Gamepath "\*.*", D
  31.         {
  32.                 Buttons.Push({"Name":A_LoopFileName, "Path":A_LoopFileFullPath})
  33.         }
  34. }
  35.  
  36. for each,button in Buttons
  37. {                                                                              ; Move through the Buttons object, one button at a time
  38.         Buttonhwnd := RegExReplace(button.Name, "[^A-Z0-9]")                   ; Sanitising the button name for use as a Hwnd
  39.         Gui Add, Button, % "+HWNDh" Buttonhwnd, % "Apply " button.Name " mod"  ; Adding the button to the GUI, with the Hwnd as an option
  40.         ControlHandler := Func("FileActions").Bind(root, button)               ; Create Link from the button to the function we want
  41.         GuiContro, +g, % h%Buttonhwnd%, % ControlHandler                       ; Update the button control to call the ControlHandler
  42. }
  43.  
  44. Gui Show                                                                       ; Show the GUI with the folders as Buttons
  45.  
  46.  
  47. return ; End of auto-execute
  48.  
  49.  
  50. FileActions(Root, Button)
  51. {
  52.         if (HasFolder(Root "\3d Land", "Kaizo Mario 3D Land"))
  53.                 MsgBox Kaizo Mario 3D Land ist da
  54.         if (HasFolder(Root "\3d Land", "Super Mario 3d Land Expedition"))
  55.                 MsgBox Super Mario 3d Land Expedition ist da
  56.         if (HasFolder(Root "\NSMB", "NSMBNext The Lost Levels"))
  57.                 MsgBox NSMBNext The Lost Levels ist da
  58. }
  59.  
  60. HasFolder(Root, Subfolder)
  61. {
  62.         Root := RTrim(Root, "\")
  63.         if (!FileExist(Root)) {
  64.                 ErrorLevel := -1
  65.                 return
  66.         }
  67.         Subfolder := RTrim(Subfolder, "\")
  68.         attributes := FileExist(Root "\" Subfolder)
  69.         hasFolder := !!InStr(attributes, "D")
  70.         ErrorLevel := !hasFolder
  71.         return hasFolder
  72. }
  73.  
Add Comment
Please, Sign In to add comment