Please check this code below. Giving up after 1 works only when the Finder is activated (meaning Finder is in the foreground), if the activate is removed, the dialog window is behind all other windows and it just waits without giving up.
Is there a way to do this correctly or a workaround exists?
Many thanks!