Dialog give up time after shell script

I am working on a droplet that uploads files to a specific SFTP location. I have the basic mechanism working, and there is an odd behavior that has me baffled as to how it could be happening or how to fix it.

After uploading the file, I have the script display an alert dialog that confirms the job was done to the user, right before the script quits. To make this easier for the user, I use the “giving up after 3” seconds option to have the dialog auto dismiss. For small (30-40 meg and under files) this works perfectly.

Ok, now here is the odd part. When I drop a large (200 + meg) file onto the droplet, when the dialog displays after uploading, it flashes by in less than half a second. Changing the giving up time has no effect. Obviously, the 200+ meg file takes longer to upload, but somehow this time is affecting the give up time of the display alert comand.

Using dispay dialog does not exiibit this problem, but I would prefer to use display alert.

you can see this behavior with this simple script, just try different values… (for me, the problem appears after 3)

set dTime to text returned of (display dialog "enter delay time" default answer "5") --as string

set delayCmd to "sleep " & dTime

set cmdResult to (do shell script delayCmd)

display alert "job done..." buttons {"..."} giving up after 3

Looks like this came up before:


But no answer…

I tried your example. Very weird indeed.