NIL OBJECT EXCEPTION on folderitem.item

The code below display information about what is done:
(it mount the first found .dmg item)

[code] Dim pasta as FolderItem
Dim f as FolderItem
Dim command As String
Dim i As Integer
Dim tipoDeArquivo As String
Dim s As New Shell

pasta = GetFolderItem(“Dossier”)

for i=1 to pasta.Count
command = pasta.item(i).name
tipoDeArquivo = right(pasta.item(i).name,3)
if tipoDeArquivo = “dmg” then
f = pasta.item(i)
command = "hdiutil attach -noverify " + f.ShellPath
s.Execute(command)

  System.DebugLog "Mounted item: " + f.NativePath
  exit
Else
  System.DebugLog "Skipped item: " + pasta.item(i).name
end if

next[/code]

And be carreful if you use .ChildAt because MyFolderItem.TrueItem(i) (first is i = 1) become MyFolderItem.ChildAt(i, False) (first is i = 0)