Skip to content

Instantly share code, notes, and snippets.

@TLMcode
Last active January 11, 2018 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TLMcode/10c994d735afce5e7171ce2e58fe00ab to your computer and use it in GitHub Desktop.
Save TLMcode/10c994d735afce5e7171ce2e58fe00ab to your computer and use it in GitHub Desktop.
Push Values To Object Array Keys Correctly in AHk
SDDir = C:\some_directory ; some example directory
FilePropObj := { name : [], size : [], file : [ { name : "", size : "" } ] }
FileObj := [ { name : "", size : "" } ]
Loop, Files, % SDDir "\*", R
{
FileObj[ a_index , "name" ] := A_LoopFileName
FileObj[ a_index , "size" ] := A_LoopFileSize
FilePropObj.file[ a_index , "name" ] := A_LoopFileName
FilePropObj.file[ a_index , "size" ] := A_LoopFileSize
FilePropObj.name.push( A_LoopFileName ), FilePropObj.size.push( A_LoopFileSize )
; msgbox % FileObj[ a_index ].name " <> " FileObj[ a_index ].size "`n--------`n"
; . FilePropObj.file[ a_index ].name " <> " FilePropObj.file[ a_index ].size "`n--------`n"
; . FilePropObj.name[ a_index ] " <> " FilePropObj.size[ a_index ]
}
For Each, File in FileObj
msgbox % Each " <> " FileObj.Length() " <> " File.name " <> "
. FileObj[ Each ].name " <> " File.size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment