0

I need one script to initiate the execution of another script, but the second script should not begin execution until the rest of the first one has completed for a second or two.

The order would be:

  1. Start script A.
  2. Script A does something to say that script B should execute.
  3. Script A finishes.
  4. A second or two pass.
  5. Script B begins executing.

Is this possible?

  • 1
    What's keeping you from appending sleep 2; exec scriptB to the end of scriptA? – Jeff Schaller Nov 27 '17 at 1:18
  • I need script B to execute after script A has completed. It cannot start until script A is no longer running. More details: This is within FileMaker Pro Advanced on macOS. FileMaker needs to do some preparation by executing one Python script. That's script A. Script B is an AppleScript that uses interface scripting to control FileMaker's menus and windows. That can't happen if FileMaker is running a script. The menus aren't available. So first Python needs to do its prep, then some brief time needs to pass, then AppleScript needs to do its work. – Chuck Nov 27 '17 at 1:29
2

Here's how you could do it in shell scripts; someone else would have to answer in Python.

$ cat scriptA
#!/bin/sh
echo begin script A
(sleep 2; nohup ./scriptB 2>/dev/null) &
echo end script A at $(date)
$ cat scriptB
#!/bin/sh
date > scriptB.dat

Sample run:

$ ./scriptA
begin script A
end script A at Sun Nov 26 20:46:10 EST 2017
$ sleep 2
$ cat scriptB.dat
Sun Nov 26 20:46:12 EST 2017
0

Can the AppleScript be running while the shell code does its thing? If so maybe

do shell script "pathtoyourcodehere"
delay 3
display dialog "fmpro interface foo here"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.