Advertisement
9h5st

kin

Feb 8th, 2023 (edited)
1,237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DATA_FILE   := "data.ini"
  2. allAssets   := getAllAssets()
  3. lines       := ""
  4. filePath    := "geo_자산관리_데이터_" . A_Year . "-" . A_Mon . "-" . A_DD . ".csv"
  5.  
  6. for no, asset in allAssets
  7. {
  8.     line := ""
  9.     line .= asset.no . ","
  10.     line .= asset.type . ","
  11.     line .= asset.location . ","
  12.     line .= asset.department . ","
  13.     line .= asset.user . ","
  14.     line .= asset.connectedPC . ","
  15.     line .= asset.comNum . ","
  16.     line .= asset.assetNum . ","
  17.     line .= asset.note . ","
  18.     line .= asset.info . ","
  19.     line .= asset.history . "`n"
  20.    
  21.     lines .= line
  22. }
  23.  
  24. FileAppend, % lines, % filePath
  25. MsgBox done!
  26.  
  27. getAllAssets()
  28. {
  29.     global DATA_FILE
  30.    
  31.     IniRead, assetNos, % DATA_FILE
  32.    
  33.     if !StrLen(assetNos)
  34.         return false
  35.    
  36.     allAssets := {}
  37.    
  38.     Loop, Parse, assetNos, `n
  39.         allAssets[A_LoopField] := getKeysAndValuesInSection(A_LoopField)
  40.     return allAssets
  41. }
  42.  
  43. getKeysAndValuesInSection(section)
  44. {
  45.     global DATA_FILE
  46.    
  47.     IniRead, contentOfSection, % DATA_FILE, % section
  48.     sectionKeysAndValues := {}
  49.     Loop, Parse, contentOfSection, `n
  50.         if RegExMatch(A_LoopField, "^(?<key>.+?)=(?<value>.*)$", _)
  51.             sectionKeysAndValues[_key] := _value
  52.     return sectionKeysAndValues
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement