Jump to content
nightofgrim

NSAppleScript ignoring delay

Recommended Posts

This seems odd to me. As an example I made a workflow that runs an NSAppleScript like so:

 

on alfred_script(q)
  delay 10
  display dialog "hello world"
end alfred_script
 
 
The dialog appears immediately without the delay. When I run this script in the AppleScript editor it works fine.
 
Of course I'm not intending to make a workflow that makes a 'hello world' dialog, but what I am trying to do requires delay to work.

Share this post


Link to post

 

This seems odd to me. As an example I made a workflow that runs an NSAppleScript like so:

 

on alfred_script(q)
  delay 10
  display dialog "hello world"
end alfred_script
 
 
The dialog appears immediately without the delay. When I run this script in the AppleScript editor it works fine.
 
Of course I'm not intending to make a workflow that makes a 'hello world' dialog, but what I am trying to do requires delay to work.

 

 

That is interesting. Even more so that I got it to work correctly the first time. I'll check with Andrew and see if knows anything about this. As a workaround, instead of using NSAppleScript, if you add a "Run Script" and set the language to osascript, it seems to work as expected.

Share this post


Link to post

That is interesting. Even more so that I got it to work correctly the first time. I'll check with Andrew and see if knows anything about this. As a workaround, instead of using NSAppleScript, if you add a "Run Script" and set the language to osascript, it seems to work as expected.

Also had this issue. Any comments on this?

Share this post


Link to post

This IS interesting.  When I set to run NSApplescript the result is random at best.  I set the workflow to run from a hotkey.  Each time, the number of seconds that passes before the dialog appears is random, from instant, to the required 10 secs.

 

When I set the hotkey to run the action 'script' and set to osascript as David suggests, it, so far, has been waiting the required amount of time before the dialog pops up.

Share this post


Link to post

This IS interesting.  When I set to run NSApplescript the result is random at best.  I set the workflow to run from a hotkey.  Each time, the number of seconds that passes before the dialog appears is random, from instant, to the required 10 secs.

 

When I set the hotkey to run the action 'script' and set to osascript as David suggests, it, so far, has been waiting the required amount of time before the dialog pops up.

exactly! Iam now using walkaround latter method...

Share this post


Link to post

exactly! Iam now using walkaround latter method...

 

I'm going to move this on over to the bug reports area to make sure it catches Andrew's eye. I'll follow up with him as well just to make sure.

Share this post


Link to post

I'm going to move this to 'noted' as the delay does appear to be a bit random, but this looks more like a bug in NSAppleScript than Alfred as the delay command is clearly being run, just for an arbitrary amount of time.

Share this post


Link to post
×
×
  • Create New...