Advertisement
Lorenzo501

Embedded INI.ahk

Feb 8th, 2024
1,005
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Requires AutoHotkey 2.0
  2. ;so you don't need to read/write to the registry
  3.  
  4. F1::GetFeatureStatus("Feature1")
  5. F2::GetFeatureStatus("Feature2")
  6. F3::IniWrite("Feature1=test123", A_ScriptFullPath, "SavedVariables2")
  7.  
  8. GetFeatureStatus(featureName)
  9. {
  10.     section := IniRead(A_ScriptFullPath, "SavedVariables")
  11.     linesSplit := StrSplit(section, "`n")
  12.  
  13.     for (line in linesSplit)
  14.         if (InStr(line, featureName))
  15.             if (StrSplit(line, "=")[2])
  16.                 MsgBox(featureName " is enabled")
  17.             else
  18.                 MsgBox(featureName " is disabled")
  19. }
  20.  
  21. /*
  22. [SavedVariables]
  23. Feature1=1
  24. Feature2=0
  25. [SavedVariables2]
  26. Feature1=test123
  27. */
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement