DropObject process after files are added

Hello,

I have a small utility that has to accept Photos as files and once I drop x files to add them into an array and once that complete to fire another window.

Is it possible to have that functionality with the current framework or not ?

Workflow is the following :

Open App
Drop Files on the ListBox
process them, if photos, add them to the FolderItem array
once all the files are processed open a popup for the next step
close the popup and reset the array .

Thanks.

Yes. Accept the files into an array in the DropObject event, then start a thread to process that array. The Finder won’t lock up when you take this approach. You can see this in action in ExeWrapper.

Well my process has to be 2 stages so I’m not sure I know how to doit.

Once you drop the pictures it has to add them to the array and some how to know once all of them are added, after this I have to show another popup which is the step 2 for the location and the rest of the parameters, then on that popup they decide if they process the photos or dismiss the whole process and reset the array .

That was the reason I asked that option .

In the DropObject I have

Do
  iPhotos.AddRow(obj.FolderItem)
Loop Until obj.NextItem = False

Var w As New wValidImport
w.ShowModal

but seeing how fast it jumps I assume that the drop gets fired for each file individually so in this case it will show the popup but long after I see the Finder that it shows that all the files were added which in my case is not quite ok.

Maybe I’m doing something wrong here.

Thanks

Like @Tim Parnell says, the best way that I’ve found is to split the process into two segments.

  1. Cycle through the dragItem and collect all the folderitems or pictures in the dragItem, stuff them into an array on the window or control. Once down fire a timer or thread.
  2. In your timer or thread, then set about processing the items.

The reason for this is modern macOS versions, will wait for a certain amount of time for the “Drop” to be completed, I think it was 10.10 would actually lock the Finder up in some cases, forcing the user to restart Finder or the computer. This way, returns from the drop pretty quickly and the Finder carries on, then you set about doing your tasks with the images.

[quote=468766:@Sam Rowlands]Like @Tim Parnell says, the best way that I’ve found is to split the process into two segments.

  1. Cycle through the dragItem and collect all the folderitems or pictures in the dragItem, stuff them into an array on the window or control. Once down fire a timer or thread.
  2. In your timer or thread, then set about processing the items.

The reason for this is modern macOS versions, will wait for a certain amount of time for the “Drop” to be completed, I think it was 10.10 would actually lock the Finder up in some cases, forcing the user to restart Finder or the computer. This way, returns from the drop pretty quickly and the Finder carries on, then you set about doing your tasks with the images.[/quote]
Part of the issue here is that in a modern OS, drag and drop is asynchronous and for the sake of backward compatibility, we force it to be synchronous.